feat: implement POS order management system
- Added CreateOrderDto and CreateOrderItemDto for order creation. - Developed PosOrdersController to handle order-related endpoints. - Created PosOrdersService for business logic related to orders. - Implemented PosOrdersWorkflow for order processing workflows. - Established Prisma integration for database operations in orders. - Introduced SalesInvoicesModule and related DTOs for sales invoice management. - Enhanced SalesInvoicesService and SalesInvoicesWorkflow for invoice processing.
This commit is contained in:
@@ -47,6 +47,7 @@ model PosAccount {
|
||||
|
||||
inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])
|
||||
salesInvoices SalesInvoice[]
|
||||
orders Order[]
|
||||
|
||||
@@index([inventoryId])
|
||||
@@map("Pos_Accounts")
|
||||
|
||||
+17
-11
@@ -1,16 +1,22 @@
|
||||
model Order {
|
||||
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?
|
||||
customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction)
|
||||
orderItems OrderItem[]
|
||||
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
|
||||
|
||||
customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction)
|
||||
posAccount PosAccount @relation(fields: [posAccountId], references: [id], onUpdate: NoAction)
|
||||
|
||||
orderItems OrderItem[]
|
||||
stockReservations StockReservation[]
|
||||
|
||||
@@index([posAccountId])
|
||||
@@index([customerId])
|
||||
@@map("Orders")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../../src/generated/prisma"
|
||||
moduleFormat = "cjs"
|
||||
provider = "prisma-client"
|
||||
output = "../../src/generated/prisma"
|
||||
moduleFormat = "cjs"
|
||||
previewFeatures = ["views"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
|
||||
@@ -63,15 +63,25 @@ model StockAdjustment {
|
||||
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])
|
||||
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([inventoryId])
|
||||
@@index([productId])
|
||||
@@map("Stock_Reservations")
|
||||
}
|
||||
|
||||
view StockAvailableView {
|
||||
productId Int
|
||||
inventoryId Int
|
||||
physicalQuantity Decimal @db.Decimal(10, 0)
|
||||
reservedQuantity Decimal @db.Decimal(10, 0)
|
||||
availableQuantity Decimal @db.Decimal(10, 0)
|
||||
|
||||
@@map("Stock_Available_View")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user