fix: update SupplierLedger model to use correct enum casing and adjust types
feat: enhance PosAccountsService to include inventoryBankAccount details in responses refactor: modify PosService to return structured inventory and bank account data chore: remove isSettled field from CreatePurchaseReceiptDto and adjust related logic feat: add payments selection in SuppliersService for better payment tracking chore: apply database migrations to adjust decimal types and enforce constraints chore: create index on Pos_Accounts for improved query performance feat: define Supplier and SupplierLedger models in Prisma schema for better data management
This commit is contained in:
+14
-52
@@ -1,41 +1,3 @@
|
||||
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)
|
||||
@@ -58,17 +20,17 @@ model Customer {
|
||||
}
|
||||
|
||||
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)
|
||||
id Int @id @default(autoincrement())
|
||||
orderNumber String @unique @db.VarChar(100)
|
||||
status OrderStatus @default(PENDING)
|
||||
paymentMethod PaymentMethodType @default(CARD)
|
||||
totalAmount Decimal @db.Decimal(15, 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)
|
||||
customer Customer @relation("Customer_Orders", fields: [customerId], references: [id], onUpdate: NoAction)
|
||||
|
||||
@@index([customerId], map: "Orders_customerId_fkey")
|
||||
@@map("Orders")
|
||||
@@ -77,7 +39,7 @@ model Order {
|
||||
model SalesInvoice {
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique @db.VarChar(100)
|
||||
totalAmount Decimal @db.Decimal(10, 2)
|
||||
totalAmount Decimal @db.Decimal(15, 2)
|
||||
description String? @db.Text
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
@@ -94,9 +56,9 @@ model SalesInvoice {
|
||||
|
||||
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)
|
||||
count Decimal @db.Decimal(10, 0)
|
||||
fee Decimal @db.Decimal(15, 2)
|
||||
total Decimal @db.Decimal(15, 2)
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
invoiceId Int
|
||||
productId Int
|
||||
|
||||
Reference in New Issue
Block a user