2025-12-24 21:24:59 +03:30
|
|
|
model Customer {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
firstName String @db.VarChar(255)
|
|
|
|
|
lastName String @db.VarChar(255)
|
|
|
|
|
email String? @db.VarChar(255)
|
|
|
|
|
mobileNumber String @unique @db.Char(11)
|
|
|
|
|
address String? @db.Text
|
|
|
|
|
city String? @db.VarChar(100)
|
|
|
|
|
state String? @db.VarChar(100)
|
|
|
|
|
country String? @db.VarChar(100)
|
|
|
|
|
isActive Boolean @default(true)
|
|
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
|
|
|
deletedAt DateTime? @db.Timestamp(0)
|
2025-12-30 21:04:01 +03:30
|
|
|
orders Order[] @relation()
|
|
|
|
|
stockMovements StockMovement[] @relation()
|
|
|
|
|
salesInvoices SalesInvoice[]
|
2025-12-24 21:24:59 +03:30
|
|
|
|
|
|
|
|
@@map("Customers")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Order {
|
2025-12-26 22:09:46 +03:30
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
orderNumber String @unique @db.VarChar(100)
|
|
|
|
|
status OrderStatus @default(PENDING)
|
|
|
|
|
paymentMethod PaymentMethodType @default(CARD)
|
|
|
|
|
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)
|
2025-12-24 21:24:59 +03:30
|
|
|
customerId Int
|
2025-12-30 21:04:01 +03:30
|
|
|
customer Customer @relation(fields: [customerId], references: [id], onUpdate: NoAction)
|
2025-12-24 21:24:59 +03:30
|
|
|
|
2025-12-30 21:04:01 +03:30
|
|
|
@@index([customerId])
|
2025-12-24 21:24:59 +03:30
|
|
|
@@map("Orders")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model SalesInvoice {
|
2025-12-30 21:04:01 +03:30
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
code String @unique @db.VarChar(100)
|
|
|
|
|
totalAmount Decimal @db.Decimal(15, 2)
|
|
|
|
|
description String? @db.Text
|
|
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
|
|
|
customerId Int?
|
|
|
|
|
posAccountId Int
|
|
|
|
|
items SalesInvoiceItem[]
|
|
|
|
|
customer Customer? @relation(fields: [customerId], references: [id])
|
|
|
|
|
posAccount PosAccount @relation(fields: [posAccountId], references: [id])
|
2025-12-24 21:24:59 +03:30
|
|
|
|
2025-12-30 21:04:01 +03:30
|
|
|
@@index([customerId])
|
|
|
|
|
@@index([posAccountId])
|
2025-12-24 21:24:59 +03:30
|
|
|
@@map("Sales_Invoices")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model SalesInvoiceItem {
|
|
|
|
|
id Int @id @default(autoincrement())
|
2025-12-26 22:09:46 +03:30
|
|
|
count Decimal @db.Decimal(10, 0)
|
|
|
|
|
fee Decimal @db.Decimal(15, 2)
|
|
|
|
|
total Decimal @db.Decimal(15, 2)
|
2025-12-24 21:24:59 +03:30
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
invoiceId Int
|
|
|
|
|
productId Int
|
2025-12-30 21:04:01 +03:30
|
|
|
invoice SalesInvoice @relation(fields: [invoiceId], references: [id])
|
|
|
|
|
product Product @relation(fields: [productId], references: [id])
|
2025-12-24 21:24:59 +03:30
|
|
|
|
2025-12-30 21:04:01 +03:30
|
|
|
@@index([invoiceId])
|
|
|
|
|
@@index([productId])
|
2025-12-24 21:24:59 +03:30
|
|
|
@@map("Sales_Invoice_Items")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model TriggerLog {
|
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
message String @db.Text
|
|
|
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
|
|
|
|
name String @db.Text
|
|
|
|
|
|
|
|
|
|
@@map("Trigger_Logs")
|
|
|
|
|
}
|