apps/api/prisma/schema.prisma and contains over 60 models representing the entire CAD system.
Database Overview
The database is designed to support:- Multi-user CAD system with role-based permissions
- Complex relationships between citizens, officers, deputies, and records
- Real-time dispatch operations
- Comprehensive audit logging
- Discord and FiveM integrations
- Customizable values and settings
Core Models
CAD & Settings
cad
The main CAD instance configuration.
name- CAD instance nameownerId- Reference to the CAD owner (User)whitelisted- Whether registration requires approvalfeatures- Enabled/disabled feature flagsmiscCadSettings- General CAD configurationapiToken- Public API access token
MiscCadSettings
Comprehensive CAD configuration options.
- User limits (max citizens, officers per user)
- Callsign and case number templates
- License templates and number lengths
- Timeout settings for calls, incidents, BOLOs
- Signal 100 configuration
- Live map integration URLs
User Management
User
Represents a user account with authentication and permissions.
- Username/password authentication
- Role-based permissions (rank: USER, ADMIN, OWNER)
- Department permissions (LEO, Dispatch, EMS/FD, Tow, Taxi)
- Discord and Steam ID linking
- Whitelist status management
- Two-factor authentication support
- API token access
Citizens & Characters
Citizen
Citizen characters created by users.
- Personal information (name, DOB, physical characteristics)
- Unique social security number
- Relationships to vehicles, weapons, medical records
- License management with points system
- Business ownership
- Flag associations (gang affiliations, etc.)
Law Enforcement
Officer
Law enforcement officer units.
- Callsign system (callsign + callsign2)
- Department and division assignments
- Rank and position
- Status tracking (on-duty, off-duty, busy, etc.)
- Qualifications
- Links to citizen and user
- Record creation and call assignments
EmsFdDeputy
EMS/Fire department deputy units (similar structure to Officer).
Dispatch Operations
Call911
911 emergency calls.
- Caller information
- Location and postal code
- Call type/nature
- Unit assignments (officers, deputies)
- Call events timeline
- End status tracking
Bolo
Be On the Lookout alerts.
Records Management
Record
Criminal records (tickets, arrests, warnings).
WRITTEN_WARNING- Written warningsTICKET- Traffic ticketsARREST_REPORT- Arrest reportsWARRANT- Active warrants
Violation
Individual violations within a record.
Values System
Value
Customizable value types (departments, vehicles, weapons, etc.).
DEPARTMENT- Police/Fire departmentsDIVISION- Department divisionsOFFICER_RANK- Officer ranksVEHICLE- Vehicle typesWEAPON- Weapon typesLICENSE- License typesGENDER- Gender optionsETHNICITY- Ethnicity options- And many more…
Audit Logging
AuditLog
Tracks all administrative actions.
- User management (create, update, delete, ban)
- CAD settings changes
- Value modifications
- Record expungements
- Permission changes
- And more (75+ action types)
Relationships
User → Citizen → Officer/Deputy
Citizen → Assets
Records & Violations
Dispatch Operations
Indexes & Performance
Key indexes for performance:@uniqueon usernames, SSNs, license plates, Discord IDs- Foreign key indexes on all relations
- Composite indexes on frequently queried fields
Migrations
Database migrations are managed by Prisma Migrate:apps/api/prisma/migrations/.
Related Documentation
Migrations
Learn about database migrations
Architecture
System architecture overview