af9695e23c
- Removed old supplier DTOs and controller, replacing them with new implementations. - Introduced new CreateSupplierDto and UpdateSupplierDto in the index directory. - Updated SuppliersController to handle new routes and methods. - Implemented SuppliersService with updated logic for creating, finding, updating, and removing suppliers. - Added new invoices module with corresponding controller and service for handling invoice-related operations. - Created new DTOs for handling receipt payments and updated the service to manage payment creation and retrieval. - Updated Prisma migrations to reflect changes in the database schema, including dropping unnecessary columns.
81 lines
3.6 KiB
Plaintext
81 lines
3.6 KiB
Plaintext
model Inventory {
|
|
id Int @id @default(autoincrement())
|
|
name String @db.VarChar(255)
|
|
location String? @db.VarChar(255)
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
deletedAt DateTime? @db.Timestamp(0)
|
|
isPointOfSale Boolean @default(false)
|
|
inventoryTransfersFrom InventoryTransfer[] @relation("Inventory_From")
|
|
inventoryTransfersTo InventoryTransfer[] @relation("Inventory_To")
|
|
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")
|
|
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[]
|
|
|
|
@@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)
|
|
description String? @db.Text
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
fromInventoryId Int
|
|
toInventoryId Int
|
|
items InventoryTransferItem[] @relation("InventoryTransfer_Items")
|
|
fromInventory Inventory @relation("Inventory_From", fields: [fromInventoryId], references: [id])
|
|
toInventory Inventory @relation("Inventory_To", fields: [toInventoryId], references: [id])
|
|
|
|
@@index([fromInventoryId], map: "Inventory_Transfers_fromInventoryId_fkey")
|
|
@@index([toInventoryId], map: "Inventory_Transfers_toInventoryId_fkey")
|
|
@@map("Inventory_Transfers")
|
|
}
|
|
|
|
model InventoryTransferItem {
|
|
id Int @id @default(autoincrement())
|
|
count Decimal @db.Decimal(10, 0)
|
|
productId Int
|
|
transferId Int
|
|
product Product @relation("InventoryTransferItem_Product", fields: [productId], references: [id])
|
|
transfer InventoryTransfer @relation("InventoryTransfer_Items", fields: [transferId], references: [id])
|
|
|
|
@@index([productId], map: "Inventory_Transfer_Items_productId_fkey")
|
|
@@index([transferId], map: "Inventory_Transfer_Items_transferId_fkey")
|
|
@@map("Inventory_Transfer_Items")
|
|
}
|