feat: add states CRUD API route with project-scoped workflow states

- Add states.ts with GET/POST/PATCH/DELETE endpoints
- States scoped to project via projectId FK; workspace access resolved through project
- stateGroupEnum enforced (backlog|unstarted|started|completed|cancelled)
- List ordered by sortOrder, auto-increment on create
- Soft-delete via deletedAt column (added to schema)
- 3-step contract on every write: DB write, activity feed, pg_notify
- Register /api/states route in main index.ts
- Default state seeding already present in projects.ts
This commit is contained in:
2026-09-07 19:24:24 +00:00
parent 583c476e12
commit c5682765e8
3 changed files with 246 additions and 0 deletions
+2
View File
@@ -26,6 +26,7 @@ import { analyticsRoutes } from "./routes/analytics";
import { activityRoutes } from "./routes/activity";
import { importExportRoutes } from "./routes/import-export";
import { notificationRoutes } from "./routes/notifications";
import { stateRoutes } from "./routes/states";
import { healthHandler } from "./routes/health";
const app = new Hono();
@@ -62,6 +63,7 @@ app.route("/api/error-log", errorLogRoutes);
app.route("/api/analytics", analyticsRoutes);
app.route("/api/activity", activityRoutes);
app.route("/api/notifications", notificationRoutes);
app.route("/api/states", stateRoutes);
app.route("/api", importExportRoutes);
app.route("/api", realtimeRoutes);
app.route("/api/mcp", mcpRoutes);