first commit

This commit is contained in:
Mamadou Khoussa [028918 DSI/DAC/DIF/DS] 2025-10-21 23:48:16 +00:00
parent c479637d04
commit ad91d5c150

View File

@ -50,22 +50,23 @@ model Operator {
} }
model User { model User {
id String @id @default(cuid()) id String @id @default(cuid())
msisdn String @unique msisdn String @unique
userToken String @unique userToken String @unique
userAlias String userAlias String
operatorId String operatorId String
partnerId String partnerId String
country String country String
metadata Json? metadata Json?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
operator Operator @relation(fields: [operatorId], references: [id]) operator Operator @relation(fields: [operatorId], references: [id])
partner Partner @relation(fields: [partnerId], references: [id]) partner Partner @relation(fields: [partnerId], references: [id])
subscriptions Subscription[] subscriptions Subscription[]
payments Payment[] payments Payment[]
invoices Invoice[] // Added relation invoices Invoice[]
notifications Notification[] // Added relation
} }
model Plan { model Plan {
@ -146,7 +147,7 @@ model Subscription {
plan Plan @relation(fields: [planId], references: [id]) plan Plan @relation(fields: [planId], references: [id])
partner Partner @relation(fields: [partnerId], references: [id]) partner Partner @relation(fields: [partnerId], references: [id])
payments Payment[] payments Payment[]
invoices Invoice[] // Added relation invoices Invoice[]
} }
model Payment { model Payment {
@ -170,7 +171,7 @@ model Payment {
partner Partner @relation(fields: [partnerId], references: [id]) partner Partner @relation(fields: [partnerId], references: [id])
subscription Subscription? @relation(fields: [subscriptionId], references: [id]) subscription Subscription? @relation(fields: [subscriptionId], references: [id])
refunds Refund[] refunds Refund[]
invoice Invoice? // Added relation invoice Invoice?
} }
model Refund { model Refund {
@ -187,6 +188,7 @@ model Refund {
model Webhook { model Webhook {
id String @id @default(cuid()) id String @id @default(cuid())
partnerId String? // Made optional for system webhooks
url String url String
event String event String
payload Json payload Json
@ -196,6 +198,8 @@ model Webhook {
lastAttempt DateTime? lastAttempt DateTime?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
partner Partner? @relation(fields: [partnerId], references: [id])
} }
model Partner { model Partner {
@ -218,8 +222,10 @@ model Partner {
subscriptions Subscription[] subscriptions Subscription[]
payments Payment[] payments Payment[]
authSessions AuthSession[] authSessions AuthSession[]
plans Plan[] // Added relation plans Plan[]
invoices Invoice[] // Added relation invoices Invoice[]
notifications Notification[] // Added relation
webhooks Webhook[] // Added relation
} }
model AuthSession { model AuthSession {