gg
This commit is contained in:
+33
-2
@@ -543,6 +543,7 @@ model User {
|
||||
analyses Analysis[]
|
||||
refreshTokens RefreshToken[]
|
||||
usageLimit UsageLimit?
|
||||
subscription Subscription?
|
||||
coupons UserCoupon[]
|
||||
totoCoupons TotoCoupon[]
|
||||
|
||||
@@ -551,6 +552,27 @@ model User {
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id String @id @default(uuid())
|
||||
userId String @unique @map("user_id")
|
||||
paddleSubscriptionId String? @unique @map("paddle_subscription_id")
|
||||
paddleCustomerId String? @map("paddle_customer_id")
|
||||
plan SubscriptionStatus @default(free)
|
||||
billingInterval BillingInterval? @map("billing_interval")
|
||||
currentPeriodStart DateTime? @map("current_period_start")
|
||||
currentPeriodEnd DateTime? @map("current_period_end")
|
||||
cancelledAt DateTime? @map("cancelled_at")
|
||||
cancelEffectiveDate DateTime? @map("cancel_effective_date")
|
||||
paddlePriceId String? @map("paddle_price_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([paddleSubscriptionId])
|
||||
@@index([paddleCustomerId])
|
||||
@@map("subscriptions")
|
||||
}
|
||||
|
||||
model RefreshToken {
|
||||
id String @id @default(uuid())
|
||||
token String @unique
|
||||
@@ -569,6 +591,8 @@ model UsageLimit {
|
||||
userId String @unique @map("user_id")
|
||||
analysisCount Int @default(0) @map("analysis_count")
|
||||
couponCount Int @default(0) @map("coupon_count")
|
||||
maxAnalyses Int @default(3) @map("max_analyses")
|
||||
maxCoupons Int @default(1) @map("max_coupons")
|
||||
lastResetDate DateTime @map("last_reset_date") @db.Date
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
@@ -765,8 +789,15 @@ enum UserRole {
|
||||
|
||||
enum SubscriptionStatus {
|
||||
free
|
||||
active
|
||||
expired
|
||||
plus
|
||||
premium
|
||||
past_due
|
||||
cancelled
|
||||
}
|
||||
|
||||
enum BillingInterval {
|
||||
monthly
|
||||
yearly
|
||||
}
|
||||
|
||||
enum PlayerPosition {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ async function main() {
|
||||
firstName: 'Super',
|
||||
lastName: 'Admin',
|
||||
role: UserRole.superadmin,
|
||||
subscriptionStatus: SubscriptionStatus.active,
|
||||
subscriptionStatus: SubscriptionStatus.free,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user