Data model
Core Prisma entities and critical field names for Intry.
Overview
The canonical schema lives in prisma/schema.prisma. IDs are UUIDs created by the database.
Hierarchy
Tenant (property management org)
├── Property (site / building)
│ └── Unit (apartment or suite)
│ ├── VirtualNumber (Twilio e164)
│ ├── Call → Approval(s)
│ └── Residents (User, many-to-many)
├── User (admins, PMs, staff, residents)
│ └── Device (push tokens, platform)
└── Subscription / billing (Stripe)In product language, a Tenant is often called an organization or management company.
Entities (selected)
| Model | Purpose |
|---|---|
| Tenant | Top-level B2B customer; owns properties, users, entitlements JSON, optional Stripe customer. |
| Property | Physical site; timezone default America/New_York. |
| Unit | Leasable unit; unitLabel is the human-visible identifier (not number / name). |
| VirtualNumber | Twilio number in E.164 (e164); optional quarantineUntil for pool hygiene. |
| User | Single name field; roles include admin, property_manager, staff, resident. Links to Clerk / WorkOS where applicable. |
| Device | Mobile installation; use isEnabled (not enabled). |
| Call | Voice session; startedAt, durationSec, finalState (completed, no-answer, busy, failed, timeout). |
| Approval | Resident decision; action is approve or deny (not past-tense enums). |
Naming pitfalls
Unit
Always `unitLabel` in APIs and Prisma — never `number` or `name`.
Phone fields
Virtual numbers use `e164`; user SMS fallback uses `phoneNumber` (E.164).
JSON entitlements (Tenant)
Tenant.entitlements can gate modules (e.g. documents, maintenance). null means all modules enabled for backward compatibility. See schema comments in Prisma for the current key set.