2026-01-04 13:45:26 +03:30
|
|
|
model Order {
|
2026-01-07 15:25:59 +03:30
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
orderNumber String @unique @db.VarChar(100)
|
|
|
|
|
status OrderStatus @default(PENDING)
|
|
|
|
|
totalAmount Decimal @db.Decimal(15, 2)
|
|
|
|
|
description String? @db.Text
|
|
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
|
|
|
deletedAt DateTime? @db.Timestamp(0)
|
|
|
|
|
customerId Int?
|
|
|
|
|
posAccountId Int
|
2026-01-04 13:45:26 +03:30
|
|
|
|
2026-01-07 15:25:59 +03:30
|
|
|
customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction)
|
|
|
|
|
posAccount PosAccount @relation(fields: [posAccountId], references: [id], onUpdate: NoAction)
|
|
|
|
|
|
|
|
|
|
orderItems OrderItem[]
|
|
|
|
|
stockReservations StockReservation[]
|
|
|
|
|
|
|
|
|
|
@@index([posAccountId])
|
2026-01-04 13:45:26 +03:30
|
|
|
@@index([customerId])
|
|
|
|
|
@@map("Orders")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model OrderItem {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
quantity Decimal @db.Decimal(10, 0)
|
|
|
|
|
unitPrice Decimal @db.Decimal(15, 2)
|
|
|
|
|
totalAmount Decimal @db.Decimal(15, 2)
|
|
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
orderId Int
|
|
|
|
|
productId Int
|
|
|
|
|
|
|
|
|
|
order Order @relation(fields: [orderId], references: [id], onUpdate: NoAction)
|
|
|
|
|
product Product @relation(fields: [productId], references: [id], onUpdate: NoAction)
|
|
|
|
|
|
|
|
|
|
@@index([orderId])
|
|
|
|
|
@@index([productId])
|
|
|
|
|
@@map("Order_Items")
|
|
|
|
|
}
|