Tenant
- Called Account at /app and Tenant at /admin.
- Can have zero or many Users, linked by the TenantUser model.
- Can have 1 Subscription Product, linked by the Tenant Subscription model.
Life Cycle
| Route | Create | Read | Update | Delete | 
|---|---|---|---|---|
| /register | ||||
| /app/new-account | ||||
| /app/:tenant/settings/account | ||||
| /admin/accounts/:id | 
Properties
| Name | Title | Type | Description | 
|---|---|---|---|
| slug * | Slug | String | URL identifier, e.g. /app/:tenant-slug/dashboard | 
| name * | Name | String | |
| icon | Icon | String | Tenant icon image | 
| subscriptionId | Subscription | TenantSubscription[] | |
| users | Users | TenantUsers[] | |
| invitations | Invitations | TenantUserInvitation[] | Tenant invitation to existing or new user | 
| rows | Rows | Row[] | Custom entity rows created by tenant | 
| logs | Logs | Log[] | Tenant audit trails/events | 
| apiKeys | API Keys | APIKey[] | 
Model
model Tenant {
  id                       String                 @id @default(cuid())
  createdAt                DateTime               @default(now())
  updatedAt                DateTime               @updatedAt
  slug                     String                 @unique
  name                     String
  icon                     String
  subscriptionId           String?
  subscription             TenantSubscription?
  users                    TenantUser[]
  invitations              TenantUserInvitation[]
  entities                 Row[]
  logs                     Log[]
  apiKeys                  ApiKey[]
  createdLinkedAccounts    LinkedAccount[]        @relation("createdByTenant")
  asProviderLinkedAccounts LinkedAccount[]        @relation("providerTenant")
  asClientLinkedAccounts   LinkedAccount[]        @relation("clientTenant")
}