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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user