mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 16:42:00 +00:00
- Updated `package.json` to include a new script for launching Prisma Studio. - Modified `signup` function in `auth-actions.ts` to include account number in user data. - Refactored `createPayment` function in `payment.ts` to improve error handling and return structured responses. - Updated UI components in the dashboard to improve layout and responsiveness, including changes to `UserDevices` and `UserPayments` pages. - Introduced new `AdminDevicesTable` and `UsersPaymentsTable` components for better admin functionalities. - Enhanced `DeviceCartDrawer` to provide user feedback during payment processing. - Added account number input to the signup form and updated validation schema accordingly. - Updated Prisma schema to include a new `ninja_user_id` field for user management. These changes improve the overall functionality, maintainability, and user experience of the application, particularly in user management and payment processing.
167 lines
4.2 KiB
Plaintext
167 lines
4.2 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified Boolean @default(false)
|
|
|
|
verified Boolean @default(false)
|
|
accNo String?
|
|
// island String?
|
|
address String?
|
|
id_card String? @unique
|
|
dob DateTime?
|
|
atoll Atoll? @relation(fields: [atollId], references: [id])
|
|
island Island? @relation(fields: [islandId], references: [id])
|
|
|
|
image String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
phoneNumber String @unique
|
|
phoneNumberVerified Boolean @default(false)
|
|
termsAccepted Boolean @default(false)
|
|
policyAccepted Boolean @default(false)
|
|
walletBalance Float @default(0)
|
|
ninja_user_id String?
|
|
devices Device[]
|
|
|
|
role String?
|
|
lang String?
|
|
atollId String?
|
|
islandId String?
|
|
Bill Payment[]
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
token String @unique
|
|
expiresAt DateTime
|
|
ipAddress String?
|
|
userAgent String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("session")
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
accountId String
|
|
providerId String
|
|
accessToken String?
|
|
refreshToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
password String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
idToken String?
|
|
|
|
@@map("account")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id @default(cuid())
|
|
identifier String
|
|
value String
|
|
expiresAt DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("verification")
|
|
}
|
|
|
|
model Atoll {
|
|
id String @id @default(cuid())
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
islands Island[]
|
|
User User[]
|
|
}
|
|
|
|
model Island {
|
|
id String @id @default(cuid())
|
|
atollId String
|
|
atoll Atoll @relation(fields: [atollId], references: [id])
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
User User[]
|
|
}
|
|
|
|
enum Blocker {
|
|
ADMIN
|
|
PARENT
|
|
}
|
|
|
|
model Device {
|
|
id String @id @default(cuid())
|
|
name String
|
|
mac String
|
|
reasonForBlocking String?
|
|
isActive Boolean @default(false)
|
|
registered Boolean @default(false)
|
|
blocked Boolean @default(false)
|
|
blockedBy Blocker @default(PARENT)
|
|
expiryDate DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
User User? @relation(fields: [userId], references: [id])
|
|
userId String?
|
|
payment Payment? @relation(fields: [paymentId], references: [id])
|
|
paymentId String?
|
|
}
|
|
|
|
model Payment {
|
|
id String @id @default(cuid())
|
|
numberOfMonths Int
|
|
amount Float
|
|
paid Boolean @default(false)
|
|
user User @relation(fields: [userId], references: [id])
|
|
paidAt DateTime?
|
|
expiresAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
devices Device[]
|
|
userId String
|
|
}
|
|
|
|
model BillFormula {
|
|
id String @id @default(cuid())
|
|
formula String
|
|
baseAmount Float
|
|
discountPercentage Float
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Topup {
|
|
id String @id @default(cuid())
|
|
amount Float
|
|
userId String
|
|
paid Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|