App. Docs
Subscription
One subscription per company with a quantity of seats. Assign seats to users to activate them.
Activation
- Single-user companies: Active by default with full access.
- More than one user: Each user must be assigned a subscription seat to be active.
- Invites: Pending invites don’t consume a seat until accepted.
Attributes
1type Subscription = {
2 // Identity & audit
3 id: string; // uuid
4 createdAt: Date; // default now()
5 modifiedAt?: Date; // @updatedAt
6 modifiedById?: string; // uuid
7 modifiedByEmail?: string;
8 modifiedByEndpoint?: string;
9
10 // Company scoping
11 companyId: string; // uuid
12 company: Company; // @relation("assetOfCompany")
13
14 // Core
15 quantity: number; // number of seats
16 type: SubscriptionType; // default: FREE
17 duration: SubscriptionDuration; // default: MONTHLY
18 reoccurring: boolean;
19 renewalDate: Date;
20 stripeSubscriptionId: string; // unique
21 currency: string; // default: "Unknown"
22 price: number; // Decimal
23 status?: string | null;
24 nextPaymentDate?: Date | null;
25 paymentStatus?: string | null;
26
27 // Relations
28 users: User[]; // @relation("subscriptionForUser")
29 invites: UserInvite[]; // @relation("subscriptionForInvitedUser")
30
31 // Notes (DB constraints)
32 // @@unique([companyId, id])
33 // @@index([companyId])
34}