cbe51b9343
- Added BankAccountsController, BankAccountsService, and related DTOs for managing bank accounts. - Implemented BankBranchesController, BankBranchesService, and related DTOs for managing bank branches. - Created BanksController and BanksService for retrieving bank information. - Integrated Prisma for database operations across all modules. - Added response mapping for consistent API responses.
119 lines
4.8 KiB
Plaintext
119 lines
4.8 KiB
Plaintext
model Supplier {
|
|
id Int @id @default(autoincrement())
|
|
firstName String @db.VarChar(255)
|
|
lastName String @db.VarChar(255)
|
|
email String? @db.VarChar(255)
|
|
mobileNumber String @unique @db.Char(11)
|
|
address String? @db.Text
|
|
city String? @db.VarChar(100)
|
|
state String? @db.VarChar(100)
|
|
country String? @db.VarChar(100)
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
deletedAt DateTime? @db.Timestamp(0)
|
|
purchaseReceipts PurchaseReceipt[]
|
|
stockMovements StockMovement[] @relation("StockMovement_Supplier")
|
|
supplierLedgers SupplierLedger[]
|
|
|
|
@@map("Suppliers")
|
|
}
|
|
|
|
model SupplierLedger {
|
|
id Int @id @default(autoincrement())
|
|
description String? @db.Text
|
|
debit Decimal @db.Decimal(10, 2)
|
|
credit Decimal @db.Decimal(10, 2)
|
|
balance Decimal @db.Decimal(10, 2)
|
|
sourceType ledgerSourceType
|
|
sourceId Int
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
supplierId Int
|
|
supplier Supplier @relation(fields: [supplierId], references: [id])
|
|
|
|
@@index([supplierId], map: "Supplier_Ledger_supplierId_fkey")
|
|
@@map("Supplier_Ledger")
|
|
}
|
|
|
|
model Customer {
|
|
id Int @id @default(autoincrement())
|
|
firstName String @db.VarChar(255)
|
|
lastName String @db.VarChar(255)
|
|
email String? @db.VarChar(255)
|
|
mobileNumber String @unique @db.Char(11)
|
|
address String? @db.Text
|
|
city String? @db.VarChar(100)
|
|
state String? @db.VarChar(100)
|
|
country String? @db.VarChar(100)
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
deletedAt DateTime? @db.Timestamp(0)
|
|
orders Order[] @relation("Customer_Orders")
|
|
salesInvoices SalesInvoice[] @relation("Customer_Sales_Invoices")
|
|
stockMovements StockMovement[] @relation("StockMovement_Customer")
|
|
|
|
@@map("Customers")
|
|
}
|
|
|
|
model Order {
|
|
id Int @id @default(autoincrement())
|
|
orderNumber String @unique @db.VarChar(100)
|
|
status OrderStatus @default(PENDING)
|
|
paymentMethod payment_method_type @default(CARD)
|
|
totalAmount Decimal @db.Decimal(10, 2)
|
|
description String? @db.Text
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
deletedAt DateTime? @db.Timestamp(0)
|
|
customerId Int
|
|
customer Customer @relation("Customer_Orders", fields: [customerId], references: [id], onUpdate: NoAction)
|
|
|
|
@@index([customerId], map: "Orders_customerId_fkey")
|
|
@@map("Orders")
|
|
}
|
|
|
|
model SalesInvoice {
|
|
id Int @id @default(autoincrement())
|
|
code String @unique @db.VarChar(100)
|
|
totalAmount Decimal @db.Decimal(10, 2)
|
|
description String? @db.Text
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
customerId Int?
|
|
inventoryId Int
|
|
items SalesInvoiceItem[] @relation("SalesInvoice_Items")
|
|
customer Customer? @relation("Customer_Sales_Invoices", fields: [customerId], references: [id])
|
|
inventory Inventory @relation("Inventory_SalesInvoices", fields: [inventoryId], references: [id])
|
|
|
|
@@index([inventoryId], map: "Sales_Invoices_inventoryId_fkey")
|
|
@@index([customerId], map: "Sales_Invoices_customerId_fkey")
|
|
@@map("Sales_Invoices")
|
|
}
|
|
|
|
model SalesInvoiceItem {
|
|
id Int @id @default(autoincrement())
|
|
count Decimal @db.Decimal(10, 2)
|
|
fee Decimal @db.Decimal(10, 2)
|
|
total Decimal @db.Decimal(10, 2)
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
invoiceId Int
|
|
productId Int
|
|
invoice SalesInvoice @relation("SalesInvoice_Items", fields: [invoiceId], references: [id])
|
|
product Product @relation("Product_SalesInvoiceItems", fields: [productId], references: [id])
|
|
|
|
@@index([invoiceId], map: "Sales_Invoice_Items_invoiceId_fkey")
|
|
@@index([productId], map: "Sales_Invoice_Items_productId_fkey")
|
|
@@map("Sales_Invoice_Items")
|
|
}
|
|
|
|
model TriggerLog {
|
|
id Int @id @default(autoincrement())
|
|
message String @db.Text
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
name String @db.Text
|
|
|
|
@@map("Trigger_Logs")
|
|
}
|