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:
2025-12-26 22:09:46 +03:30
parent d59be5995d
commit d98507fc1f
35 changed files with 2670 additions and 2802 deletions
+37
View File
@@ -0,0 +1,37 @@
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)
stockMovements StockMovement[] @relation("StockMovement_Supplier")
receipts PurchaseReceipt[]
ledger SupplierLedger[]
@@map("Suppliers")
}
model SupplierLedger {
id Int @id @default(autoincrement())
description String? @db.Text
debit Decimal @default(0) @db.Decimal(15, 2)
credit Decimal @default(0) @db.Decimal(15, 2)
balance Decimal @db.Decimal(15, 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")
}