Enhance payment processing and device management features

- Updated `package.json` to add a new script for pushing Prisma database changes.
- Refactored payment processing functions to include payment method handling for both wallet and transfer options.
- Improved `DevicesTable` and `AdminDevicesTable` components to support new payment method display and user association.
- Updated Prisma schema to introduce a new `PaymentType` enum and modified the `Payment` model to include a `method` field.
- Enhanced UI components to improve user experience in displaying payment and device information.

These changes improve the overall functionality and maintainability of the application, particularly in payment processing and device management.
This commit is contained in:
2025-01-08 23:04:30 +05:00
parent 0a63e4337e
commit 1a195d2307
9 changed files with 118 additions and 47 deletions

View File

@ -115,6 +115,11 @@ enum Blocker {
PARENT
}
enum PaymentType {
WALLET
TRANSFER
}
model Device {
id String @id @default(cuid())
name String
@ -129,20 +134,20 @@ model Device {
updatedAt DateTime @updatedAt
User User? @relation(fields: [userId], references: [id])
userId String?
payment Payment? @relation(fields: [paymentId], references: [id])
paymentId String?
payments Payment[]
}
model Payment {
id String @id @default(cuid())
id String @id @default(cuid())
numberOfMonths Int
amount Float
paid Boolean @default(false)
user User @relation(fields: [userId], references: [id])
paid Boolean @default(false)
user User @relation(fields: [userId], references: [id])
paidAt DateTime?
method PaymentType @default(TRANSFER)
expiresAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
devices Device[]
userId String
}