2.9 KiB
2.9 KiB
安全应急事件工作台
Goal
Replace the current 安全应急 placeholder with a real emergency and safety event workspace. The MVP should let operators view, triage, update, and close persisted incidents inside the active organization.
Confirmed Facts
/app/emergencycurrently rendersModulePageonly./app/{organizationSlug}/emergencydelegates to the unscoped emergency page.systemIncidentsalready exists in the Drizzle schema and supports severity, status, title, description, source, acknowledgement, resolution, and organization scoping.app/api/system/incidents/[id]/route.tsalready supports incident status updates with audit logs.- Settings status pages already use incident status actions.
Requirements
- Replace
/app/emergencyand/app/{organizationSlug}/emergencywith a real emergency workspace. - Use existing persisted incident data as the starting model unless implementation analysis proves a separate emergency table is required.
- Show summary metrics by severity and status.
- Show an operational incident list/table with search and status/severity filters.
- Support status transitions for open, acknowledged, resolved, and closed events.
- Support creating a manual emergency/safety event if practical in the MVP.
- Link incidents to organization and optionally to elder/bed context in a future-compatible way.
- Mutations must record audit logs.
- Default workspace seed data must include representative safety/emergency events.
Permissions
- Use existing
incident:readfor viewing. - Use existing
incident:managefor create/update/status transitions. - Server-side permissions are required for all mutation APIs.
Acceptance Criteria
/app/emergencyno longer renders the generic placeholder./app/{organizationSlug}/emergencyrenders the same real emergency workspace.- Emergency events are loaded from Drizzle and scoped to the active organization.
- The workspace shows severity/status metrics and a searchable event list.
- Authorized users can transition event status from the UI.
- Event status updates persist and survive reload.
- Authorized users can create a manual safety/emergency event if included in MVP implementation.
- Unauthorized mutation attempts return structured failures.
- Emergency mutations write audit log entries.
- Default seeded workspace includes safety/emergency events.
pnpm lintpasses.pnpm type-checkpasses.pnpm buildpasses.
Dependencies
- Can start independently because
systemIncidentsalready exists. - Elder/bed context optimization may later add richer links from incidents to elders or beds.
- Dashboard integration should wait until this task is complete.
Out Of Scope
- Device telemetry ingestion.
- Real-time alarm channels.
- SMS, phone, or push notification delivery.
- Dispatch routing engine.
- Post-incident regulatory reporting.
Open Questions
- None currently blocking planning.