Files

1.3 KiB

Implementation Plan

1. Types And Tests

  • Add emergency DTOs and validators.
  • Add app/api/emergency/emergency-routes.test.ts first.
  • Cover list, create, status update, permission denial, missing organization, invalid input, and missing/cross-organization incident.

2. Server Operations And API Routes

  • Add modules/emergency/server/operations.ts.
  • Add GET/POST /api/emergency/incidents.
  • Add PATCH /api/emergency/incidents/[id].
  • Use requirePermission, active organization checks, structured failures, and audit logs.

3. Workspace UI

  • Replace app/(app)/app/emergency/page.tsx.
  • Keep scoped route delegating to the unscoped route.
  • Add modules/emergency/components/EmergencyWorkspaceClient.tsx.
  • Implement metrics, filters, create dialog, and status action buttons.

4. Default Data

  • Existing default workspace already inserts representative systemIncidents.
  • Review whether the seed includes open/acknowledged/resolved and critical/warning/info; adjust only if needed.

5. Verification

  • pnpm test
  • pnpm lint
  • pnpm type-check
  • pnpm build

Rollback Points

  • Remove modules/emergency, emergency API routes, and page changes.
  • No migration rollback expected unless implementation discovers schema changes are required.