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:
@@ -9,19 +9,48 @@ model Inventory {
|
||||
isPointOfSale Boolean @default(false)
|
||||
inventoryTransfersFrom InventoryTransfer[] @relation("Inventory_From")
|
||||
inventoryTransfersTo InventoryTransfer[] @relation("Inventory_To")
|
||||
// productCharges ProductCharge[] @relation("Inventory_Product_Charges")
|
||||
purchaseReceipts PurchaseReceipt[]
|
||||
salesInvoices SalesInvoice[] @relation("Inventory_SalesInvoices")
|
||||
stockAdjustments StockAdjustment[] @relation("Inventory_Stock_Adjustments")
|
||||
stockBalances StockBalance[] @relation("StockBalance_inventory")
|
||||
counterStockMovements StockMovement[] @relation("StockMovement_CounterInventory")
|
||||
stockMovements StockMovement[] @relation("StockMovement_Inventory")
|
||||
posAccounts PosAccount[] @relation("Inventory_PosAccounts")
|
||||
inventoryBankAccounts InventoryBankAccount[] @relation("Inventory_Bank_Accounts_inventoryId_fkey")
|
||||
inventoryBankAccounts InventoryBankAccount[]
|
||||
|
||||
@@map("Inventories")
|
||||
}
|
||||
|
||||
model InventoryBankAccount {
|
||||
inventoryId Int
|
||||
bankAccountId Int
|
||||
|
||||
inventory Inventory @relation(fields: [inventoryId], references: [id])
|
||||
bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])
|
||||
posAccounts PosAccount[]
|
||||
purchaseReceiptPayments PurchaseReceiptPayments[]
|
||||
|
||||
@@id([inventoryId, bankAccountId])
|
||||
@@index([bankAccountId])
|
||||
@@map("Inventory_Bank_Accounts")
|
||||
}
|
||||
|
||||
model PosAccount {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
code String @unique() @db.VarChar(10)
|
||||
description String? @db.VarChar(500)
|
||||
bankAccountId Int
|
||||
inventoryId Int
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])
|
||||
|
||||
@@index([inventoryId])
|
||||
@@map("Pos_Accounts")
|
||||
}
|
||||
|
||||
model InventoryTransfer {
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique @db.VarChar(100)
|
||||
@@ -40,7 +69,7 @@ model InventoryTransfer {
|
||||
|
||||
model InventoryTransferItem {
|
||||
id Int @id @default(autoincrement())
|
||||
count Decimal @db.Decimal(10, 2)
|
||||
count Decimal @db.Decimal(10, 0)
|
||||
productId Int
|
||||
transferId Int
|
||||
product Product @relation("InventoryTransferItem_Product", fields: [productId], references: [id])
|
||||
@@ -50,34 +79,3 @@ model InventoryTransferItem {
|
||||
@@index([transferId], map: "Inventory_Transfer_Items_transferId_fkey")
|
||||
@@map("Inventory_Transfer_Items")
|
||||
}
|
||||
|
||||
model InventoryBankAccount {
|
||||
inventoryId Int
|
||||
bankAccountId Int
|
||||
|
||||
inventory Inventory @relation("Inventory_Bank_Accounts_inventoryId_fkey", fields: [inventoryId], references: [id])
|
||||
bankAccount BankAccount @relation("Inventory_Bank_Accounts_bankAccountId_fkey", fields: [bankAccountId], references: [id])
|
||||
posAccounts PosAccount[] @relation("Pos_Accounts_inventoryBankAccountId_fkey")
|
||||
|
||||
@@id([inventoryId, bankAccountId])
|
||||
@@index([bankAccountId])
|
||||
@@map("Inventory_Bank_Accounts")
|
||||
}
|
||||
|
||||
model PosAccount {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
code String @unique() @db.VarChar(10)
|
||||
description String? @db.VarChar(500)
|
||||
bankAccountId Int
|
||||
inventoryId Int
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
inventory Inventory @relation("Inventory_PosAccounts", fields: [inventoryId], references: [id])
|
||||
inventoryBankAccount InventoryBankAccount? @relation("Pos_Accounts_inventoryBankAccountId_fkey", fields: [bankAccountId, inventoryId], references: [bankAccountId, inventoryId])
|
||||
bankAccount BankAccount? @relation(fields: [bankAccountId], references: [id])
|
||||
|
||||
@@map("Pos_Accounts")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user