From 89c57a69c13688e6e2838d6a10c018465c13ae83 Mon Sep 17 00:00:00 2001 From: ahasani194 Date: Tue, 23 Dec 2025 20:35:44 +0330 Subject: [PATCH] feat(cardex): enhance stock movement retrieval with additional fields and optimized mapping refactor(migration): update Stock_Movements table to include counterInventoryId and customerId, add foreign key constraints, and implement triggers for inventory management --- .../20251222153356_init/migration.sql | 357 +++++++++++++ prisma/schema.prisma | 6 + prisma/triggers/dump_triggers.sql | 259 +++++---- src/generated/prisma/internal/class.ts | 4 +- .../prisma/internal/prismaNamespace.ts | 4 +- .../prisma/internal/prismaNamespaceBrowser.ts | 4 +- src/generated/prisma/models/Customer.ts | 154 ++++++ src/generated/prisma/models/Inventory.ts | 187 +++++++ src/generated/prisma/models/StockMovement.ts | 490 +++++++++++++++++- src/modules/cardex/cardex.service.ts | 44 +- 10 files changed, 1366 insertions(+), 143 deletions(-) create mode 100644 prisma/migrations/20251222153356_init/migration.sql diff --git a/prisma/migrations/20251222153356_init/migration.sql b/prisma/migrations/20251222153356_init/migration.sql new file mode 100644 index 0000000..e114e58 --- /dev/null +++ b/prisma/migrations/20251222153356_init/migration.sql @@ -0,0 +1,357 @@ +-- AlterTable +ALTER TABLE `Stock_Movements` +ADD COLUMN `counterInventoryId` INTEGER NULL, +ADD COLUMN `customerId` INTEGER NULL; + +-- AddForeignKey +ALTER TABLE `Stock_Movements` +ADD CONSTRAINT `Stock_Movements_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Stock_Movements` +ADD CONSTRAINT `Stock_Movements_counterInventoryId_fkey` FOREIGN KEY (`counterInventoryId`) REFERENCES `Inventories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- ------------------------------------------ +-- Trigger: trg_transfer_item_after_insert +-- Event: INSERT +-- Table: Inventory_Transfer_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_transfer_item_after_insert`; + +CREATE TRIGGER `trg_transfer_item_after_insert` AFTER INSERT ON `Inventory_Transfer_Items` FOR EACH ROW begin + +DECLARE fromInv INT; + DECLARE toInv INT; + DECLARE _avgCost DECIMAL(10,2); + DECLARE latestQuantityInOrigin DECIMAL(10,2); + DECLARE latestQuantityInDestination DECIMAL(10,2); + + SELECT fromInventoryId, toInventoryId INTO fromInv, toInv + FROM Inventory_Transfers WHERE id = NEW.transferId; + + SELECT COALESCE(avgCost, 0), COALESCE(quantity, 0) INTO _avgCost, latestQuantityInOrigin FROM Stock_Balance + WHERE ProductId = NEW.productId AND inventoryId = fromInv LIMIT 1; + + SELECT COALESCE(quantity, 0) INTO latestQuantityInDestination FROM Stock_Balance + WHERE ProductId = NEW.productId AND inventoryId = toInv LIMIT 1; + + + -- OUT from source + INSERT INTO Stock_Movements + (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + VALUES + ('OUT', NEW.count, _avgCost, _avgCost*NEW.count, _avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, fromInv, toInv, NOW(), latestQuantityInOrigin-NEW.count); + + -- IN to destination + INSERT INTO Stock_Movements + (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + VALUES + ('IN', NEW.count,_avgCost, _avgCost*NEW.count,_avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, toInv, fromInv, NOW(), latestQuantityInOrigin-NEW.count); +end; + +-- ------------------------------------------ +-- Trigger: trg_purchase_receipt_item_after_insert +-- Event: INSERT +-- Table: Purchase_Receipt_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_insert`; + +CREATE TRIGGER `trg_purchase_receipt_item_after_insert` AFTER INSERT ON `Purchase_Receipt_Items` FOR EACH ROW BEGIN DECLARE latestQuantity DECIMAL(10, 2) DEFAULT 0; + +DECLARE invId INT; + DECLARE suppId INT; + + -- Get inventory & supplier from receipt + SELECT inventoryId, supplierId + INTO invId, suppId + FROM Purchase_Receipts + WHERE id = NEW.receiptId; + + -- Get current stock quantity (if exists) + SELECT COALESCE(quantity, 0) + INTO latestQuantity + FROM Stock_Balance sb + WHERE sb.inventoryId = invId + AND sb.productId = NEW.productId + LIMIT 1; + + -- Insert stock movement + INSERT INTO Stock_Movements ( + type, + quantity, + fee, + totalCost, + referenceType, + referenceId, + productId, + inventoryId, + avgCost, + supplierId, + remainedInStock, + createdAt + ) + VALUES ( + 'IN', + NEW.count, + NEW.fee, + NEW.total, + 'PURCHASE', + NEW.receiptId, + NEW.productId, + invId, + CASE + WHEN NEW.count = 0 THEN 0 + ELSE NEW.total / NEW.count + END + +, + suppId, + latestQuantity + NEW.count, + NOW() + ); + +END; + +-- ------------------------------------------ +-- Trigger: trg_sales_invoice_items_before_insert +-- Event: INSERT +-- Table: Sales_Invoice_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_sales_invoice_items_before_insert`; + +CREATE TRIGGER `trg_sales_invoice_items_before_insert` BEFORE INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin DECLARE current_stock DECIMAL(10, 2); + +DECLARE inventory_id INT; + + + SELECT inventoryId INTO inventory_id + FROM Sales_Invoices si + WHERE si.id = NEW.invoiceId + LIMIT 1; + + SELECT COALESCE(quantity, 0) INTO current_stock + FROM Stock_Balance sb + WHERE productId = NEW.productId AND sb.inventoryId = inventory_id + LIMIT 1; + + + + IF NEW.count > current_stock THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'موجودی کالا در انبار کافی نیست.'; + END IF; +end; + +-- ------------------------------------------ +-- Trigger: trg_sales_invoice_items_after_insert +-- Event: INSERT +-- Table: Sales_Invoice_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_sales_invoice_items_after_insert`; + +CREATE TRIGGER `trg_sales_invoice_items_after_insert` AFTER INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin DECLARE current_stock DECIMAL(10, 2); + +DECLARE inventory_id INT; +DECLARE customer_id INT; + + + SELECT inventoryId , customerId INTO inventory_id, customer_id + FROM Sales_Invoices si + WHERE si.id = NEW.invoiceId + LIMIT 1; + + SELECT COALESCE(quantity, 0) INTO current_stock + FROM Stock_Balance sb + WHERE productId = NEW.productId AND sb.inventoryId = inventory_id + LIMIT 1; + + + + INSERT INTO Stock_Movements ( + type, + quantity, + fee, + totalCost, + referenceType, + referenceId, + productId, + inventoryId, + avgCost, + remainedInStock, + customerId, + createdAt + ) + VALUES ( + 'OUT', + NEW.count, + NEW.fee, + NEW.total, + 'SALES', + NEW.invoiceId, + NEW.productId, + inventory_id, + + CASE + WHEN NEW.count = 0 THEN 0 + ELSE NEW.total / NEW.count + END, + current_stock + NEW.count, + customer_id, + NOW() + ); + + +END; + +-- ------------------------------------------ +-- Trigger: trg_stock_transfer +-- Event: INSERT +-- Table: Stock_Movements +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_stock_transfer`; + +CREATE TRIGGER `trg_stock_transfer` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'INVENTORY_TRANSFER' THEN IF NEW.type = 'IN' THEN +INSERT INTO + Stock_Balance ( + productId, + inventoryId, + quantity, + totalCost, + avgCost, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.inventoryId, + NEW.quantity, + NEW.totalCost, + CASE + WHEN NEW.quantity = 0 THEN 0 + ELSE NEW.totalCost / NEW.quantity + END, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity + NEW.quantity, + totalCost = totalCost + NEW.totalCost, + avgCost = CASE + WHEN (quantity + NEW.quantity) = 0 THEN 0 + ELSE (totalCost + NEW.totalCost) / (quantity + NEW.quantity) + END, + updatedAt = NOW(); + +END IF; + +IF NEW.type = 'OUT' THEN IF EXISTS ( + SELECT 1 + FROM Stock_Balance sb + WHERE + sb.productId = NEW.productId + AND sb.inventoryId = NEW.inventoryId +) THEN + +UPDATE Stock_Balance sb +SET + sb.quantity = sb.quantity - NEW.quantity, + sb.totalCost = sb.totalCost - (sb.avgCost * NEW.quantity), + sb.updatedAt = NOW() +WHERE + sb.productId = NEW.productId + AND sb.inventoryId = NEW.inventoryId; + +ELSE +INSERT INTO + Stock_Balance ( + productId, + inventoryId, + quantity, + totalCost, + avgCost, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.inventoryId, + - NEW.quantity, + - COALESCE(NEW.fee, 0) * NEW.quantity, + COALESCE(NEW.fee, 0), + NOW() + ); + +END IF; + +END IF; + +END IF; + +END; + +-- ------------------------------------------ +-- Trigger: trg_stock_purchase_insert +-- Event: INSERT +-- Table: Stock_Movements +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_stock_purchase_insert`; + +CREATE TRIGGER `trg_stock_purchase_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'PURCHASE' THEN + +INSERT INTO + Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.quantity, + NEW.fee, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity + NEW.quantity, + totalCost = totalCost + NEW.totalCost, + avgCost = totalCost / quantity; + +END IF; + +END; + +-- ------------------------------------------ +-- Trigger: trg_stock_sale_insert +-- Event: INSERT +-- Table: Stock_Movements +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_stock_sale_insert`; + +CREATE TRIGGER `trg_stock_sale_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'SALES' THEN + +INSERT INTO + Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.quantity, + NEW.fee, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity - NEW.quantity, + totalCost = totalCost - NEW.totalCost, + avgCost = totalCost / quantity; + +END IF; + +END; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0700af7..ba08d00 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -156,6 +156,7 @@ model Customer { salesInvoices SalesInvoice[] @relation("Customer_Sales_Invoices") @@map("Customers") + stockMovements StockMovement[] @relation("StockMovement_Customer") } model Inventory { @@ -173,6 +174,7 @@ model Inventory { purchaseReceipts PurchaseReceipt[] stockAdjustments StockAdjustment[] @relation("Inventory_Stock_Adjustments") stockMovements StockMovement[] @relation("StockMovement_Inventory") + counterStockMovements StockMovement[] @relation("StockMovement_CounterInventory") stockBalances StockBalance[] @relation("StockBalance_inventory") salesInvoices SalesInvoice[] @relation("Inventory_SalesInvoices") @@ -317,6 +319,10 @@ model StockMovement { product Product @relation("StockMovement_Product", fields: [productId], references: [id]) supplierId Int? supplier Supplier? @relation("StockMovement_Supplier", fields: [supplierId], references: [id]) + customerId Int? + customer Customer? @relation("StockMovement_Customer", fields: [customerId], references: [id]) + counterInventoryId Int? + counterInventory Inventory? @relation("StockMovement_CounterInventory", fields: [counterInventoryId], references: [id]) @@index([inventoryId], map: "Stock_Movements_inventoryId_fkey") @@index([productId], map: "Stock_Movements_productId_fkey") diff --git a/prisma/triggers/dump_triggers.sql b/prisma/triggers/dump_triggers.sql index 0aeef6e..2c20368 100644 --- a/prisma/triggers/dump_triggers.sql +++ b/prisma/triggers/dump_triggers.sql @@ -1,5 +1,5 @@ -- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-21T08:07:11.406Z +-- Generated at: 2025-12-22T15:32:20.184Z -- ------------------------------------------ -- Trigger: trg_transfer_item_after_insert @@ -7,10 +7,10 @@ -- Table: Inventory_Transfer_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_transfer_item_after_insert`; + CREATE DEFINER=`pos`@`%` TRIGGER `trg_transfer_item_after_insert` AFTER INSERT ON `Inventory_Transfer_Items` FOR EACH ROW begin - - DECLARE fromInv INT; +DECLARE fromInv INT; DECLARE toInv INT; DECLARE _avgCost DECIMAL(10,2); DECLARE latestQuantityInOrigin DECIMAL(10,2); @@ -28,15 +28,15 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_transfer_item_after_insert` AFTER INSERT O -- OUT from source INSERT INTO Stock_Movements - (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, createdAt, remainedInStock) + (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, cuonterInventoryId, createdAt, remainedInStock) VALUES - ('OUT', NEW.count, _avgCost, _avgCost*NEW.count, _avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, fromInv, NOW(), latestQuantityInOrigin-NEW.count); + ('OUT', NEW.count, _avgCost, _avgCost*NEW.count, _avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, fromInv, toInv, NOW(), latestQuantityInOrigin-NEW.count); -- IN to destination INSERT INTO Stock_Movements - (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, createdAt, remainedInStock) + (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, cuonterInventoryId, createdAt, remainedInStock) VALUES - ('IN', NEW.count,_avgCost, _avgCost*NEW.count,_avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, toInv, NOW(), latestQuantityInOrigin-NEW.count); + ('IN', NEW.count,_avgCost, _avgCost*NEW.count,_avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, toInv, fromInv, NOW(), latestQuantityInOrigin-NEW.count); end; -- ------------------------------------------ @@ -45,9 +45,10 @@ end; -- Table: Purchase_Receipt_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER INSERT ON `Purchase_Receipt_Items` FOR EACH ROW BEGIN - DECLARE latestQuantity DECIMAL(10,2) DEFAULT 0; - DECLARE invId INT; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER INSERT ON `Purchase_Receipt_Items` FOR EACH ROW BEGIN DECLARE latestQuantity DECIMAL(10, 2) DEFAULT 0; + +DECLARE invId INT; DECLARE suppId INT; -- Get inventory & supplier from receipt @@ -91,11 +92,14 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER CASE WHEN NEW.count = 0 THEN 0 ELSE NEW.total / NEW.count - END, + END + +, suppId, latestQuantity + NEW.count, NOW() ); + END; -- ------------------------------------------ @@ -104,21 +108,22 @@ END; -- Table: Sales_Invoice_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_sales_invoice_items_before_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin - DECLARE current_stock DECIMAL(10,2); - DECLARE inventory_id INT; - +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin DECLARE current_stock DECIMAL(10, 2); + +DECLARE inventory_id INT; + + SELECT inventoryId INTO inventory_id - FROM Sales_Invoices si + FROM Sales_Invoices si WHERE si.id = NEW.invoiceId LIMIT 1; - + SELECT COALESCE(quantity, 0) INTO current_stock - FROM Stock_Balance sb + FROM Stock_Balance sb WHERE productId = NEW.productId AND sb.inventoryId = inventory_id LIMIT 1; - + IF NEW.count > current_stock THEN @@ -133,21 +138,23 @@ end; -- Table: Sales_Invoice_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_sales_invoice_items_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin - DECLARE current_stock DECIMAL(10,2); - DECLARE inventory_id INT; - - SELECT inventoryId INTO inventory_id - FROM Sales_Invoices si +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin DECLARE current_stock DECIMAL(10, 2); + +DECLARE inventory_id INT; +DECLARE customer_id INT; + + + SELECT inventoryId , customerId INTO inventory_id, customer_id + FROM Sales_Invoices si WHERE si.id = NEW.invoiceId LIMIT 1; - + SELECT COALESCE(quantity, 0) INTO current_stock - FROM Stock_Balance sb + FROM Stock_Balance sb WHERE productId = NEW.productId AND sb.inventoryId = inventory_id LIMIT 1; - + INSERT INTO Stock_Movements ( @@ -161,6 +168,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER IN inventoryId, avgCost, remainedInStock, + customerId, createdAt ) VALUES ( @@ -172,14 +180,18 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER IN NEW.invoiceId, NEW.productId, inventory_id, + CASE WHEN NEW.count = 0 THEN 0 ELSE NEW.total / NEW.count END, current_stock + NEW.count, + customer_id, NOW() ); -end; + + +END; -- ------------------------------------------ -- Trigger: trg_stock_transfer @@ -187,81 +199,81 @@ end; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_transfer`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_transfer` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN - IF NEW.referenceType = 'INVENTORY_TRANSFER' THEN - - IF NEW.type = 'IN' THEN - INSERT INTO Stock_Balance ( +CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_transfer` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'INVENTORY_TRANSFER' THEN IF NEW.type = 'IN' THEN +INSERT INTO + Stock_Balance ( productId, inventoryId, quantity, totalCost, avgCost, updatedAt - ) - VALUES ( + ) +VALUES ( NEW.productId, NEW.inventoryId, NEW.quantity, NEW.totalCost, CASE - WHEN NEW.quantity = 0 THEN 0 - ELSE NEW.totalCost / NEW.quantity + WHEN NEW.quantity = 0 THEN 0 + ELSE NEW.totalCost / NEW.quantity END, NOW() - ) - ON DUPLICATE KEY UPDATE - quantity = quantity + NEW.quantity, - totalCost = totalCost + NEW.totalCost, - avgCost = CASE - WHEN (quantity + NEW.quantity) = 0 THEN 0 - ELSE (totalCost + NEW.totalCost) / (quantity + NEW.quantity) - END, - updatedAt = NOW(); - END IF; + ) +ON DUPLICATE KEY UPDATE + quantity = quantity + NEW.quantity, + totalCost = totalCost + NEW.totalCost, + avgCost = CASE + WHEN (quantity + NEW.quantity) = 0 THEN 0 + ELSE (totalCost + NEW.totalCost) / (quantity + NEW.quantity) + END, + updatedAt = NOW(); +END IF; - IF NEW.type = 'OUT' THEN +IF NEW.type = 'OUT' THEN IF EXISTS ( + SELECT 1 + FROM Stock_Balance sb + WHERE + sb.productId = NEW.productId + AND sb.inventoryId = NEW.inventoryId +) THEN +UPDATE Stock_Balance sb +SET + sb.quantity = sb.quantity - NEW.quantity, + sb.totalCost = sb.totalCost - (sb.avgCost * NEW.quantity), + sb.updatedAt = NOW() +WHERE + sb.productId = NEW.productId + AND sb.inventoryId = NEW.inventoryId; - IF EXISTS( - SELECT 1 FROM Stock_Balance sb - WHERE sb.productId = NEW.productId - AND sb.inventoryId = NEW.inventoryId - ) THEN +ELSE +INSERT INTO + Stock_Balance ( + productId, + inventoryId, + quantity, + totalCost, + avgCost, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.inventoryId, + - NEW.quantity, + - COALESCE(NEW.fee, 0) * NEW.quantity, + COALESCE(NEW.fee, 0), + NOW() + ); +END IF; - UPDATE Stock_Balance sb - SET - sb.quantity = sb.quantity - NEW.quantity, - sb.totalCost = sb.totalCost - (sb.avgCost * NEW.quantity), - sb.updatedAt = NOW() - WHERE sb.productId = NEW.productId - AND sb.inventoryId = NEW.inventoryId; +END IF; - ELSE - INSERT INTO Stock_Balance ( - productId, - inventoryId, - quantity, - totalCost, - avgCost, - updatedAt - ) - VALUES ( - NEW.productId, - NEW.inventoryId, - -NEW.quantity, - -COALESCE(NEW.fee, 0) * NEW.quantity, - COALESCE(NEW.fee, 0), - NOW() - ); - END IF; +END IF; - END IF; - - END IF; END; -- ------------------------------------------ @@ -270,24 +282,33 @@ END; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_purchase_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN - IF NEW.referenceType = 'PURCHASE' THEN - INSERT INTO Stock_Balance (productId, quantity, avgCost, totalCost, inventoryId, updatedAt) - VALUES ( - NEW.productId, - NEW.quantity, - NEW.fee, - NEW.totalCost, - NEW.inventoryId, - NOW() - ) - ON DUPLICATE KEY UPDATE - quantity = quantity + NEW.quantity, - totalCost = totalCost + NEW.totalCost, - avgCost = totalCost / quantity; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'PURCHASE' THEN + +INSERT INTO + Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.quantity, + NEW.fee, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity + NEW.quantity, + totalCost = totalCost + NEW.totalCost, + avgCost = totalCost / quantity; + +END IF; - END IF; END; -- ------------------------------------------ @@ -296,23 +317,31 @@ END; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_sale_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN - IF NEW.referenceType = 'SALES' THEN - INSERT INTO Stock_Balance (productId, quantity, avgCost, totalCost, inventoryId, updatedAt) - VALUES ( - NEW.productId, - NEW.quantity, - NEW.fee, - NEW.totalCost, - NEW.inventoryId, - NOW() - ) - ON DUPLICATE KEY UPDATE - quantity = quantity - NEW.quantity, - totalCost = totalCost - NEW.totalCost, - avgCost = totalCost / quantity; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'SALES' THEN + +INSERT INTO + Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) +VALUES ( + NEW.productId, + NEW.quantity, + NEW.fee, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity - NEW.quantity, + totalCost = totalCost - NEW.totalCost, + avgCost = totalCost / quantity; + +END IF; - END IF; END; - diff --git a/src/generated/prisma/internal/class.ts b/src/generated/prisma/internal/class.ts index 6821fda..117ce7a 100644 --- a/src/generated/prisma/internal/class.ts +++ b/src/generated/prisma/internal/class.ts @@ -22,7 +22,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.1.0", "engineVersion": "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba", "activeProvider": "mysql", - "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n previewFeatures = [\"views\"]\n moduleFormat = \"cjs\"\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n mobileNumber String @unique @db.Char(11)\n password String\n firstName String\n lastName String\n roleId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\n refreshTokens RefreshToken[]\n\n @@index([roleId], map: \"Users_roleId_fkey\")\n @@map(\"Users\")\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique() @db.VarChar(100)\n description String? @db.Text\n permissions Json?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n users User[] @relation(\"User_Role\")\n\n @@map(\"Roles\")\n}\n\nmodel ProductVariant {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n basePrice Decimal @db.Decimal(10, 2)\n salePrice Decimal @db.Decimal(10, 2)\n description String? @db.Text\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n imageUrl String? @db.VarChar(255)\n unit String? @db.VarChar(10)\n quantity Decimal? @default(0.00) @db.Decimal(10, 2)\n alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)\n isActive Boolean @default(true)\n isFeatured Boolean @default(false)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productId Int\n product Product @relation(\"Product_Variant\", fields: [productId], references: [id], onUpdate: NoAction)\n\n @@index([productId], map: \"Product_Variants_productId_fkey\")\n @@map(\"Product_Variants\")\n}\n\nmodel Product {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String? @unique(map: \"products_sku_unique\") @db.VarChar(100)\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n salePrice Decimal @default(0.00) @db.Decimal(10, 2)\n brandId Int?\n categoryId Int?\n inventoryTransferItems InventoryTransferItem[] @relation(\"InventoryTransferItem_Product\")\n productCharges ProductCharge[] @relation(\"Product_Charges\")\n variants ProductVariant[] @relation(\"Product_Variant\")\n brand ProductBrand? @relation(\"Product_Brand\", fields: [brandId], references: [id], onUpdate: NoAction)\n category ProductCategory? @relation(\"Product_Category\", fields: [categoryId], references: [id], onUpdate: NoAction)\n purchaseReceiptItems PurchaseReceiptItem[] @relation(\"Product_PurchaseReceiptItems\")\n salesInvoiceItems SalesInvoiceItem[] @relation(\"Product_SalesInvoiceItems\")\n stockAdjustments StockAdjustment[] @relation(\"Product_Stock_Adjustments\")\n stockMovements StockMovement[] @relation(\"StockMovement_Product\")\n\n stockBalances StockBalance[] @relation(\"StockBalance_Product\")\n\n @@index([brandId], map: \"Products_brandId_fkey\")\n @@index([categoryId], map: \"Products_categoryId_fkey\")\n @@map(\"Products\")\n}\n\nmodel ProductBrand {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Brand\")\n\n @@map(\"Product_brands\")\n}\n\nmodel ProductCategory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Category\")\n\n @@map(\"Product_categories\")\n}\n\nmodel Supplier {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productCharges ProductCharge[] @relation(\"Supplier_Product_Charges\")\n purchaseReceipts PurchaseReceipt[]\n stockMovements StockMovement[] @relation(\"StockMovement_Supplier\")\n\n @@map(\"Suppliers\")\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n orders Order[] @relation(\"Customer_Orders\")\n salesInvoices SalesInvoice[] @relation(\"Customer_Sales_Invoices\")\n\n @@map(\"Customers\")\n}\n\nmodel Inventory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n isPointOfSale Boolean @default(false)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n inventoryTransfersFrom InventoryTransfer[] @relation(\"Inventory_From\")\n inventoryTransfersTo InventoryTransfer[] @relation(\"Inventory_To\")\n productCharges ProductCharge[] @relation(\"Inventory_Product_Charges\")\n purchaseReceipts PurchaseReceipt[]\n stockAdjustments StockAdjustment[] @relation(\"Inventory_Stock_Adjustments\")\n stockMovements StockMovement[] @relation(\"StockMovement_Inventory\")\n stockBalances StockBalance[] @relation(\"StockBalance_inventory\")\n salesInvoices SalesInvoice[] @relation(\"Inventory_SalesInvoices\")\n\n @@map(\"Inventories\")\n}\n\nmodel Store {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n @@map(\"Stores\")\n}\n\nmodel ProductCharge {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalAmount Decimal @db.Decimal(10, 2)\n isSettled Boolean @default(false)\n buyAt DateTime? @db.Timestamp(0)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productId Int\n inventoryId Int\n supplierId Int\n inventory Inventory @relation(\"Inventory_Product_Charges\", fields: [inventoryId], references: [id], onUpdate: NoAction)\n product Product @relation(\"Product_Charges\", fields: [productId], references: [id], onUpdate: NoAction)\n supplier Supplier @relation(\"Supplier_Product_Charges\", fields: [supplierId], references: [id], onUpdate: NoAction)\n\n @@index([inventoryId], map: \"Product_Charges_inventoryId_fkey\")\n @@index([productId], map: \"Product_Charges_productId_fkey\")\n @@index([supplierId], map: \"Product_Charges_supplierId_fkey\")\n @@map(\"Product_Charges\")\n}\n\nmodel Order {\n id Int @id @default(autoincrement())\n orderNumber String @unique @db.VarChar(100)\n status OrderStatus @default(pending)\n paymentMethod paymentMethod @default(card)\n totalAmount Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n customerId Int\n customer Customer @relation(\"Customer_Orders\", fields: [customerId], references: [id], onUpdate: NoAction)\n\n @@index([customerId], map: \"Orders_customerId_fkey\")\n @@map(\"Orders\")\n}\n\nmodel PurchaseReceipt {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n supplierId Int\n inventoryId Int\n items PurchaseReceiptItem[] @relation(\"PurchaseReceipt_Items\")\n inventory Inventory @relation(fields: [inventoryId], references: [id])\n supplier Supplier @relation(fields: [supplierId], references: [id])\n\n @@index([inventoryId], map: \"Purchase_Receipts_inventoryId_fkey\")\n @@index([supplierId], map: \"Purchase_Receipts_supplierId_fkey\")\n @@map(\"Purchase_Receipts\")\n}\n\nmodel PurchaseReceiptItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n total Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n receiptId Int\n productId Int\n receipt PurchaseReceipt @relation(\"PurchaseReceipt_Items\", fields: [receiptId], references: [id])\n product Product @relation(\"Product_PurchaseReceiptItems\", fields: [productId], references: [id])\n\n @@index([productId], map: \"Purchase_Receipt_Items_productId_fkey\")\n @@index([receiptId], map: \"Purchase_Receipt_Items_receiptId_fkey\")\n @@map(\"Purchase_Receipt_Items\")\n}\n\nmodel SalesInvoice {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n customerId Int?\n inventoryId Int\n items SalesInvoiceItem[] @relation(\"SalesInvoice_Items\")\n customer Customer? @relation(\"Customer_Sales_Invoices\", fields: [customerId], references: [id])\n inventory Inventory @relation(\"Inventory_SalesInvoices\", fields: [inventoryId], references: [id])\n\n @@index([inventoryId], map: \"Sales_Invoices_inventoryId_fkey\")\n @@index([customerId], map: \"Sales_Invoices_customerId_fkey\")\n @@map(\"Sales_Invoices\")\n}\n\nmodel SalesInvoiceItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n total Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n invoiceId Int\n productId Int\n invoice SalesInvoice @relation(\"SalesInvoice_Items\", fields: [invoiceId], references: [id])\n product Product @relation(\"Product_SalesInvoiceItems\", fields: [productId], references: [id])\n\n @@index([invoiceId], map: \"Sales_Invoice_Items_invoiceId_fkey\")\n @@index([productId], map: \"Sales_Invoice_Items_productId_fkey\")\n @@map(\"Sales_Invoice_Items\")\n}\n\nmodel StockMovement {\n id Int @id @default(autoincrement())\n type MovementType\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n referenceType MovementReferenceType\n referenceId String\n createdAt DateTime @default(now()) @db.Timestamp(0)\n productId Int\n inventoryId Int\n avgCost Decimal @db.Decimal(10, 2)\n remainedInStock Decimal @default(0) @db.Decimal(10, 2)\n inventory Inventory @relation(\"StockMovement_Inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockMovement_Product\", fields: [productId], references: [id])\n supplierId Int?\n supplier Supplier? @relation(\"StockMovement_Supplier\", fields: [supplierId], references: [id])\n\n @@index([inventoryId], map: \"Stock_Movements_inventoryId_fkey\")\n @@index([productId], map: \"Stock_Movements_productId_fkey\")\n @@map(\"Stock_Movements\")\n}\n\nmodel StockBalance {\n id Int @id @default(autoincrement())\n\n productId Int\n inventoryId Int\n\n quantity Decimal @default(0) @db.Decimal(14, 3)\n\n avgCost Decimal @default(0) @db.Decimal(14, 2)\n totalCost Decimal @default(0) @db.Decimal(14, 2)\n\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n\n product Product @relation(\"StockBalance_Product\", fields: [productId], references: [id])\n inventory Inventory @relation(\"StockBalance_inventory\", fields: [inventoryId], references: [id])\n\n @@unique([productId, inventoryId])\n @@index([productId])\n @@index([inventoryId])\n @@map(\"Stock_Balance\")\n}\n\nmodel OtpCode {\n id Int @id @default(autoincrement())\n mobileNumber String @db.VarChar(20)\n code String @db.VarChar(10)\n used Boolean @default(false)\n expiresAt DateTime @db.Timestamp(0)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@index([mobileNumber])\n @@map(\"Otp_Codes\")\n}\n\nmodel RefreshToken {\n id Int @id @default(autoincrement())\n tokenHash String @db.VarChar(255)\n userId Int\n revoked Boolean @default(false)\n expiresAt DateTime @db.Timestamp(0)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n user User @relation(fields: [userId], references: [id])\n\n @@index([userId])\n @@map(\"Refresh_Tokens\")\n}\n\nmodel InventoryTransfer {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n fromInventoryId Int\n toInventoryId Int\n items InventoryTransferItem[] @relation(\"InventoryTransfer_Items\")\n fromInventory Inventory @relation(\"Inventory_From\", fields: [fromInventoryId], references: [id])\n toInventory Inventory @relation(\"Inventory_To\", fields: [toInventoryId], references: [id])\n\n @@index([fromInventoryId], map: \"Inventory_Transfers_fromInventoryId_fkey\")\n @@index([toInventoryId], map: \"Inventory_Transfers_toInventoryId_fkey\")\n @@map(\"Inventory_Transfers\")\n}\n\nmodel InventoryTransferItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n productId Int\n transferId Int\n product Product @relation(\"InventoryTransferItem_Product\", fields: [productId], references: [id])\n transfer InventoryTransfer @relation(\"InventoryTransfer_Items\", fields: [transferId], references: [id])\n\n @@index([productId], map: \"Inventory_Transfer_Items_productId_fkey\")\n @@index([transferId], map: \"Inventory_Transfer_Items_transferId_fkey\")\n @@map(\"Inventory_Transfer_Items\")\n}\n\nmodel StockAdjustment {\n id Int @id @default(autoincrement())\n adjustedQuantity Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n productId Int\n inventoryId Int\n inventory Inventory @relation(\"Inventory_Stock_Adjustments\", fields: [inventoryId], references: [id])\n product Product @relation(\"Product_Stock_Adjustments\", fields: [productId], references: [id])\n\n @@index([inventoryId], map: \"Stock_Adjustments_inventoryId_fkey\")\n @@index([productId], map: \"Stock_Adjustments_productId_fkey\")\n @@map(\"Stock_Adjustments\")\n}\n\nview StockMovements_View {\n id Int @default(0)\n productId Int\n type stock_movements_view_type\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n referenceId String\n referenceType stock_movements_view_referenceType\n createdAt DateTime @default(now()) @db.Timestamp(0)\n current_stock Decimal?\n current_avg_cost Decimal?\n\n @@map(\"Stock_Movements_View\")\n @@ignore\n}\n\nview inventory_overview {\n ProductId Int\n stock_quantity Decimal\n avgCost Decimal\n totalCost Decimal\n updatedAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Inventory_Overview\")\n}\n\nview stock_cardex {\n productId Int\n movement_id Int @default(0)\n type stock_cardex_type\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n balance_quantity Decimal?\n balance_avg_cost Decimal?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Stock_Cardex\")\n}\n\nview stock_view {\n productId Int\n inventoryId Int\n stock Decimal? @db.Decimal(32, 2)\n\n @@map(\"Stock_View\")\n}\n\nenum OrderStatus {\n pending\n reject\n done\n}\n\nenum paymentMethod {\n cash\n card\n}\n\nenum MovementType {\n IN\n OUT\n ADJUST\n}\n\nenum MovementReferenceType {\n PURCHASE\n SALES\n ADJUSTMENT\n INVENTORY_TRANSFER\n}\n\nenum stock_cardex_type {\n IN\n OUT\n ADJUST\n}\n\nenum stock_movements_view_type {\n IN\n OUT\n ADJUST\n}\n\nenum stock_movements_view_referenceType {\n PURCHASE\n SALES\n ADJUSTMENT\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n name String @db.Text\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Trigger_Logs\")\n}\n", + "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n previewFeatures = [\"views\"]\n moduleFormat = \"cjs\"\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n mobileNumber String @unique @db.Char(11)\n password String\n firstName String\n lastName String\n roleId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\n refreshTokens RefreshToken[]\n\n @@index([roleId], map: \"Users_roleId_fkey\")\n @@map(\"Users\")\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique() @db.VarChar(100)\n description String? @db.Text\n permissions Json?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n users User[] @relation(\"User_Role\")\n\n @@map(\"Roles\")\n}\n\nmodel ProductVariant {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n basePrice Decimal @db.Decimal(10, 2)\n salePrice Decimal @db.Decimal(10, 2)\n description String? @db.Text\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n imageUrl String? @db.VarChar(255)\n unit String? @db.VarChar(10)\n quantity Decimal? @default(0.00) @db.Decimal(10, 2)\n alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)\n isActive Boolean @default(true)\n isFeatured Boolean @default(false)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productId Int\n product Product @relation(\"Product_Variant\", fields: [productId], references: [id], onUpdate: NoAction)\n\n @@index([productId], map: \"Product_Variants_productId_fkey\")\n @@map(\"Product_Variants\")\n}\n\nmodel Product {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String? @unique(map: \"products_sku_unique\") @db.VarChar(100)\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n salePrice Decimal @default(0.00) @db.Decimal(10, 2)\n brandId Int?\n categoryId Int?\n inventoryTransferItems InventoryTransferItem[] @relation(\"InventoryTransferItem_Product\")\n productCharges ProductCharge[] @relation(\"Product_Charges\")\n variants ProductVariant[] @relation(\"Product_Variant\")\n brand ProductBrand? @relation(\"Product_Brand\", fields: [brandId], references: [id], onUpdate: NoAction)\n category ProductCategory? @relation(\"Product_Category\", fields: [categoryId], references: [id], onUpdate: NoAction)\n purchaseReceiptItems PurchaseReceiptItem[] @relation(\"Product_PurchaseReceiptItems\")\n salesInvoiceItems SalesInvoiceItem[] @relation(\"Product_SalesInvoiceItems\")\n stockAdjustments StockAdjustment[] @relation(\"Product_Stock_Adjustments\")\n stockMovements StockMovement[] @relation(\"StockMovement_Product\")\n\n stockBalances StockBalance[] @relation(\"StockBalance_Product\")\n\n @@index([brandId], map: \"Products_brandId_fkey\")\n @@index([categoryId], map: \"Products_categoryId_fkey\")\n @@map(\"Products\")\n}\n\nmodel ProductBrand {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Brand\")\n\n @@map(\"Product_brands\")\n}\n\nmodel ProductCategory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Category\")\n\n @@map(\"Product_categories\")\n}\n\nmodel Supplier {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productCharges ProductCharge[] @relation(\"Supplier_Product_Charges\")\n purchaseReceipts PurchaseReceipt[]\n stockMovements StockMovement[] @relation(\"StockMovement_Supplier\")\n\n @@map(\"Suppliers\")\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n orders Order[] @relation(\"Customer_Orders\")\n salesInvoices SalesInvoice[] @relation(\"Customer_Sales_Invoices\")\n stockMovements StockMovement[] @relation(\"StockMovement_Customer\")\n\n @@map(\"Customers\")\n}\n\nmodel Inventory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n isPointOfSale Boolean @default(false)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n inventoryTransfersFrom InventoryTransfer[] @relation(\"Inventory_From\")\n inventoryTransfersTo InventoryTransfer[] @relation(\"Inventory_To\")\n productCharges ProductCharge[] @relation(\"Inventory_Product_Charges\")\n purchaseReceipts PurchaseReceipt[]\n stockAdjustments StockAdjustment[] @relation(\"Inventory_Stock_Adjustments\")\n stockMovements StockMovement[] @relation(\"StockMovement_Inventory\")\n counterStockMovements StockMovement[] @relation(\"StockMovement_CounterInventory\")\n stockBalances StockBalance[] @relation(\"StockBalance_inventory\")\n salesInvoices SalesInvoice[] @relation(\"Inventory_SalesInvoices\")\n\n @@map(\"Inventories\")\n}\n\nmodel Store {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n @@map(\"Stores\")\n}\n\nmodel ProductCharge {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalAmount Decimal @db.Decimal(10, 2)\n isSettled Boolean @default(false)\n buyAt DateTime? @db.Timestamp(0)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n productId Int\n inventoryId Int\n supplierId Int\n inventory Inventory @relation(\"Inventory_Product_Charges\", fields: [inventoryId], references: [id], onUpdate: NoAction)\n product Product @relation(\"Product_Charges\", fields: [productId], references: [id], onUpdate: NoAction)\n supplier Supplier @relation(\"Supplier_Product_Charges\", fields: [supplierId], references: [id], onUpdate: NoAction)\n\n @@index([inventoryId], map: \"Product_Charges_inventoryId_fkey\")\n @@index([productId], map: \"Product_Charges_productId_fkey\")\n @@index([supplierId], map: \"Product_Charges_supplierId_fkey\")\n @@map(\"Product_Charges\")\n}\n\nmodel Order {\n id Int @id @default(autoincrement())\n orderNumber String @unique @db.VarChar(100)\n status OrderStatus @default(pending)\n paymentMethod paymentMethod @default(card)\n totalAmount Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n customerId Int\n customer Customer @relation(\"Customer_Orders\", fields: [customerId], references: [id], onUpdate: NoAction)\n\n @@index([customerId], map: \"Orders_customerId_fkey\")\n @@map(\"Orders\")\n}\n\nmodel PurchaseReceipt {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n supplierId Int\n inventoryId Int\n items PurchaseReceiptItem[] @relation(\"PurchaseReceipt_Items\")\n inventory Inventory @relation(fields: [inventoryId], references: [id])\n supplier Supplier @relation(fields: [supplierId], references: [id])\n\n @@index([inventoryId], map: \"Purchase_Receipts_inventoryId_fkey\")\n @@index([supplierId], map: \"Purchase_Receipts_supplierId_fkey\")\n @@map(\"Purchase_Receipts\")\n}\n\nmodel PurchaseReceiptItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n total Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n receiptId Int\n productId Int\n receipt PurchaseReceipt @relation(\"PurchaseReceipt_Items\", fields: [receiptId], references: [id])\n product Product @relation(\"Product_PurchaseReceiptItems\", fields: [productId], references: [id])\n\n @@index([productId], map: \"Purchase_Receipt_Items_productId_fkey\")\n @@index([receiptId], map: \"Purchase_Receipt_Items_receiptId_fkey\")\n @@map(\"Purchase_Receipt_Items\")\n}\n\nmodel SalesInvoice {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(10, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n customerId Int?\n inventoryId Int\n items SalesInvoiceItem[] @relation(\"SalesInvoice_Items\")\n customer Customer? @relation(\"Customer_Sales_Invoices\", fields: [customerId], references: [id])\n inventory Inventory @relation(\"Inventory_SalesInvoices\", fields: [inventoryId], references: [id])\n\n @@index([inventoryId], map: \"Sales_Invoices_inventoryId_fkey\")\n @@index([customerId], map: \"Sales_Invoices_customerId_fkey\")\n @@map(\"Sales_Invoices\")\n}\n\nmodel SalesInvoiceItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n total Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n invoiceId Int\n productId Int\n invoice SalesInvoice @relation(\"SalesInvoice_Items\", fields: [invoiceId], references: [id])\n product Product @relation(\"Product_SalesInvoiceItems\", fields: [productId], references: [id])\n\n @@index([invoiceId], map: \"Sales_Invoice_Items_invoiceId_fkey\")\n @@index([productId], map: \"Sales_Invoice_Items_productId_fkey\")\n @@map(\"Sales_Invoice_Items\")\n}\n\nmodel StockMovement {\n id Int @id @default(autoincrement())\n type MovementType\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n referenceType MovementReferenceType\n referenceId String\n createdAt DateTime @default(now()) @db.Timestamp(0)\n productId Int\n inventoryId Int\n avgCost Decimal @db.Decimal(10, 2)\n remainedInStock Decimal @default(0) @db.Decimal(10, 2)\n inventory Inventory @relation(\"StockMovement_Inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockMovement_Product\", fields: [productId], references: [id])\n supplierId Int?\n supplier Supplier? @relation(\"StockMovement_Supplier\", fields: [supplierId], references: [id])\n customerId Int?\n customer Customer? @relation(\"StockMovement_Customer\", fields: [customerId], references: [id])\n counterInventoryId Int?\n counterInventory Inventory? @relation(\"StockMovement_CounterInventory\", fields: [counterInventoryId], references: [id])\n\n @@index([inventoryId], map: \"Stock_Movements_inventoryId_fkey\")\n @@index([productId], map: \"Stock_Movements_productId_fkey\")\n @@map(\"Stock_Movements\")\n}\n\nmodel StockBalance {\n id Int @id @default(autoincrement())\n\n productId Int\n inventoryId Int\n\n quantity Decimal @default(0) @db.Decimal(14, 3)\n\n avgCost Decimal @default(0) @db.Decimal(14, 2)\n totalCost Decimal @default(0) @db.Decimal(14, 2)\n\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n\n product Product @relation(\"StockBalance_Product\", fields: [productId], references: [id])\n inventory Inventory @relation(\"StockBalance_inventory\", fields: [inventoryId], references: [id])\n\n @@unique([productId, inventoryId])\n @@index([productId])\n @@index([inventoryId])\n @@map(\"Stock_Balance\")\n}\n\nmodel OtpCode {\n id Int @id @default(autoincrement())\n mobileNumber String @db.VarChar(20)\n code String @db.VarChar(10)\n used Boolean @default(false)\n expiresAt DateTime @db.Timestamp(0)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@index([mobileNumber])\n @@map(\"Otp_Codes\")\n}\n\nmodel RefreshToken {\n id Int @id @default(autoincrement())\n tokenHash String @db.VarChar(255)\n userId Int\n revoked Boolean @default(false)\n expiresAt DateTime @db.Timestamp(0)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n user User @relation(fields: [userId], references: [id])\n\n @@index([userId])\n @@map(\"Refresh_Tokens\")\n}\n\nmodel InventoryTransfer {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n fromInventoryId Int\n toInventoryId Int\n items InventoryTransferItem[] @relation(\"InventoryTransfer_Items\")\n fromInventory Inventory @relation(\"Inventory_From\", fields: [fromInventoryId], references: [id])\n toInventory Inventory @relation(\"Inventory_To\", fields: [toInventoryId], references: [id])\n\n @@index([fromInventoryId], map: \"Inventory_Transfers_fromInventoryId_fkey\")\n @@index([toInventoryId], map: \"Inventory_Transfers_toInventoryId_fkey\")\n @@map(\"Inventory_Transfers\")\n}\n\nmodel InventoryTransferItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 2)\n productId Int\n transferId Int\n product Product @relation(\"InventoryTransferItem_Product\", fields: [productId], references: [id])\n transfer InventoryTransfer @relation(\"InventoryTransfer_Items\", fields: [transferId], references: [id])\n\n @@index([productId], map: \"Inventory_Transfer_Items_productId_fkey\")\n @@index([transferId], map: \"Inventory_Transfer_Items_transferId_fkey\")\n @@map(\"Inventory_Transfer_Items\")\n}\n\nmodel StockAdjustment {\n id Int @id @default(autoincrement())\n adjustedQuantity Decimal @db.Decimal(10, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n productId Int\n inventoryId Int\n inventory Inventory @relation(\"Inventory_Stock_Adjustments\", fields: [inventoryId], references: [id])\n product Product @relation(\"Product_Stock_Adjustments\", fields: [productId], references: [id])\n\n @@index([inventoryId], map: \"Stock_Adjustments_inventoryId_fkey\")\n @@index([productId], map: \"Stock_Adjustments_productId_fkey\")\n @@map(\"Stock_Adjustments\")\n}\n\nview StockMovements_View {\n id Int @default(0)\n productId Int\n type stock_movements_view_type\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n referenceId String\n referenceType stock_movements_view_referenceType\n createdAt DateTime @default(now()) @db.Timestamp(0)\n current_stock Decimal?\n current_avg_cost Decimal?\n\n @@map(\"Stock_Movements_View\")\n @@ignore\n}\n\nview inventory_overview {\n ProductId Int\n stock_quantity Decimal\n avgCost Decimal\n totalCost Decimal\n updatedAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Inventory_Overview\")\n}\n\nview stock_cardex {\n productId Int\n movement_id Int @default(0)\n type stock_cardex_type\n quantity Decimal @db.Decimal(10, 2)\n fee Decimal @db.Decimal(10, 2)\n totalCost Decimal @db.Decimal(10, 2)\n balance_quantity Decimal?\n balance_avg_cost Decimal?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Stock_Cardex\")\n}\n\nview stock_view {\n productId Int\n inventoryId Int\n stock Decimal? @db.Decimal(32, 2)\n\n @@map(\"Stock_View\")\n}\n\nenum OrderStatus {\n pending\n reject\n done\n}\n\nenum paymentMethod {\n cash\n card\n}\n\nenum MovementType {\n IN\n OUT\n ADJUST\n}\n\nenum MovementReferenceType {\n PURCHASE\n SALES\n ADJUSTMENT\n INVENTORY_TRANSFER\n}\n\nenum stock_cardex_type {\n IN\n OUT\n ADJUST\n}\n\nenum stock_movements_view_type {\n IN\n OUT\n ADJUST\n}\n\nenum stock_movements_view_referenceType {\n PURCHASE\n SALES\n ADJUSTMENT\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n name String @db.Text\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n @@map(\"Trigger_Logs\")\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -30,7 +30,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"},{\"name\":\"refreshTokens\",\"kind\":\"object\",\"type\":\"RefreshToken\",\"relationName\":\"RefreshTokenToUser\"}],\"dbName\":\"Users\"},\"Role\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"permissions\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"User_Role\"}],\"dbName\":\"Roles\"},\"ProductVariant\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"unit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"alertQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isFeatured\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Variant\"}],\"dbName\":\"Product_Variants\"},\"Product\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryTransferItems\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransferItem_Product\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Product_Charges\"},{\"name\":\"variants\",\"kind\":\"object\",\"type\":\"ProductVariant\",\"relationName\":\"Product_Variant\"},{\"name\":\"brand\",\"kind\":\"object\",\"type\":\"ProductBrand\",\"relationName\":\"Product_Brand\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProductCategory\",\"relationName\":\"Product_Category\"},{\"name\":\"purchaseReceiptItems\",\"kind\":\"object\",\"type\":\"PurchaseReceiptItem\",\"relationName\":\"Product_PurchaseReceiptItems\"},{\"name\":\"salesInvoiceItems\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"Product_SalesInvoiceItems\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Product_Stock_Adjustments\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_Product\"}],\"dbName\":\"Products\"},\"ProductBrand\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Brand\"}],\"dbName\":\"Product_brands\"},\"ProductCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Category\"}],\"dbName\":\"Product_categories\"},\"Supplier\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Supplier_Product_Charges\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToSupplier\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Supplier\"}],\"dbName\":\"Suppliers\"},\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"orders\",\"kind\":\"object\",\"type\":\"Order\",\"relationName\":\"Customer_Orders\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Customer_Sales_Invoices\"}],\"dbName\":\"Customers\"},\"Inventory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isPointOfSale\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"inventoryTransfersFrom\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_From\"},{\"name\":\"inventoryTransfersTo\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_To\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Inventory_Product_Charges\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Inventory_SalesInvoices\"}],\"dbName\":\"Inventories\"},\"Store\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stores\"},\"ProductCharge\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isSettled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"buyAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_Product_Charges\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Charges\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"Supplier_Product_Charges\"}],\"dbName\":\"Product_Charges\"},\"Order\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"OrderStatus\"},{\"name\":\"paymentMethod\",\"kind\":\"enum\",\"type\":\"paymentMethod\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"Customer_Orders\"}],\"dbName\":\"Orders\"},\"PurchaseReceipt\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"PurchaseReceiptItem\",\"relationName\":\"PurchaseReceipt_Items\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"PurchaseReceiptToSupplier\"}],\"dbName\":\"Purchase_Receipts\"},\"PurchaseReceiptItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceipt_Items\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_PurchaseReceiptItems\"}],\"dbName\":\"Purchase_Receipt_Items\"},\"SalesInvoice\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"Customer_Sales_Invoices\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_SalesInvoices\"}],\"dbName\":\"Sales_Invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoiceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_SalesInvoiceItems\"}],\"dbName\":\"Sales_Invoice_Items\"},\"StockMovement\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"MovementType\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"referenceType\",\"kind\":\"enum\",\"type\":\"MovementReferenceType\"},{\"name\":\"referenceId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"remainedInStock\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"StockMovement_Supplier\"}],\"dbName\":\"Stock_Movements\"},\"StockBalance\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockBalance_Product\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockBalance_inventory\"}],\"dbName\":\"Stock_Balance\"},\"OtpCode\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"used\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Otp_Codes\"},\"RefreshToken\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"tokenHash\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"revoked\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"RefreshTokenToUser\"}],\"dbName\":\"Refresh_Tokens\"},\"InventoryTransfer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"fromInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"toInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransfer_Items\"},{\"name\":\"fromInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_From\"},{\"name\":\"toInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_To\"}],\"dbName\":\"Inventory_Transfers\"},\"InventoryTransferItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"transferId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"InventoryTransferItem_Product\"},{\"name\":\"transfer\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"InventoryTransfer_Items\"}],\"dbName\":\"Inventory_Transfer_Items\"},\"StockAdjustment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"adjustedQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Stock_Adjustments\"}],\"dbName\":\"Stock_Adjustments\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Trigger_Logs\"},\"inventory_overview\":{\"fields\":[{\"name\":\"ProductId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stock_quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Inventory_Overview\"},\"stock_cardex\":{\"fields\":[{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"movement_id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"stock_cardex_type\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance_quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance_avg_cost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stock_Cardex\"},\"stock_view\":{\"fields\":[{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stock\",\"kind\":\"scalar\",\"type\":\"Decimal\"}],\"dbName\":\"Stock_View\"}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"},{\"name\":\"refreshTokens\",\"kind\":\"object\",\"type\":\"RefreshToken\",\"relationName\":\"RefreshTokenToUser\"}],\"dbName\":\"Users\"},\"Role\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"permissions\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"User_Role\"}],\"dbName\":\"Roles\"},\"ProductVariant\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"unit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"alertQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isFeatured\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Variant\"}],\"dbName\":\"Product_Variants\"},\"Product\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryTransferItems\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransferItem_Product\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Product_Charges\"},{\"name\":\"variants\",\"kind\":\"object\",\"type\":\"ProductVariant\",\"relationName\":\"Product_Variant\"},{\"name\":\"brand\",\"kind\":\"object\",\"type\":\"ProductBrand\",\"relationName\":\"Product_Brand\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProductCategory\",\"relationName\":\"Product_Category\"},{\"name\":\"purchaseReceiptItems\",\"kind\":\"object\",\"type\":\"PurchaseReceiptItem\",\"relationName\":\"Product_PurchaseReceiptItems\"},{\"name\":\"salesInvoiceItems\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"Product_SalesInvoiceItems\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Product_Stock_Adjustments\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_Product\"}],\"dbName\":\"Products\"},\"ProductBrand\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Brand\"}],\"dbName\":\"Product_brands\"},\"ProductCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Category\"}],\"dbName\":\"Product_categories\"},\"Supplier\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Supplier_Product_Charges\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToSupplier\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Supplier\"}],\"dbName\":\"Suppliers\"},\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"orders\",\"kind\":\"object\",\"type\":\"Order\",\"relationName\":\"Customer_Orders\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Customer_Sales_Invoices\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Customer\"}],\"dbName\":\"Customers\"},\"Inventory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isPointOfSale\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"inventoryTransfersFrom\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_From\"},{\"name\":\"inventoryTransfersTo\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_To\"},{\"name\":\"productCharges\",\"kind\":\"object\",\"type\":\"ProductCharge\",\"relationName\":\"Inventory_Product_Charges\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"counterStockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_CounterInventory\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Inventory_SalesInvoices\"}],\"dbName\":\"Inventories\"},\"Store\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stores\"},\"ProductCharge\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isSettled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"buyAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_Product_Charges\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Charges\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"Supplier_Product_Charges\"}],\"dbName\":\"Product_Charges\"},\"Order\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"OrderStatus\"},{\"name\":\"paymentMethod\",\"kind\":\"enum\",\"type\":\"paymentMethod\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"Customer_Orders\"}],\"dbName\":\"Orders\"},\"PurchaseReceipt\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"PurchaseReceiptItem\",\"relationName\":\"PurchaseReceipt_Items\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"PurchaseReceiptToSupplier\"}],\"dbName\":\"Purchase_Receipts\"},\"PurchaseReceiptItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceipt_Items\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_PurchaseReceiptItems\"}],\"dbName\":\"Purchase_Receipt_Items\"},\"SalesInvoice\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"Customer_Sales_Invoices\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_SalesInvoices\"}],\"dbName\":\"Sales_Invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoiceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_SalesInvoiceItems\"}],\"dbName\":\"Sales_Invoice_Items\"},\"StockMovement\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"MovementType\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"referenceType\",\"kind\":\"enum\",\"type\":\"MovementReferenceType\"},{\"name\":\"referenceId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"remainedInStock\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"StockMovement_Supplier\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"StockMovement_Customer\"},{\"name\":\"counterInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"counterInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_CounterInventory\"}],\"dbName\":\"Stock_Movements\"},\"StockBalance\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockBalance_Product\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockBalance_inventory\"}],\"dbName\":\"Stock_Balance\"},\"OtpCode\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"used\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Otp_Codes\"},\"RefreshToken\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"tokenHash\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"revoked\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"RefreshTokenToUser\"}],\"dbName\":\"Refresh_Tokens\"},\"InventoryTransfer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"fromInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"toInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransfer_Items\"},{\"name\":\"fromInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_From\"},{\"name\":\"toInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_To\"}],\"dbName\":\"Inventory_Transfers\"},\"InventoryTransferItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"transferId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"InventoryTransferItem_Product\"},{\"name\":\"transfer\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"InventoryTransfer_Items\"}],\"dbName\":\"Inventory_Transfer_Items\"},\"StockAdjustment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"adjustedQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Stock_Adjustments\"}],\"dbName\":\"Stock_Adjustments\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Trigger_Logs\"},\"inventory_overview\":{\"fields\":[{\"name\":\"ProductId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stock_quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Inventory_Overview\"},\"stock_cardex\":{\"fields\":[{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"movement_id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"stock_cardex_type\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance_quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance_avg_cost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stock_Cardex\"},\"stock_view\":{\"fields\":[{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stock\",\"kind\":\"scalar\",\"type\":\"Decimal\"}],\"dbName\":\"Stock_View\"}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') diff --git a/src/generated/prisma/internal/prismaNamespace.ts b/src/generated/prisma/internal/prismaNamespace.ts index d651bba..f3f923d 100644 --- a/src/generated/prisma/internal/prismaNamespace.ts +++ b/src/generated/prisma/internal/prismaNamespace.ts @@ -2403,7 +2403,9 @@ export const StockMovementScalarFieldEnum = { inventoryId: 'inventoryId', avgCost: 'avgCost', remainedInStock: 'remainedInStock', - supplierId: 'supplierId' + supplierId: 'supplierId', + customerId: 'customerId', + counterInventoryId: 'counterInventoryId' } as const export type StockMovementScalarFieldEnum = (typeof StockMovementScalarFieldEnum)[keyof typeof StockMovementScalarFieldEnum] diff --git a/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/generated/prisma/internal/prismaNamespaceBrowser.ts index 107d2a3..dad0b10 100644 --- a/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -356,7 +356,9 @@ export const StockMovementScalarFieldEnum = { inventoryId: 'inventoryId', avgCost: 'avgCost', remainedInStock: 'remainedInStock', - supplierId: 'supplierId' + supplierId: 'supplierId', + customerId: 'customerId', + counterInventoryId: 'counterInventoryId' } as const export type StockMovementScalarFieldEnum = (typeof StockMovementScalarFieldEnum)[keyof typeof StockMovementScalarFieldEnum] diff --git a/src/generated/prisma/models/Customer.ts b/src/generated/prisma/models/Customer.ts index 3cedab8..fe807db 100644 --- a/src/generated/prisma/models/Customer.ts +++ b/src/generated/prisma/models/Customer.ts @@ -282,6 +282,7 @@ export type CustomerWhereInput = { deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null orders?: Prisma.OrderListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter + stockMovements?: Prisma.StockMovementListRelationFilter } export type CustomerOrderByWithRelationInput = { @@ -300,6 +301,7 @@ export type CustomerOrderByWithRelationInput = { deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder orders?: Prisma.OrderOrderByRelationAggregateInput salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput + stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput _relevance?: Prisma.CustomerOrderByRelevanceInput } @@ -322,6 +324,7 @@ export type CustomerWhereUniqueInput = Prisma.AtLeast<{ deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null orders?: Prisma.OrderListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter + stockMovements?: Prisma.StockMovementListRelationFilter }, "id" | "mobileNumber"> export type CustomerOrderByWithAggregationInput = { @@ -379,6 +382,7 @@ export type CustomerCreateInput = { deletedAt?: Date | string | null orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutCustomerInput } export type CustomerUncheckedCreateInput = { @@ -397,6 +401,7 @@ export type CustomerUncheckedCreateInput = { deletedAt?: Date | string | null orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCustomerInput } export type CustomerUpdateInput = { @@ -414,6 +419,7 @@ export type CustomerUpdateInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutCustomerNestedInput } export type CustomerUncheckedUpdateInput = { @@ -432,6 +438,7 @@ export type CustomerUncheckedUpdateInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCustomerNestedInput } export type CustomerCreateManyInput = { @@ -583,6 +590,22 @@ export type CustomerUpdateOneWithoutSalesInvoicesNestedInput = { update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutSalesInvoicesInput> } +export type CustomerCreateNestedOneWithoutStockMovementsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutStockMovementsInput + connect?: Prisma.CustomerWhereUniqueInput +} + +export type CustomerUpdateOneWithoutStockMovementsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutStockMovementsInput + upsert?: Prisma.CustomerUpsertWithoutStockMovementsInput + disconnect?: Prisma.CustomerWhereInput | boolean + delete?: Prisma.CustomerWhereInput | boolean + connect?: Prisma.CustomerWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutStockMovementsInput> +} + export type CustomerCreateWithoutOrdersInput = { firstName: string lastName: string @@ -597,6 +620,7 @@ export type CustomerCreateWithoutOrdersInput = { updatedAt?: Date | string deletedAt?: Date | string | null salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutCustomerInput } export type CustomerUncheckedCreateWithoutOrdersInput = { @@ -614,6 +638,7 @@ export type CustomerUncheckedCreateWithoutOrdersInput = { updatedAt?: Date | string deletedAt?: Date | string | null salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCustomerInput } export type CustomerCreateOrConnectWithoutOrdersInput = { @@ -646,6 +671,7 @@ export type CustomerUpdateWithoutOrdersInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutCustomerNestedInput } export type CustomerUncheckedUpdateWithoutOrdersInput = { @@ -663,6 +689,7 @@ export type CustomerUncheckedUpdateWithoutOrdersInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCustomerNestedInput } export type CustomerCreateWithoutSalesInvoicesInput = { @@ -679,6 +706,7 @@ export type CustomerCreateWithoutSalesInvoicesInput = { updatedAt?: Date | string deletedAt?: Date | string | null orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutCustomerInput } export type CustomerUncheckedCreateWithoutSalesInvoicesInput = { @@ -696,6 +724,7 @@ export type CustomerUncheckedCreateWithoutSalesInvoicesInput = { updatedAt?: Date | string deletedAt?: Date | string | null orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCustomerInput } export type CustomerCreateOrConnectWithoutSalesInvoicesInput = { @@ -728,6 +757,7 @@ export type CustomerUpdateWithoutSalesInvoicesInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutCustomerNestedInput } export type CustomerUncheckedUpdateWithoutSalesInvoicesInput = { @@ -745,6 +775,93 @@ export type CustomerUncheckedUpdateWithoutSalesInvoicesInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCustomerNestedInput +} + +export type CustomerCreateWithoutStockMovementsInput = { + firstName: string + lastName: string + email?: string | null + mobileNumber: string + address?: string | null + city?: string | null + state?: string | null + country?: string | null + isActive?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput +} + +export type CustomerUncheckedCreateWithoutStockMovementsInput = { + id?: number + firstName: string + lastName: string + email?: string | null + mobileNumber: string + address?: string | null + city?: string | null + state?: string | null + country?: string | null + isActive?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput +} + +export type CustomerCreateOrConnectWithoutStockMovementsInput = { + where: Prisma.CustomerWhereUniqueInput + create: Prisma.XOR +} + +export type CustomerUpsertWithoutStockMovementsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.CustomerWhereInput +} + +export type CustomerUpdateToOneWithWhereWithoutStockMovementsInput = { + where?: Prisma.CustomerWhereInput + data: Prisma.XOR +} + +export type CustomerUpdateWithoutStockMovementsInput = { + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string + address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput +} + +export type CustomerUncheckedUpdateWithoutStockMovementsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string + address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput } @@ -755,11 +872,13 @@ export type CustomerUncheckedUpdateWithoutSalesInvoicesInput = { export type CustomerCountOutputType = { orders: number salesInvoices: number + stockMovements: number } export type CustomerCountOutputTypeSelect = { orders?: boolean | CustomerCountOutputTypeCountOrdersArgs salesInvoices?: boolean | CustomerCountOutputTypeCountSalesInvoicesArgs + stockMovements?: boolean | CustomerCountOutputTypeCountStockMovementsArgs } /** @@ -786,6 +905,13 @@ export type CustomerCountOutputTypeCountSalesInvoicesArgs = { + where?: Prisma.StockMovementWhereInput +} + export type CustomerSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -803,6 +929,7 @@ export type CustomerSelect salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs + stockMovements?: boolean | Prisma.Customer$stockMovementsArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs }, ExtArgs["result"]["customer"]> @@ -828,6 +955,7 @@ export type CustomerOmit = { orders?: boolean | Prisma.Customer$ordersArgs salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs + stockMovements?: boolean | Prisma.Customer$stockMovementsArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs } @@ -836,6 +964,7 @@ export type $CustomerPayload[] salesInvoices: Prisma.$SalesInvoicePayload[] + stockMovements: Prisma.$StockMovementPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1193,6 +1322,7 @@ export interface Prisma__CustomerClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> salesInvoices = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + stockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1625,6 +1755,30 @@ export type Customer$salesInvoicesArgs = { + /** + * Select specific fields to fetch from the StockMovement + */ + select?: Prisma.StockMovementSelect | null + /** + * Omit specific fields from the StockMovement + */ + omit?: Prisma.StockMovementOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockMovementInclude | null + where?: Prisma.StockMovementWhereInput + orderBy?: Prisma.StockMovementOrderByWithRelationInput | Prisma.StockMovementOrderByWithRelationInput[] + cursor?: Prisma.StockMovementWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.StockMovementScalarFieldEnum | Prisma.StockMovementScalarFieldEnum[] +} + /** * Customer without action */ diff --git a/src/generated/prisma/models/Inventory.ts b/src/generated/prisma/models/Inventory.ts index 7e31e71..241fccb 100644 --- a/src/generated/prisma/models/Inventory.ts +++ b/src/generated/prisma/models/Inventory.ts @@ -246,6 +246,7 @@ export type InventoryWhereInput = { purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + counterStockMovements?: Prisma.StockMovementListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter } @@ -265,6 +266,7 @@ export type InventoryOrderByWithRelationInput = { purchaseReceipts?: Prisma.PurchaseReceiptOrderByRelationAggregateInput stockAdjustments?: Prisma.StockAdjustmentOrderByRelationAggregateInput stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput + counterStockMovements?: Prisma.StockMovementOrderByRelationAggregateInput stockBalances?: Prisma.StockBalanceOrderByRelationAggregateInput salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput _relevance?: Prisma.InventoryOrderByRelevanceInput @@ -288,6 +290,7 @@ export type InventoryWhereUniqueInput = Prisma.AtLeast<{ purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + counterStockMovements?: Prisma.StockMovementListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter }, "id"> @@ -336,6 +339,7 @@ export type InventoryCreateInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -355,6 +359,7 @@ export type InventoryUncheckedCreateInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -373,6 +378,7 @@ export type InventoryUpdateInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -392,6 +398,7 @@ export type InventoryUncheckedUpdateInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -480,6 +487,11 @@ export type InventoryScalarRelationFilter = { isNot?: Prisma.InventoryWhereInput } +export type InventoryNullableScalarRelationFilter = { + is?: Prisma.InventoryWhereInput | null + isNot?: Prisma.InventoryWhereInput | null +} + export type InventoryCreateNestedOneWithoutProductChargesInput = { create?: Prisma.XOR connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutProductChargesInput @@ -528,6 +540,12 @@ export type InventoryCreateNestedOneWithoutStockMovementsInput = { connect?: Prisma.InventoryWhereUniqueInput } +export type InventoryCreateNestedOneWithoutCounterStockMovementsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutCounterStockMovementsInput + connect?: Prisma.InventoryWhereUniqueInput +} + export type InventoryUpdateOneRequiredWithoutStockMovementsNestedInput = { create?: Prisma.XOR connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutStockMovementsInput @@ -536,6 +554,16 @@ export type InventoryUpdateOneRequiredWithoutStockMovementsNestedInput = { update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutStockMovementsInput> } +export type InventoryUpdateOneWithoutCounterStockMovementsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutCounterStockMovementsInput + upsert?: Prisma.InventoryUpsertWithoutCounterStockMovementsInput + disconnect?: Prisma.InventoryWhereInput | boolean + delete?: Prisma.InventoryWhereInput | boolean + connect?: Prisma.InventoryWhereUniqueInput + update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutCounterStockMovementsInput> +} + export type InventoryCreateNestedOneWithoutStockBalancesInput = { create?: Prisma.XOR connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutStockBalancesInput @@ -605,6 +633,7 @@ export type InventoryCreateWithoutProductChargesInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -623,6 +652,7 @@ export type InventoryUncheckedCreateWithoutProductChargesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -656,6 +686,7 @@ export type InventoryUpdateWithoutProductChargesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -674,6 +705,7 @@ export type InventoryUncheckedUpdateWithoutProductChargesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -691,6 +723,7 @@ export type InventoryCreateWithoutPurchaseReceiptsInput = { productCharges?: Prisma.ProductChargeCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -709,6 +742,7 @@ export type InventoryUncheckedCreateWithoutPurchaseReceiptsInput = { productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -742,6 +776,7 @@ export type InventoryUpdateWithoutPurchaseReceiptsInput = { productCharges?: Prisma.ProductChargeUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -760,6 +795,7 @@ export type InventoryUncheckedUpdateWithoutPurchaseReceiptsInput = { productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -778,6 +814,7 @@ export type InventoryCreateWithoutSalesInvoicesInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput } @@ -796,6 +833,7 @@ export type InventoryUncheckedCreateWithoutSalesInvoicesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput } @@ -829,6 +867,7 @@ export type InventoryUpdateWithoutSalesInvoicesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput } @@ -847,6 +886,7 @@ export type InventoryUncheckedUpdateWithoutSalesInvoicesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -863,6 +903,7 @@ export type InventoryCreateWithoutStockMovementsInput = { productCharges?: Prisma.ProductChargeCreateNestedManyWithoutInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -881,6 +922,7 @@ export type InventoryUncheckedCreateWithoutStockMovementsInput = { productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -890,6 +932,48 @@ export type InventoryCreateOrConnectWithoutStockMovementsInput = { create: Prisma.XOR } +export type InventoryCreateWithoutCounterStockMovementsInput = { + name: string + location?: string | null + isActive?: boolean + isPointOfSale?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput + inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput + productCharges?: Prisma.ProductChargeCreateNestedManyWithoutInventoryInput + purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput + stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput +} + +export type InventoryUncheckedCreateWithoutCounterStockMovementsInput = { + id?: number + name: string + location?: string | null + isActive?: boolean + isPointOfSale?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput + inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput + productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutInventoryInput + purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput +} + +export type InventoryCreateOrConnectWithoutCounterStockMovementsInput = { + where: Prisma.InventoryWhereUniqueInput + create: Prisma.XOR +} + export type InventoryUpsertWithoutStockMovementsInput = { update: Prisma.XOR create: Prisma.XOR @@ -914,6 +998,7 @@ export type InventoryUpdateWithoutStockMovementsInput = { productCharges?: Prisma.ProductChargeUpdateManyWithoutInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -932,6 +1017,55 @@ export type InventoryUncheckedUpdateWithoutStockMovementsInput = { productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput + stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput +} + +export type InventoryUpsertWithoutCounterStockMovementsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.InventoryWhereInput +} + +export type InventoryUpdateToOneWithWhereWithoutCounterStockMovementsInput = { + where?: Prisma.InventoryWhereInput + data: Prisma.XOR +} + +export type InventoryUpdateWithoutCounterStockMovementsInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput + inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput + productCharges?: Prisma.ProductChargeUpdateManyWithoutInventoryNestedInput + purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput + stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput +} + +export type InventoryUncheckedUpdateWithoutCounterStockMovementsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput + inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput + productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutInventoryNestedInput + purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -950,6 +1084,7 @@ export type InventoryCreateWithoutStockBalancesInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -968,6 +1103,7 @@ export type InventoryUncheckedCreateWithoutStockBalancesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -1001,6 +1137,7 @@ export type InventoryUpdateWithoutStockBalancesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -1019,6 +1156,7 @@ export type InventoryUncheckedUpdateWithoutStockBalancesInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -1035,6 +1173,7 @@ export type InventoryCreateWithoutInventoryTransfersFromInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -1053,6 +1192,7 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersFromInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -1075,6 +1215,7 @@ export type InventoryCreateWithoutInventoryTransfersToInput = { purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -1093,6 +1234,7 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersToInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -1126,6 +1268,7 @@ export type InventoryUpdateWithoutInventoryTransfersFromInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -1144,6 +1287,7 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersFromInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -1172,6 +1316,7 @@ export type InventoryUpdateWithoutInventoryTransfersToInput = { purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -1190,6 +1335,7 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersToInput = { purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -1207,6 +1353,7 @@ export type InventoryCreateWithoutStockAdjustmentsInput = { productCharges?: Prisma.ProductChargeCreateNestedManyWithoutInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput } @@ -1225,6 +1372,7 @@ export type InventoryUncheckedCreateWithoutStockAdjustmentsInput = { productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput } @@ -1258,6 +1406,7 @@ export type InventoryUpdateWithoutStockAdjustmentsInput = { productCharges?: Prisma.ProductChargeUpdateManyWithoutInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput } @@ -1276,6 +1425,7 @@ export type InventoryUncheckedUpdateWithoutStockAdjustmentsInput = { productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput } @@ -1292,6 +1442,7 @@ export type InventoryCountOutputType = { purchaseReceipts: number stockAdjustments: number stockMovements: number + counterStockMovements: number stockBalances: number salesInvoices: number } @@ -1303,6 +1454,7 @@ export type InventoryCountOutputTypeSelect = { + where?: Prisma.StockMovementWhereInput +} + /** * InventoryCountOutputType without action */ @@ -1389,6 +1548,7 @@ export type InventorySelect stockAdjustments?: boolean | Prisma.Inventory$stockAdjustmentsArgs stockMovements?: boolean | Prisma.Inventory$stockMovementsArgs + counterStockMovements?: boolean | Prisma.Inventory$counterStockMovementsArgs stockBalances?: boolean | Prisma.Inventory$stockBalancesArgs salesInvoices?: boolean | Prisma.Inventory$salesInvoicesArgs _count?: boolean | Prisma.InventoryCountOutputTypeDefaultArgs @@ -1415,6 +1575,7 @@ export type InventoryInclude stockAdjustments?: boolean | Prisma.Inventory$stockAdjustmentsArgs stockMovements?: boolean | Prisma.Inventory$stockMovementsArgs + counterStockMovements?: boolean | Prisma.Inventory$counterStockMovementsArgs stockBalances?: boolean | Prisma.Inventory$stockBalancesArgs salesInvoices?: boolean | Prisma.Inventory$salesInvoicesArgs _count?: boolean | Prisma.InventoryCountOutputTypeDefaultArgs @@ -1429,6 +1590,7 @@ export type $InventoryPayload[] stockAdjustments: Prisma.$StockAdjustmentPayload[] stockMovements: Prisma.$StockMovementPayload[] + counterStockMovements: Prisma.$StockMovementPayload[] stockBalances: Prisma.$StockBalancePayload[] salesInvoices: Prisma.$SalesInvoicePayload[] } @@ -1787,6 +1949,7 @@ export interface Prisma__InventoryClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockAdjustments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + counterStockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockBalances = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> salesInvoices = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** @@ -2312,6 +2475,30 @@ export type Inventory$stockMovementsArgs = { + /** + * Select specific fields to fetch from the StockMovement + */ + select?: Prisma.StockMovementSelect | null + /** + * Omit specific fields from the StockMovement + */ + omit?: Prisma.StockMovementOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockMovementInclude | null + where?: Prisma.StockMovementWhereInput + orderBy?: Prisma.StockMovementOrderByWithRelationInput | Prisma.StockMovementOrderByWithRelationInput[] + cursor?: Prisma.StockMovementWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.StockMovementScalarFieldEnum | Prisma.StockMovementScalarFieldEnum[] +} + /** * Inventory.stockBalances */ diff --git a/src/generated/prisma/models/StockMovement.ts b/src/generated/prisma/models/StockMovement.ts index ad68358..6aff622 100644 --- a/src/generated/prisma/models/StockMovement.ts +++ b/src/generated/prisma/models/StockMovement.ts @@ -36,6 +36,8 @@ export type StockMovementAvgAggregateOutputType = { avgCost: runtime.Decimal | null remainedInStock: runtime.Decimal | null supplierId: number | null + customerId: number | null + counterInventoryId: number | null } export type StockMovementSumAggregateOutputType = { @@ -48,6 +50,8 @@ export type StockMovementSumAggregateOutputType = { avgCost: runtime.Decimal | null remainedInStock: runtime.Decimal | null supplierId: number | null + customerId: number | null + counterInventoryId: number | null } export type StockMovementMinAggregateOutputType = { @@ -64,6 +68,8 @@ export type StockMovementMinAggregateOutputType = { avgCost: runtime.Decimal | null remainedInStock: runtime.Decimal | null supplierId: number | null + customerId: number | null + counterInventoryId: number | null } export type StockMovementMaxAggregateOutputType = { @@ -80,6 +86,8 @@ export type StockMovementMaxAggregateOutputType = { avgCost: runtime.Decimal | null remainedInStock: runtime.Decimal | null supplierId: number | null + customerId: number | null + counterInventoryId: number | null } export type StockMovementCountAggregateOutputType = { @@ -96,6 +104,8 @@ export type StockMovementCountAggregateOutputType = { avgCost: number remainedInStock: number supplierId: number + customerId: number + counterInventoryId: number _all: number } @@ -110,6 +120,8 @@ export type StockMovementAvgAggregateInputType = { avgCost?: true remainedInStock?: true supplierId?: true + customerId?: true + counterInventoryId?: true } export type StockMovementSumAggregateInputType = { @@ -122,6 +134,8 @@ export type StockMovementSumAggregateInputType = { avgCost?: true remainedInStock?: true supplierId?: true + customerId?: true + counterInventoryId?: true } export type StockMovementMinAggregateInputType = { @@ -138,6 +152,8 @@ export type StockMovementMinAggregateInputType = { avgCost?: true remainedInStock?: true supplierId?: true + customerId?: true + counterInventoryId?: true } export type StockMovementMaxAggregateInputType = { @@ -154,6 +170,8 @@ export type StockMovementMaxAggregateInputType = { avgCost?: true remainedInStock?: true supplierId?: true + customerId?: true + counterInventoryId?: true } export type StockMovementCountAggregateInputType = { @@ -170,6 +188,8 @@ export type StockMovementCountAggregateInputType = { avgCost?: true remainedInStock?: true supplierId?: true + customerId?: true + counterInventoryId?: true _all?: true } @@ -273,6 +293,8 @@ export type StockMovementGroupByOutputType = { avgCost: runtime.Decimal remainedInStock: runtime.Decimal supplierId: number | null + customerId: number | null + counterInventoryId: number | null _count: StockMovementCountAggregateOutputType | null _avg: StockMovementAvgAggregateOutputType | null _sum: StockMovementSumAggregateOutputType | null @@ -312,9 +334,13 @@ export type StockMovementWhereInput = { avgCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + customerId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + counterInventoryId?: Prisma.IntNullableFilter<"StockMovement"> | number | null inventory?: Prisma.XOR product?: Prisma.XOR supplier?: Prisma.XOR | null + customer?: Prisma.XOR | null + counterInventory?: Prisma.XOR | null } export type StockMovementOrderByWithRelationInput = { @@ -331,9 +357,13 @@ export type StockMovementOrderByWithRelationInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrderInput | Prisma.SortOrder + customerId?: Prisma.SortOrderInput | Prisma.SortOrder + counterInventoryId?: Prisma.SortOrderInput | Prisma.SortOrder inventory?: Prisma.InventoryOrderByWithRelationInput product?: Prisma.ProductOrderByWithRelationInput supplier?: Prisma.SupplierOrderByWithRelationInput + customer?: Prisma.CustomerOrderByWithRelationInput + counterInventory?: Prisma.InventoryOrderByWithRelationInput _relevance?: Prisma.StockMovementOrderByRelevanceInput } @@ -354,9 +384,13 @@ export type StockMovementWhereUniqueInput = Prisma.AtLeast<{ avgCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + customerId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + counterInventoryId?: Prisma.IntNullableFilter<"StockMovement"> | number | null inventory?: Prisma.XOR product?: Prisma.XOR supplier?: Prisma.XOR | null + customer?: Prisma.XOR | null + counterInventory?: Prisma.XOR | null }, "id"> export type StockMovementOrderByWithAggregationInput = { @@ -373,6 +407,8 @@ export type StockMovementOrderByWithAggregationInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrderInput | Prisma.SortOrder + customerId?: Prisma.SortOrderInput | Prisma.SortOrder + counterInventoryId?: Prisma.SortOrderInput | Prisma.SortOrder _count?: Prisma.StockMovementCountOrderByAggregateInput _avg?: Prisma.StockMovementAvgOrderByAggregateInput _max?: Prisma.StockMovementMaxOrderByAggregateInput @@ -397,6 +433,8 @@ export type StockMovementScalarWhereWithAggregatesInput = { avgCost?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.IntNullableWithAggregatesFilter<"StockMovement"> | number | null + customerId?: Prisma.IntNullableWithAggregatesFilter<"StockMovement"> | number | null + counterInventoryId?: Prisma.IntNullableWithAggregatesFilter<"StockMovement"> | number | null } export type StockMovementCreateInput = { @@ -412,6 +450,8 @@ export type StockMovementCreateInput = { inventory: Prisma.InventoryCreateNestedOneWithoutStockMovementsInput product: Prisma.ProductCreateNestedOneWithoutStockMovementsInput supplier?: Prisma.SupplierCreateNestedOneWithoutStockMovementsInput + customer?: Prisma.CustomerCreateNestedOneWithoutStockMovementsInput + counterInventory?: Prisma.InventoryCreateNestedOneWithoutCounterStockMovementsInput } export type StockMovementUncheckedCreateInput = { @@ -428,6 +468,8 @@ export type StockMovementUncheckedCreateInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementUpdateInput = { @@ -443,6 +485,8 @@ export type StockMovementUpdateInput = { inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockMovementsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutStockMovementsNestedInput supplier?: Prisma.SupplierUpdateOneWithoutStockMovementsNestedInput + customer?: Prisma.CustomerUpdateOneWithoutStockMovementsNestedInput + counterInventory?: Prisma.InventoryUpdateOneWithoutCounterStockMovementsNestedInput } export type StockMovementUncheckedUpdateInput = { @@ -459,6 +503,8 @@ export type StockMovementUncheckedUpdateInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementCreateManyInput = { @@ -475,6 +521,8 @@ export type StockMovementCreateManyInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementUpdateManyMutationInput = { @@ -503,6 +551,8 @@ export type StockMovementUncheckedUpdateManyInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementListRelationFilter = { @@ -535,6 +585,8 @@ export type StockMovementCountOrderByAggregateInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrder + customerId?: Prisma.SortOrder + counterInventoryId?: Prisma.SortOrder } export type StockMovementAvgOrderByAggregateInput = { @@ -547,6 +599,8 @@ export type StockMovementAvgOrderByAggregateInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrder + customerId?: Prisma.SortOrder + counterInventoryId?: Prisma.SortOrder } export type StockMovementMaxOrderByAggregateInput = { @@ -563,6 +617,8 @@ export type StockMovementMaxOrderByAggregateInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrder + customerId?: Prisma.SortOrder + counterInventoryId?: Prisma.SortOrder } export type StockMovementMinOrderByAggregateInput = { @@ -579,6 +635,8 @@ export type StockMovementMinOrderByAggregateInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrder + customerId?: Prisma.SortOrder + counterInventoryId?: Prisma.SortOrder } export type StockMovementSumOrderByAggregateInput = { @@ -591,6 +649,8 @@ export type StockMovementSumOrderByAggregateInput = { avgCost?: Prisma.SortOrder remainedInStock?: Prisma.SortOrder supplierId?: Prisma.SortOrder + customerId?: Prisma.SortOrder + counterInventoryId?: Prisma.SortOrder } export type StockMovementCreateNestedManyWithoutProductInput = { @@ -677,6 +737,48 @@ export type StockMovementUncheckedUpdateManyWithoutSupplierNestedInput = { deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] } +export type StockMovementCreateNestedManyWithoutCustomerInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCustomerInput[] | Prisma.StockMovementUncheckedCreateWithoutCustomerInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCustomerInput | Prisma.StockMovementCreateOrConnectWithoutCustomerInput[] + createMany?: Prisma.StockMovementCreateManyCustomerInputEnvelope + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] +} + +export type StockMovementUncheckedCreateNestedManyWithoutCustomerInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCustomerInput[] | Prisma.StockMovementUncheckedCreateWithoutCustomerInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCustomerInput | Prisma.StockMovementCreateOrConnectWithoutCustomerInput[] + createMany?: Prisma.StockMovementCreateManyCustomerInputEnvelope + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] +} + +export type StockMovementUpdateManyWithoutCustomerNestedInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCustomerInput[] | Prisma.StockMovementUncheckedCreateWithoutCustomerInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCustomerInput | Prisma.StockMovementCreateOrConnectWithoutCustomerInput[] + upsert?: Prisma.StockMovementUpsertWithWhereUniqueWithoutCustomerInput | Prisma.StockMovementUpsertWithWhereUniqueWithoutCustomerInput[] + createMany?: Prisma.StockMovementCreateManyCustomerInputEnvelope + set?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + disconnect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + delete?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + update?: Prisma.StockMovementUpdateWithWhereUniqueWithoutCustomerInput | Prisma.StockMovementUpdateWithWhereUniqueWithoutCustomerInput[] + updateMany?: Prisma.StockMovementUpdateManyWithWhereWithoutCustomerInput | Prisma.StockMovementUpdateManyWithWhereWithoutCustomerInput[] + deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] +} + +export type StockMovementUncheckedUpdateManyWithoutCustomerNestedInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCustomerInput[] | Prisma.StockMovementUncheckedCreateWithoutCustomerInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCustomerInput | Prisma.StockMovementCreateOrConnectWithoutCustomerInput[] + upsert?: Prisma.StockMovementUpsertWithWhereUniqueWithoutCustomerInput | Prisma.StockMovementUpsertWithWhereUniqueWithoutCustomerInput[] + createMany?: Prisma.StockMovementCreateManyCustomerInputEnvelope + set?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + disconnect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + delete?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + update?: Prisma.StockMovementUpdateWithWhereUniqueWithoutCustomerInput | Prisma.StockMovementUpdateWithWhereUniqueWithoutCustomerInput[] + updateMany?: Prisma.StockMovementUpdateManyWithWhereWithoutCustomerInput | Prisma.StockMovementUpdateManyWithWhereWithoutCustomerInput[] + deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] +} + export type StockMovementCreateNestedManyWithoutInventoryInput = { create?: Prisma.XOR | Prisma.StockMovementCreateWithoutInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutInventoryInput[] connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutInventoryInput | Prisma.StockMovementCreateOrConnectWithoutInventoryInput[] @@ -684,6 +786,13 @@ export type StockMovementCreateNestedManyWithoutInventoryInput = { connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] } +export type StockMovementCreateNestedManyWithoutCounterInventoryInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCounterInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutCounterInventoryInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput | Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput[] + createMany?: Prisma.StockMovementCreateManyCounterInventoryInputEnvelope + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] +} + export type StockMovementUncheckedCreateNestedManyWithoutInventoryInput = { create?: Prisma.XOR | Prisma.StockMovementCreateWithoutInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutInventoryInput[] connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutInventoryInput | Prisma.StockMovementCreateOrConnectWithoutInventoryInput[] @@ -691,6 +800,13 @@ export type StockMovementUncheckedCreateNestedManyWithoutInventoryInput = { connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] } +export type StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCounterInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutCounterInventoryInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput | Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput[] + createMany?: Prisma.StockMovementCreateManyCounterInventoryInputEnvelope + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] +} + export type StockMovementUpdateManyWithoutInventoryNestedInput = { create?: Prisma.XOR | Prisma.StockMovementCreateWithoutInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutInventoryInput[] connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutInventoryInput | Prisma.StockMovementCreateOrConnectWithoutInventoryInput[] @@ -705,6 +821,20 @@ export type StockMovementUpdateManyWithoutInventoryNestedInput = { deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] } +export type StockMovementUpdateManyWithoutCounterInventoryNestedInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCounterInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutCounterInventoryInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput | Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput[] + upsert?: Prisma.StockMovementUpsertWithWhereUniqueWithoutCounterInventoryInput | Prisma.StockMovementUpsertWithWhereUniqueWithoutCounterInventoryInput[] + createMany?: Prisma.StockMovementCreateManyCounterInventoryInputEnvelope + set?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + disconnect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + delete?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + update?: Prisma.StockMovementUpdateWithWhereUniqueWithoutCounterInventoryInput | Prisma.StockMovementUpdateWithWhereUniqueWithoutCounterInventoryInput[] + updateMany?: Prisma.StockMovementUpdateManyWithWhereWithoutCounterInventoryInput | Prisma.StockMovementUpdateManyWithWhereWithoutCounterInventoryInput[] + deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] +} + export type StockMovementUncheckedUpdateManyWithoutInventoryNestedInput = { create?: Prisma.XOR | Prisma.StockMovementCreateWithoutInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutInventoryInput[] connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutInventoryInput | Prisma.StockMovementCreateOrConnectWithoutInventoryInput[] @@ -719,6 +849,20 @@ export type StockMovementUncheckedUpdateManyWithoutInventoryNestedInput = { deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] } +export type StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput = { + create?: Prisma.XOR | Prisma.StockMovementCreateWithoutCounterInventoryInput[] | Prisma.StockMovementUncheckedCreateWithoutCounterInventoryInput[] + connectOrCreate?: Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput | Prisma.StockMovementCreateOrConnectWithoutCounterInventoryInput[] + upsert?: Prisma.StockMovementUpsertWithWhereUniqueWithoutCounterInventoryInput | Prisma.StockMovementUpsertWithWhereUniqueWithoutCounterInventoryInput[] + createMany?: Prisma.StockMovementCreateManyCounterInventoryInputEnvelope + set?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + disconnect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + delete?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + connect?: Prisma.StockMovementWhereUniqueInput | Prisma.StockMovementWhereUniqueInput[] + update?: Prisma.StockMovementUpdateWithWhereUniqueWithoutCounterInventoryInput | Prisma.StockMovementUpdateWithWhereUniqueWithoutCounterInventoryInput[] + updateMany?: Prisma.StockMovementUpdateManyWithWhereWithoutCounterInventoryInput | Prisma.StockMovementUpdateManyWithWhereWithoutCounterInventoryInput[] + deleteMany?: Prisma.StockMovementScalarWhereInput | Prisma.StockMovementScalarWhereInput[] +} + export type EnumMovementTypeFieldUpdateOperationsInput = { set?: $Enums.MovementType } @@ -739,6 +883,8 @@ export type StockMovementCreateWithoutProductInput = { remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string inventory: Prisma.InventoryCreateNestedOneWithoutStockMovementsInput supplier?: Prisma.SupplierCreateNestedOneWithoutStockMovementsInput + customer?: Prisma.CustomerCreateNestedOneWithoutStockMovementsInput + counterInventory?: Prisma.InventoryCreateNestedOneWithoutCounterStockMovementsInput } export type StockMovementUncheckedCreateWithoutProductInput = { @@ -754,6 +900,8 @@ export type StockMovementUncheckedCreateWithoutProductInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementCreateOrConnectWithoutProductInput = { @@ -799,6 +947,8 @@ export type StockMovementScalarWhereInput = { avgCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + customerId?: Prisma.IntNullableFilter<"StockMovement"> | number | null + counterInventoryId?: Prisma.IntNullableFilter<"StockMovement"> | number | null } export type StockMovementCreateWithoutSupplierInput = { @@ -813,6 +963,8 @@ export type StockMovementCreateWithoutSupplierInput = { remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string inventory: Prisma.InventoryCreateNestedOneWithoutStockMovementsInput product: Prisma.ProductCreateNestedOneWithoutStockMovementsInput + customer?: Prisma.CustomerCreateNestedOneWithoutStockMovementsInput + counterInventory?: Prisma.InventoryCreateNestedOneWithoutCounterStockMovementsInput } export type StockMovementUncheckedCreateWithoutSupplierInput = { @@ -828,6 +980,8 @@ export type StockMovementUncheckedCreateWithoutSupplierInput = { inventoryId: number avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementCreateOrConnectWithoutSupplierInput = { @@ -856,6 +1010,65 @@ export type StockMovementUpdateManyWithWhereWithoutSupplierInput = { data: Prisma.XOR } +export type StockMovementCreateWithoutCustomerInput = { + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventory: Prisma.InventoryCreateNestedOneWithoutStockMovementsInput + product: Prisma.ProductCreateNestedOneWithoutStockMovementsInput + supplier?: Prisma.SupplierCreateNestedOneWithoutStockMovementsInput + counterInventory?: Prisma.InventoryCreateNestedOneWithoutCounterStockMovementsInput +} + +export type StockMovementUncheckedCreateWithoutCustomerInput = { + id?: number + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + productId: number + inventoryId: number + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: number | null + counterInventoryId?: number | null +} + +export type StockMovementCreateOrConnectWithoutCustomerInput = { + where: Prisma.StockMovementWhereUniqueInput + create: Prisma.XOR +} + +export type StockMovementCreateManyCustomerInputEnvelope = { + data: Prisma.StockMovementCreateManyCustomerInput | Prisma.StockMovementCreateManyCustomerInput[] + skipDuplicates?: boolean +} + +export type StockMovementUpsertWithWhereUniqueWithoutCustomerInput = { + where: Prisma.StockMovementWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type StockMovementUpdateWithWhereUniqueWithoutCustomerInput = { + where: Prisma.StockMovementWhereUniqueInput + data: Prisma.XOR +} + +export type StockMovementUpdateManyWithWhereWithoutCustomerInput = { + where: Prisma.StockMovementScalarWhereInput + data: Prisma.XOR +} + export type StockMovementCreateWithoutInventoryInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string @@ -868,6 +1081,8 @@ export type StockMovementCreateWithoutInventoryInput = { remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string product: Prisma.ProductCreateNestedOneWithoutStockMovementsInput supplier?: Prisma.SupplierCreateNestedOneWithoutStockMovementsInput + customer?: Prisma.CustomerCreateNestedOneWithoutStockMovementsInput + counterInventory?: Prisma.InventoryCreateNestedOneWithoutCounterStockMovementsInput } export type StockMovementUncheckedCreateWithoutInventoryInput = { @@ -883,6 +1098,8 @@ export type StockMovementUncheckedCreateWithoutInventoryInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementCreateOrConnectWithoutInventoryInput = { @@ -895,6 +1112,49 @@ export type StockMovementCreateManyInventoryInputEnvelope = { skipDuplicates?: boolean } +export type StockMovementCreateWithoutCounterInventoryInput = { + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventory: Prisma.InventoryCreateNestedOneWithoutStockMovementsInput + product: Prisma.ProductCreateNestedOneWithoutStockMovementsInput + supplier?: Prisma.SupplierCreateNestedOneWithoutStockMovementsInput + customer?: Prisma.CustomerCreateNestedOneWithoutStockMovementsInput +} + +export type StockMovementUncheckedCreateWithoutCounterInventoryInput = { + id?: number + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + productId: number + inventoryId: number + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: number | null + customerId?: number | null +} + +export type StockMovementCreateOrConnectWithoutCounterInventoryInput = { + where: Prisma.StockMovementWhereUniqueInput + create: Prisma.XOR +} + +export type StockMovementCreateManyCounterInventoryInputEnvelope = { + data: Prisma.StockMovementCreateManyCounterInventoryInput | Prisma.StockMovementCreateManyCounterInventoryInput[] + skipDuplicates?: boolean +} + export type StockMovementUpsertWithWhereUniqueWithoutInventoryInput = { where: Prisma.StockMovementWhereUniqueInput update: Prisma.XOR @@ -911,6 +1171,22 @@ export type StockMovementUpdateManyWithWhereWithoutInventoryInput = { data: Prisma.XOR } +export type StockMovementUpsertWithWhereUniqueWithoutCounterInventoryInput = { + where: Prisma.StockMovementWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type StockMovementUpdateWithWhereUniqueWithoutCounterInventoryInput = { + where: Prisma.StockMovementWhereUniqueInput + data: Prisma.XOR +} + +export type StockMovementUpdateManyWithWhereWithoutCounterInventoryInput = { + where: Prisma.StockMovementScalarWhereInput + data: Prisma.XOR +} + export type StockMovementCreateManyProductInput = { id?: number type: $Enums.MovementType @@ -924,6 +1200,8 @@ export type StockMovementCreateManyProductInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementUpdateWithoutProductInput = { @@ -938,6 +1216,8 @@ export type StockMovementUpdateWithoutProductInput = { remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockMovementsNestedInput supplier?: Prisma.SupplierUpdateOneWithoutStockMovementsNestedInput + customer?: Prisma.CustomerUpdateOneWithoutStockMovementsNestedInput + counterInventory?: Prisma.InventoryUpdateOneWithoutCounterStockMovementsNestedInput } export type StockMovementUncheckedUpdateWithoutProductInput = { @@ -953,6 +1233,8 @@ export type StockMovementUncheckedUpdateWithoutProductInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementUncheckedUpdateManyWithoutProductInput = { @@ -968,6 +1250,8 @@ export type StockMovementUncheckedUpdateManyWithoutProductInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementCreateManySupplierInput = { @@ -983,6 +1267,8 @@ export type StockMovementCreateManySupplierInput = { inventoryId: number avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + customerId?: number | null + counterInventoryId?: number | null } export type StockMovementUpdateWithoutSupplierInput = { @@ -997,6 +1283,8 @@ export type StockMovementUpdateWithoutSupplierInput = { remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockMovementsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutStockMovementsNestedInput + customer?: Prisma.CustomerUpdateOneWithoutStockMovementsNestedInput + counterInventory?: Prisma.InventoryUpdateOneWithoutCounterStockMovementsNestedInput } export type StockMovementUncheckedUpdateWithoutSupplierInput = { @@ -1012,6 +1300,8 @@ export type StockMovementUncheckedUpdateWithoutSupplierInput = { inventoryId?: Prisma.IntFieldUpdateOperationsInput | number avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementUncheckedUpdateManyWithoutSupplierInput = { @@ -1027,6 +1317,75 @@ export type StockMovementUncheckedUpdateManyWithoutSupplierInput = { inventoryId?: Prisma.IntFieldUpdateOperationsInput | number avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type StockMovementCreateManyCustomerInput = { + id?: number + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + productId: number + inventoryId: number + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: number | null + counterInventoryId?: number | null +} + +export type StockMovementUpdateWithoutCustomerInput = { + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockMovementsNestedInput + product?: Prisma.ProductUpdateOneRequiredWithoutStockMovementsNestedInput + supplier?: Prisma.SupplierUpdateOneWithoutStockMovementsNestedInput + counterInventory?: Prisma.InventoryUpdateOneWithoutCounterStockMovementsNestedInput +} + +export type StockMovementUncheckedUpdateWithoutCustomerInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type StockMovementUncheckedUpdateManyWithoutCustomerInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementCreateManyInventoryInput = { @@ -1042,6 +1401,25 @@ export type StockMovementCreateManyInventoryInput = { avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: number | null + customerId?: number | null + counterInventoryId?: number | null +} + +export type StockMovementCreateManyCounterInventoryInput = { + id?: number + type: $Enums.MovementType + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + fee: runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType: $Enums.MovementReferenceType + referenceId: string + createdAt?: Date | string + productId: number + inventoryId: number + avgCost: runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: number | null + customerId?: number | null } export type StockMovementUpdateWithoutInventoryInput = { @@ -1056,6 +1434,8 @@ export type StockMovementUpdateWithoutInventoryInput = { remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string product?: Prisma.ProductUpdateOneRequiredWithoutStockMovementsNestedInput supplier?: Prisma.SupplierUpdateOneWithoutStockMovementsNestedInput + customer?: Prisma.CustomerUpdateOneWithoutStockMovementsNestedInput + counterInventory?: Prisma.InventoryUpdateOneWithoutCounterStockMovementsNestedInput } export type StockMovementUncheckedUpdateWithoutInventoryInput = { @@ -1071,6 +1451,8 @@ export type StockMovementUncheckedUpdateWithoutInventoryInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type StockMovementUncheckedUpdateManyWithoutInventoryInput = { @@ -1086,6 +1468,58 @@ export type StockMovementUncheckedUpdateManyWithoutInventoryInput = { avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + counterInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type StockMovementUpdateWithoutCounterInventoryInput = { + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockMovementsNestedInput + product?: Prisma.ProductUpdateOneRequiredWithoutStockMovementsNestedInput + supplier?: Prisma.SupplierUpdateOneWithoutStockMovementsNestedInput + customer?: Prisma.CustomerUpdateOneWithoutStockMovementsNestedInput +} + +export type StockMovementUncheckedUpdateWithoutCounterInventoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type StockMovementUncheckedUpdateManyWithoutCounterInventoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceType?: Prisma.EnumMovementReferenceTypeFieldUpdateOperationsInput | $Enums.MovementReferenceType + referenceId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + avgCost?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + remainedInStock?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + supplierId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } @@ -1104,9 +1538,13 @@ export type StockMovementSelect product?: boolean | Prisma.ProductDefaultArgs supplier?: boolean | Prisma.StockMovement$supplierArgs + customer?: boolean | Prisma.StockMovement$customerArgs + counterInventory?: boolean | Prisma.StockMovement$counterInventoryArgs }, ExtArgs["result"]["stockMovement"]> @@ -1125,13 +1563,17 @@ export type StockMovementSelectScalar = { avgCost?: boolean remainedInStock?: boolean supplierId?: boolean + customerId?: boolean + counterInventoryId?: boolean } -export type StockMovementOmit = runtime.Types.Extensions.GetOmit<"id" | "type" | "quantity" | "fee" | "totalCost" | "referenceType" | "referenceId" | "createdAt" | "productId" | "inventoryId" | "avgCost" | "remainedInStock" | "supplierId", ExtArgs["result"]["stockMovement"]> +export type StockMovementOmit = runtime.Types.Extensions.GetOmit<"id" | "type" | "quantity" | "fee" | "totalCost" | "referenceType" | "referenceId" | "createdAt" | "productId" | "inventoryId" | "avgCost" | "remainedInStock" | "supplierId" | "customerId" | "counterInventoryId", ExtArgs["result"]["stockMovement"]> export type StockMovementInclude = { inventory?: boolean | Prisma.InventoryDefaultArgs product?: boolean | Prisma.ProductDefaultArgs supplier?: boolean | Prisma.StockMovement$supplierArgs + customer?: boolean | Prisma.StockMovement$customerArgs + counterInventory?: boolean | Prisma.StockMovement$counterInventoryArgs } export type $StockMovementPayload = { @@ -1140,6 +1582,8 @@ export type $StockMovementPayload product: Prisma.$ProductPayload supplier: Prisma.$SupplierPayload | null + customer: Prisma.$CustomerPayload | null + counterInventory: Prisma.$InventoryPayload | null } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1155,6 +1599,8 @@ export type $StockMovementPayload composites: {} } @@ -1498,6 +1944,8 @@ export interface Prisma__StockMovementClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> product = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> supplier = {}>(args?: Prisma.Subset>): Prisma.Prisma__SupplierClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + counterInventory = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1540,6 +1988,8 @@ export interface StockMovementFieldRefs { readonly avgCost: Prisma.FieldRef<"StockMovement", 'Decimal'> readonly remainedInStock: Prisma.FieldRef<"StockMovement", 'Decimal'> readonly supplierId: Prisma.FieldRef<"StockMovement", 'Int'> + readonly customerId: Prisma.FieldRef<"StockMovement", 'Int'> + readonly counterInventoryId: Prisma.FieldRef<"StockMovement", 'Int'> } @@ -1901,6 +2351,44 @@ export type StockMovement$supplierArgs = { + /** + * Select specific fields to fetch from the Customer + */ + select?: Prisma.CustomerSelect | null + /** + * Omit specific fields from the Customer + */ + omit?: Prisma.CustomerOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerInclude | null + where?: Prisma.CustomerWhereInput +} + +/** + * StockMovement.counterInventory + */ +export type StockMovement$counterInventoryArgs = { + /** + * Select specific fields to fetch from the Inventory + */ + select?: Prisma.InventorySelect | null + /** + * Omit specific fields from the Inventory + */ + omit?: Prisma.InventoryOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.InventoryInclude | null + where?: Prisma.InventoryWhereInput +} + /** * StockMovement without action */ diff --git a/src/modules/cardex/cardex.service.ts b/src/modules/cardex/cardex.service.ts index 8529c32..3b6db39 100644 --- a/src/modules/cardex/cardex.service.ts +++ b/src/modules/cardex/cardex.service.ts @@ -26,31 +26,29 @@ export class CardexService { const items = await this.prisma.stockMovement.findMany({ where, - include: { product: true, inventory: true }, + include: { + product: { select: { id: true, name: true, sku: true } }, + inventory: { select: { id: true, name: true } }, + counterInventory: { + select: { id: true, name: true }, + }, + supplier: { + select: { id: true, firstName: true, lastName: true }, + }, + customer: { + select: { id: true, firstName: true, lastName: true }, + }, + }, + omit: { + productId: true, + inventoryId: true, + counterInventoryId: true, + supplierId: true, + customerId: true, + }, orderBy: { createdAt: 'desc' }, }) - const mapped = items.map(i => ({ - id: i.id, - type: i.type, - quantity: Number(i.quantity), - fee: Number(i.fee), - totalCost: Number(i.totalCost), - referenceType: i.referenceType, - referenceId: i.referenceId, - createdAt: i.createdAt, - avgCost: Number(i.avgCost), - product: { - name: i.product.name, - sku: i.product.sku, - id: i.productId, - }, - inventory: { - name: i.inventory.name, - id: i.inventoryId, - }, - })) - - return ResponseMapper.list(mapped) + return ResponseMapper.list(items) } }