From ad91d5c1505c29a3b6fb2670ed8a6fb59c49b9a7 Mon Sep 17 00:00:00 2001 From: "Mamadou Khoussa [028918 DSI/DAC/DIF/DS]" Date: Tue, 21 Oct 2025 23:48:16 +0000 Subject: [PATCH] first commit --- prisma/schema.prisma | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 27bbfcc..a3744df 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -50,22 +50,23 @@ model Operator { } model User { - id String @id @default(cuid()) - msisdn String @unique - userToken String @unique - userAlias String - operatorId String - partnerId String - country String - metadata Json? - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt + id String @id @default(cuid()) + msisdn String @unique + userToken String @unique + userAlias String + operatorId String + partnerId String + country String + metadata Json? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt operator Operator @relation(fields: [operatorId], references: [id]) partner Partner @relation(fields: [partnerId], references: [id]) subscriptions Subscription[] payments Payment[] - invoices Invoice[] // Added relation + invoices Invoice[] + notifications Notification[] // Added relation } model Plan { @@ -146,7 +147,7 @@ model Subscription { plan Plan @relation(fields: [planId], references: [id]) partner Partner @relation(fields: [partnerId], references: [id]) payments Payment[] - invoices Invoice[] // Added relation + invoices Invoice[] } model Payment { @@ -170,7 +171,7 @@ model Payment { partner Partner @relation(fields: [partnerId], references: [id]) subscription Subscription? @relation(fields: [subscriptionId], references: [id]) refunds Refund[] - invoice Invoice? // Added relation + invoice Invoice? } model Refund { @@ -187,6 +188,7 @@ model Refund { model Webhook { id String @id @default(cuid()) + partnerId String? // Made optional for system webhooks url String event String payload Json @@ -196,6 +198,8 @@ model Webhook { lastAttempt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt + + partner Partner? @relation(fields: [partnerId], references: [id]) } model Partner { @@ -218,8 +222,10 @@ model Partner { subscriptions Subscription[] payments Payment[] authSessions AuthSession[] - plans Plan[] // Added relation - invoices Invoice[] // Added relation + plans Plan[] + invoices Invoice[] + notifications Notification[] // Added relation + webhooks Webhook[] // Added relation } model AuthSession {