Update findAllDescendants function signature
This commit is contained in:
1 parent
1e57851111
commit
c7ee1ec01e
1 file changed
+3
-2
@@ -14,14 +14,15 @@ export class CategoryRepository {
|
||||
* Finds all descendants of a given path (including the path itself).
|
||||
* Uses the ltree operator <@ (is-descendant-of).
|
||||
*/
|
||||
async findAllDescendants(parentPath: string): Promise<CategoryNode[]> {
|
||||
async findAllDescendants(parentPath: string, userId: number): Promise<CategoryNode[]> {
|
||||
const query = `
|
||||
SELECT id, name, path
|
||||
FROM categories
|
||||
WHERE path <@ $1::ltree
|
||||
AND user_id = $2 --
|
||||
ORDER BY path ASC;
|
||||
`;
|
||||
const result = await this.db.query(query, [parentPath]);
|
||||
const result = await this.db.query(query, [parentPath, userId]);
|
||||
return result.rows;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user