Files
psp_api/prisma/schema/others.prisma
T
ahasani d98507fc1f fix: update SupplierLedger model to use correct enum casing and adjust types
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
2025-12-26 22:09:46 +03:30

81 lines
3.3 KiB
Plaintext

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)
orders Order[] @relation("Customer_Orders")
salesInvoices SalesInvoice[] @relation("Customer_Sales_Invoices")
stockMovements StockMovement[] @relation("StockMovement_Customer")
@@map("Customers")
}
model Order {
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)
customerId Int
customer Customer @relation("Customer_Orders", fields: [customerId], references: [id], onUpdate: NoAction)
@@index([customerId], map: "Orders_customerId_fkey")
@@map("Orders")
}
model SalesInvoice {
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?
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")
}
model SalesInvoiceItem {
id Int @id @default(autoincrement())
count Decimal @db.Decimal(10, 0)
fee Decimal @db.Decimal(15, 2)
total Decimal @db.Decimal(15, 2)
createdAt DateTime @default(now()) @db.Timestamp(0)
invoiceId Int
productId Int
invoice SalesInvoice @relation("SalesInvoice_Items", fields: [invoiceId], references: [id])
product Product @relation("Product_SalesInvoiceItems", fields: [productId], references: [id])
@@index([invoiceId], map: "Sales_Invoice_Items_invoiceId_fkey")
@@index([productId], map: "Sales_Invoice_Items_productId_fkey")
@@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")
}