feat(inventories): add cardex retrieval for inventory and product

feat(pos): update sale invoice creation to include customer and item details
feat(pos): enhance POS account service to include today's sales information
feat(pos): refactor order DTO to create sale invoice with detailed item structure
feat(products): add minimum stock alert level to product creation and update DTOs
fix(triggers): implement stock validation and movement logging for sales invoice items
refactor(database): update sales invoices schema to include posAccountId and remove inventoryId
This commit is contained in:
2025-12-30 21:04:01 +03:30
parent 1bb206a608
commit eb6e0e7a0d
30 changed files with 1265 additions and 648 deletions
+5 -5
View File
@@ -4,7 +4,7 @@ model ProductVariant {
basePrice Decimal @db.Decimal(15, 2)
salePrice Decimal @db.Decimal(15, 2)
description String? @db.Text
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
barcode String? @unique() @db.VarChar(100)
imageUrl String? @db.VarChar(255)
unit String? @db.VarChar(10)
quantity Decimal? @default(0.00) @db.Decimal(10, 0)
@@ -25,24 +25,24 @@ model Product {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
description String? @db.Text
sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
sku String? @unique() @db.VarChar(100)
barcode String? @unique() @db.VarChar(100)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
brandId Int?
categoryId Int?
salePrice Decimal @default(0.00) @db.Decimal(15, 0)
minimumStockAlertLevel Decimal @default(1.00) @db.Decimal(10, 0)
inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product")
// productCharges ProductCharge[] @relation("Product_Charges")
variants ProductVariant[] @relation("Product_Variant")
brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
purchaseReceiptItems PurchaseReceiptItem[] @relation("Product_PurchaseReceiptItems")
salesInvoiceItems SalesInvoiceItem[] @relation("Product_SalesInvoiceItems")
stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments")
stockBalances StockBalance[] @relation("StockBalance_Product")
stockMovements StockMovement[] @relation("StockMovement_Product")
salesInvoiceItems SalesInvoiceItem[]
@@index([brandId], map: "Products_brandId_fkey")
@@index([categoryId], map: "Products_categoryId_fkey")