backend/prisma/schema.prisma (single source of truth, ~30 models)
Entity groups
Supporting models not drawn above:Account and Verification (better-auth), NotificationTemplate, and InventoryStockLevel.
Key relationships
The full diagram with cascade behaviour and unique constraints is in Entity relationships.
Client scoping
Most domain models include aclientId foreign key for multi-tenant isolation. Client-scoped models:
Region,Department,Store,UniformCategory,ProductEntitlementRuleSetEmployee(via store),Order(via store/employee)
User, UserRole, Session, AuditLog, ImportBatch, SystemSetting: users can hold roles across clients, and system records are org-wide by design.
Timestamps
Domain models carrycreatedAt and updatedAt managed by Prisma: