d98507fc1f
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
62 lines
3.0 KiB
Plaintext
62 lines
3.0 KiB
Plaintext
model StockMovement {
|
|
id Int @id @default(autoincrement())
|
|
type MovementType
|
|
quantity Decimal @db.Decimal(10, 0)
|
|
fee Decimal @db.Decimal(15, 2)
|
|
totalCost Decimal @db.Decimal(15, 2)
|
|
referenceType MovementReferenceType
|
|
referenceId String
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
productId Int
|
|
inventoryId Int
|
|
avgCost Decimal @db.Decimal(15, 2)
|
|
supplierId Int?
|
|
remainedInStock Decimal @default(0.00) @db.Decimal(10, 0)
|
|
counterInventoryId Int?
|
|
customerId Int?
|
|
counterInventory Inventory? @relation("StockMovement_CounterInventory", fields: [counterInventoryId], references: [id])
|
|
customer Customer? @relation("StockMovement_Customer", fields: [customerId], references: [id])
|
|
inventory Inventory @relation("StockMovement_Inventory", fields: [inventoryId], references: [id])
|
|
product Product @relation("StockMovement_Product", fields: [productId], references: [id])
|
|
supplier Supplier? @relation("StockMovement_Supplier", fields: [supplierId], references: [id])
|
|
|
|
@@index([inventoryId], map: "Stock_Movements_inventoryId_fkey")
|
|
@@index([productId], map: "Stock_Movements_productId_fkey")
|
|
@@index([counterInventoryId], map: "Stock_Movements_counterInventoryId_fkey")
|
|
@@index([customerId], map: "Stock_Movements_customerId_fkey")
|
|
@@index([supplierId], map: "Stock_Movements_supplierId_fkey")
|
|
@@map("Stock_Movements")
|
|
}
|
|
|
|
model StockBalance {
|
|
quantity Decimal @default(0.000) @db.Decimal(14, 3)
|
|
totalCost Decimal @default(0.00) @db.Decimal(14, 2)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
avgCost Decimal @default(0.00) @db.Decimal(14, 2)
|
|
inventoryId Int
|
|
productId Int
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
id Int @id @default(autoincrement())
|
|
inventory Inventory @relation("StockBalance_inventory", fields: [inventoryId], references: [id])
|
|
product Product @relation("StockBalance_Product", fields: [productId], references: [id])
|
|
|
|
@@unique([productId, inventoryId])
|
|
@@index([productId])
|
|
@@index([inventoryId])
|
|
@@map("Stock_Balance")
|
|
}
|
|
|
|
model StockAdjustment {
|
|
id Int @id @default(autoincrement())
|
|
adjustedQuantity Decimal @db.Decimal(10, 0)
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
productId Int
|
|
inventoryId Int
|
|
inventory Inventory @relation("Inventory_Stock_Adjustments", fields: [inventoryId], references: [id])
|
|
product Product @relation("Product_Stock_Adjustments", fields: [productId], references: [id])
|
|
|
|
@@index([inventoryId], map: "Stock_Adjustments_inventoryId_fkey")
|
|
@@index([productId], map: "Stock_Adjustments_productId_fkey")
|
|
@@map("Stock_Adjustments")
|
|
}
|