Files
multica/server/cmd
Bohan-J 4fabe5914d feat(issue-status): admin CRUD API for the status catalog (MUL-4809)
Adds GET/POST/PATCH/DELETE /api/issue-statuses (plan §5):
- GET returns the catalog plus the alias resolution table (5 Category
  aliases + in_review/blocked) and per-Category defaults; readable by any
  member/agent since it drives `issue status`.
- POST creates a custom status (system_key NULL), validated against
  reserved alias tokens, the 5 Categories, an icon/color allowlist, a
  length cap, and a per-workspace active-custom cap.
- PATCH edits name/description/icon/color/position and swaps the Category
  default; category/system_key/workspace_id are immutable (400).
- DELETE archives (soft delete): system statuses and the current default
  are refused, and an in-use status requires a same-Category
  migrate_to_status_id, moving issues in the same tx.

All writes run under a workspace advisory lock so the cap, name
uniqueness, and the clear-then-set default swap stay atomic; the DB keeps
at most one default per Category, this layer keeps at least one. No FK:
workspace scoping is the WHERE guard. Adds issue_status:created/updated
events and full handler test coverage.

Co-authored-by: multica-agent <github@multica.ai>
2026-07-16 13:50:14 +08:00
..