Files
dashback/docs/api/routes/category/order.md
seb a0f9a8a716 Add PUT /category/order to reorder sibling categories.
Wires up existing category.order store method (validates categoryIds are
exactly the current children of parentId, sets each child sort to its
index in one transaction) behind an authenticated HTTP route, plus
@openapi docs and regenerated API docs.
2026-08-02 19:42:54 +02:00

895 B

PUT /category/order

Protected. Requires a valid session cookie (credentials: 'include').

Reorder sibling categories

Sets the sibling sort order of categoryIds under parentId. categoryIds must be exactly the current child set of parentId (same count, no foreign/duplicate ids). Each child's sort is set to its index 0..n-1 in one transaction.

Body (JSON)

{
  "parentId": 1,
  "categoryIds": [
    2,
    4,
    3,
    5
  ]
}

Response 200

New sibling order

{
  "categoryIds": []
}

Errors

Status Description
400 Invalid category order — {"error":"…"}
401 Unauthorized — {"error":"…"}
403 Not authorized — {"error":"…"}
404 Parent category not found — {"error":"…"}

Generated from @openapi JSDoc. Do not edit by hand — run npm run docs:api.