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). * Finds all descendants of a given path (including the path itself).
* Uses the ltree operator <@ (is-descendant-of). * Uses the ltree operator <@ (is-descendant-of).
*/ */
async findAllDescendants(parentPath: string): Promise<CategoryNode[]> { async findAllDescendants(parentPath: string, userId: number): Promise<CategoryNode[]> {
const query = ` const query = `
SELECT id, name, path SELECT id, name, path
FROM categories FROM categories
WHERE path <@ $1::ltree WHERE path <@ $1::ltree
AND user_id = $2 --
ORDER BY path ASC; ORDER BY path ASC;
`; `;
const result = await this.db.query(query, [parentPath]); const result = await this.db.query(query, [parentPath, userId]);
return result.rows; return result.rows;
} }