feat: add inventoryId to SalesInvoice and related models; implement createOrder functionality in POS service
This commit is contained in:
@@ -173,6 +173,7 @@ model Inventory {
|
||||
stockAdjustments StockAdjustment[] @relation("Inventory_Stock_Adjustments")
|
||||
stockMovements StockMovement[] @relation("StockMovement_Inventory")
|
||||
stockBalances StockBalance[] @relation("StockBalance_inventory")
|
||||
salesInvoices SalesInvoice[] @relation("Inventory_SalesInvoices")
|
||||
|
||||
@@map("Inventories")
|
||||
}
|
||||
@@ -256,8 +257,8 @@ model PurchaseReceiptItem {
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
receiptId Int
|
||||
productId Int
|
||||
product Product @relation("Product_PurchaseReceiptItems", fields: [productId], references: [id])
|
||||
receipt PurchaseReceipt @relation("PurchaseReceipt_Items", fields: [receiptId], references: [id])
|
||||
product Product @relation("Product_PurchaseReceiptItems", fields: [productId], references: [id])
|
||||
|
||||
@@index([productId], map: "Purchase_Receipt_Items_productId_fkey")
|
||||
@@index([receiptId], map: "Purchase_Receipt_Items_receiptId_fkey")
|
||||
@@ -272,9 +273,12 @@ model SalesInvoice {
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
customerId Int?
|
||||
inventoryId Int
|
||||
items SalesInvoiceItem[] @relation("SalesInvoice_Items")
|
||||
customer Customer? @relation("Customer_Sales_Invoices", fields: [customerId], references: [id])
|
||||
inventory Inventory @relation("Inventory_SalesInvoices", fields: [inventoryId], references: [id])
|
||||
|
||||
@@index([inventoryId], map: "Sales_Invoices_inventoryId_fkey")
|
||||
@@index([customerId], map: "Sales_Invoices_customerId_fkey")
|
||||
@@map("Sales_Invoices")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user