Add category.order to reorder siblings under a parent.

Sets each direct child's sort to its index in the given categoryIds,
scoped by parentId. Validates the set matches the current children.
This commit is contained in:
seb
2026-08-02 19:41:54 +02:00
parent e96bfb0624
commit b070607357
5 changed files with 108 additions and 0 deletions

View File

@@ -91,6 +91,18 @@ FROM category
WHERE parent_id = @parentId
`;
export const LIST_CHILD_IDS = `
SELECT id
FROM category
WHERE parent_id = @parentId
`;
export const UPDATE_SORT = `
UPDATE category
SET sort = @sort
WHERE id = @id AND parent_id = @parentId
`;
export const DELETE = `
DELETE FROM category
WHERE id = @id