Update findAllDescendants function signature

This commit is contained in:
chris committed 2026-09-30 09:40:22 -04:00
1 parent 1e57851111
commit c7ee1ec01e
1 file changed
+3 -2
+3 -2
View File
@@ -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;
}