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:
@@ -1,18 +1,18 @@
|
||||
model PurchaseReceipt {
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique @db.VarChar(100)
|
||||
totalAmount Decimal @db.Decimal(10, 2)
|
||||
paidAmount Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
isSettled Boolean @default(false)
|
||||
description String? @db.Text
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
supplierId Int
|
||||
inventoryId Int
|
||||
items PurchaseReceiptItem[] @relation("PurchaseReceipt_Items")
|
||||
inventory Inventory @relation(fields: [inventoryId], references: [id])
|
||||
supplier Supplier @relation(fields: [supplierId], references: [id])
|
||||
purchaseReceiptPayments PurchaseReceiptPayments[]
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique @db.VarChar(100)
|
||||
totalAmount Decimal @db.Decimal(15, 2)
|
||||
paidAmount Decimal @default(0.00) @db.Decimal(15, 2)
|
||||
description String? @db.Text
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
status PurchaseReceiptStatus @default(UNPAID)
|
||||
supplierId Int
|
||||
inventoryId Int
|
||||
items PurchaseReceiptItem[] @relation("PurchaseReceipt_Items")
|
||||
inventory Inventory @relation(fields: [inventoryId], references: [id])
|
||||
supplier Supplier @relation(fields: [supplierId], references: [id])
|
||||
payments PurchaseReceiptPayments[]
|
||||
|
||||
@@index([inventoryId], map: "Purchase_Receipts_inventoryId_fkey")
|
||||
@@index([supplierId], map: "Purchase_Receipts_supplierId_fkey")
|
||||
@@ -21,9 +21,9 @@ model PurchaseReceipt {
|
||||
|
||||
model PurchaseReceiptItem {
|
||||
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)
|
||||
description String? @db.Text
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
receiptId Int
|
||||
@@ -37,19 +37,20 @@ model PurchaseReceiptItem {
|
||||
}
|
||||
|
||||
model PurchaseReceiptPayments {
|
||||
id Int @id @default(autoincrement())
|
||||
amount Decimal @db.Decimal(10, 2)
|
||||
paymentMethod payment_method_type
|
||||
bankAccountId Int?
|
||||
description String? @db.Text
|
||||
payedAt DateTime @db.Timestamp(0)
|
||||
id Int @id @default(autoincrement())
|
||||
amount Decimal @db.Decimal(15, 2)
|
||||
paymentMethod PaymentMethodType
|
||||
type PaymentType
|
||||
bankAccountId Int
|
||||
inventoryId Int
|
||||
description String? @db.Text
|
||||
payedAt DateTime @db.Timestamp(0)
|
||||
receiptId Int
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
|
||||
purchaseReceipt PurchaseReceipt @relation(fields: [receiptId], references: [id])
|
||||
bankAccount BankAccount? @relation(fields: [bankAccountId], references: [id])
|
||||
purchaseReceipt PurchaseReceipt @relation(fields: [receiptId], references: [id])
|
||||
inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])
|
||||
|
||||
@@index([receiptId], map: "Purchase_Receipt_Payments_receiptId_fkey")
|
||||
@@index([bankAccountId], map: "Purchase_Receipt_Payments_bankAccountId_fkey")
|
||||
@@map("Purchase_Receipt_Payments")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user