feat: add file storage service and update configurations
refactor: migrate to tsup for builds and update tsconfigs fix: update error handling and validation in payment service chore: update package scripts and dependencies docs: update README and env examples
This commit is contained in:
@@ -48,7 +48,7 @@ model TelegramUser {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
payments Payment[]
|
||||
payments Payment[]
|
||||
subscription Subscription?
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ model Payment {
|
||||
id String @id @default(cuid())
|
||||
telegramUserId String
|
||||
amount Decimal @db.Decimal(10, 2)
|
||||
currency String
|
||||
currency String
|
||||
status PaymentStatus @default(PENDING)
|
||||
provider String
|
||||
providerId String?
|
||||
@@ -78,10 +78,10 @@ model Plan {
|
||||
code String @unique()
|
||||
name String
|
||||
description String?
|
||||
durationDays Int
|
||||
durationDays Int
|
||||
dailyGenerations Int
|
||||
price Int
|
||||
currency String
|
||||
currency String
|
||||
|
||||
subscriptions Subscription[]
|
||||
|
||||
@@ -89,20 +89,44 @@ model Plan {
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id String @id @default(uuid())
|
||||
telegramUserId String @unique
|
||||
planId String
|
||||
id String @id @default(uuid())
|
||||
telegramUserId String @unique
|
||||
planId String
|
||||
|
||||
startedAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
canceledAt DateTime?
|
||||
startedAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
canceledAt DateTime?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
plan Plan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
plan Plan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
telegramUser TelegramUser @relation(fields: [telegramUserId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([telegramUserId])
|
||||
@@index([planId])
|
||||
}
|
||||
|
||||
model File {
|
||||
id String @id @default(uuid())
|
||||
filename String
|
||||
originalName String
|
||||
mimeType String
|
||||
size Int
|
||||
path String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
links FileLink[]
|
||||
}
|
||||
|
||||
model FileLink {
|
||||
id String @id @default(uuid())
|
||||
fileId String
|
||||
relationId String
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
file File @relation(fields: [fileId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user