feat(statistics): implement top alert stocks, top last sales, top supplier debts, and top selling products endpoints with SQL queries
This commit is contained in:
@@ -2,7 +2,7 @@ model StockMovement {
|
||||
id Int @id @default(autoincrement())
|
||||
type MovementType
|
||||
quantity Decimal @db.Decimal(10, 0)
|
||||
fee Decimal @db.Decimal(15, 2)
|
||||
unitPrice Decimal @db.Decimal(15, 2)
|
||||
totalCost Decimal @db.Decimal(15, 2)
|
||||
referenceType MovementReferenceType
|
||||
referenceId String
|
||||
@@ -59,3 +59,19 @@ model StockAdjustment {
|
||||
@@index([productId], map: "Stock_Adjustments_productId_fkey")
|
||||
@@map("Stock_Adjustments")
|
||||
}
|
||||
|
||||
model StockReservation {
|
||||
id Int @id @default(autoincrement())
|
||||
quantity Decimal @db.Decimal(10, 0)
|
||||
expiresAt DateTime @db.Timestamp(0)
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
productId Int
|
||||
inventoryId Int
|
||||
orderId Int
|
||||
inventory Inventory @relation(fields: [inventoryId], references: [id])
|
||||
product Product @relation(fields: [productId], references: [id])
|
||||
|
||||
@@index([inventoryId])
|
||||
@@index([productId])
|
||||
@@map("Stock_Reservations")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user