Incidents Domain
Technical lifecycle and audit trail of operational incidents
Overview
The incidents domain provides a robust system for tracking safety and operational issues. It includes multi-level severity, automated Slack/Matrix notifications, and a collaborative commenting system with a full audit trail.
Database Schema
Incidents (incidents)
The primary record for an operational issue.
| Column | Type | Description |
|---|---|---|
userId | text | The staff member who reported the incident. |
locationId | text | References locations.id. |
type | text | Injury, Near Miss, Spill / Slip Hazard, Complaint, Maintenance, Stockout. |
severity | text | low, medium, high, critical. |
status | text | reported, investigating, deferred, resolved. |
visibility | text | manager_only or employee_visible. |
isInventoryAlert | boolean | Set to true automatically for Stockout type; triggers DM notifications to Kitchen Manager. |
Incident Comments (incident_comments)
Allows collaborative investigation and updates.
| Column | Type | Description |
|---|---|---|
incidentId | text | References incidents.id. |
userId | text | The commenter's Clerk ID. |
content | text | The text of the comment. |
Notification & Escalation
When an incident is created or escalated, notifications are dispatched via @repo/slack and @repo/matrix.
- On Creation: A Slack message is sent to the configured channel for the location.