diff --git a/fix_trigger.sql b/fix_trigger.sql deleted file mode 100644 index bae2ec1..0000000 --- a/fix_trigger.sql +++ /dev/null @@ -1,91 +0,0 @@ --- Corrected triggers for 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; - - SELECT pa.inventoryId INTO inventory_id - FROM Pos_Accounts pa - INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId - WHERE si.id = NEW.invoiceId; - - 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 = 'Not enough stock to complete sale.'; - END IF; -end; - -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; -DECLARE customer_id INT; -DECLARE pos_id INT; - - - - INSERT INTO Trigger_Logs (name , message) VALUES ('pos_id', 'init'); - - SELECT posAccountId, customerId INTO pos_id, customer_id - FROM Sales_Invoices si - WHERE si.id = NEW.invoiceId - LIMIT 1; - INSERT INTO Trigger_Logs (name , message) VALUES ('pos_id', pos_id); - INSERT INTO Trigger_Logs (name , message) VALUES ('customer_id', customer_id); - - - SELECT pa.inventoryId INTO inventory_id - FROM Pos_Accounts pa - INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId - WHERE si.id = NEW.invoiceId; - - - - SELECT COALESCE(quantity, 0) INTO current_stock - FROM Stock_Balance sb - WHERE productId = NEW.productId AND sb.inventoryId = inventory_id - LIMIT 1; - - INSERT INTO Trigger_Logs (name , message) VALUES ('invId', inventory_id); - - - 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 diff --git a/nest-cli.json b/nest-cli.json index f9aa683..a85dacf 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -3,6 +3,8 @@ "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": { - "deleteOutDir": true + "deleteOutDir": true, + "assets": ["**/*.sql"], + "watchAssets": true } } diff --git a/prisma/migrations/20251224165307_triggers/migration.sql b/prisma/migrations/20251224165307_triggers/migration.sql deleted file mode 100644 index af5102c..0000000 --- a/prisma/migrations/20251224165307_triggers/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/prisma/migrations/20251224172938_triggers/migration.sql b/prisma/migrations/20251224172938_triggers/migration.sql deleted file mode 100644 index 07d06dc..0000000 --- a/prisma/migrations/20251224172938_triggers/migration.sql +++ /dev/null @@ -1,347 +0,0 @@ --- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-22T15:32:20.184Z - --- ------------------------------------------ --- 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/migrations/20251225164731_add_inventory_bank_account_table/migration.sql b/prisma/migrations/20251225164731_add_inventory_bank_account_table/migration.sql deleted file mode 100644 index 1378313..0000000 --- a/prisma/migrations/20251225164731_add_inventory_bank_account_table/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `bankAccountId` on the `Inventories` table. All the data in the column will be lost. - - You are about to drop the `_Bank_Accounts_inventoryId_fkey` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE `_Bank_Accounts_inventoryId_fkey` DROP FOREIGN KEY `_Bank_Accounts_inventoryId_fkey_A_fkey`; - --- DropForeignKey -ALTER TABLE `_Bank_Accounts_inventoryId_fkey` DROP FOREIGN KEY `_Bank_Accounts_inventoryId_fkey_B_fkey`; - --- AlterTable -ALTER TABLE `Inventories` DROP COLUMN `bankAccountId`; - --- DropTable -DROP TABLE `_Bank_Accounts_inventoryId_fkey`; diff --git a/prisma/migrations/20251226161357_update/migration.sql b/prisma/migrations/20251226161357_update/migration.sql deleted file mode 100644 index c648d71..0000000 --- a/prisma/migrations/20251226161357_update/migration.sql +++ /dev/null @@ -1,158 +0,0 @@ -/* -Warnings: - -- You are about to alter the column `count` on the `Inventory_Transfer_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `totalAmount` on the `Orders` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `basePrice` on the `Product_Variants` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `salePrice` on the `Product_Variants` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `quantity` on the `Product_Variants` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `alertQuantity` on the `Product_Variants` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `salePrice` on the `Products` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,0)`. -- You are about to alter the column `count` on the `Purchase_Receipt_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `fee` on the `Purchase_Receipt_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `total` on the `Purchase_Receipt_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `amount` on the `Purchase_Receipt_Payments` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to drop the column `isSettled` on the `Purchase_Receipts` table. All the data in the column will be lost. -- You are about to alter the column `totalAmount` on the `Purchase_Receipts` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `paidAmount` on the `Purchase_Receipts` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `count` on the `Sales_Invoice_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `fee` on the `Sales_Invoice_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `total` on the `Sales_Invoice_Items` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `totalAmount` on the `Sales_Invoices` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `adjustedQuantity` on the `Stock_Adjustments` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `quantity` on the `Stock_Movements` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `fee` on the `Stock_Movements` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `totalCost` on the `Stock_Movements` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `avgCost` on the `Stock_Movements` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `remainedInStock` on the `Stock_Movements` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(10,0)`. -- You are about to alter the column `debit` on the `Supplier_Ledger` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `credit` on the `Supplier_Ledger` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- You are about to alter the column `balance` on the `Supplier_Ledger` table. The data in that column could be lost. The data in that column will be cast from `Decimal(10,2)` to `Decimal(15,2)`. -- A unique constraint covering the columns `[iban]` on the table `Bank_Accounts` will be added. If there are existing duplicate values, this will fail. -- Made the column `bankAccountId` on table `Pos_Accounts` required. This step will fail if there are existing NULL values in that column. -- Added the required column `inventoryId` to the `Purchase_Receipt_Payments` table without a default value. This is not possible if the table is not empty. -- Added the required column `type` to the `Purchase_Receipt_Payments` table without a default value. This is not possible if the table is not empty. -- Made the column `bankAccountId` on table `Purchase_Receipt_Payments` required. This step will fail if there are existing NULL values in that column. - -*/ --- DropForeignKey -ALTER TABLE `Pos_Accounts` -DROP FOREIGN KEY `Pos_Accounts_bankAccountId_fkey`; - --- DropForeignKey -ALTER TABLE `Pos_Accounts` -DROP FOREIGN KEY `Pos_Accounts_bankAccountId_inventoryId_fkey`; - --- DropForeignKey -ALTER TABLE `Pos_Accounts` -DROP FOREIGN KEY `Pos_Accounts_inventoryId_fkey`; - --- DropForeignKey -ALTER TABLE `Purchase_Receipt_Payments` -DROP FOREIGN KEY `Purchase_Receipt_Payments_bankAccountId_fkey`; - --- DropIndex -DROP INDEX `Pos_Accounts_bankAccountId_inventoryId_fkey` ON `Pos_Accounts`; - --- DropIndex -DROP INDEX `Purchase_Receipt_Payments_bankAccountId_fkey` ON `Purchase_Receipt_Payments`; - --- AlterTable -ALTER TABLE `Inventory_Transfer_Items` -MODIFY `count` DECIMAL(10, 0) NOT NULL; - --- AlterTable -ALTER TABLE `Orders` MODIFY `totalAmount` DECIMAL(15, 2) NOT NULL; - --- AlterTable -ALTER TABLE `Pos_Accounts` MODIFY `bankAccountId` INTEGER NOT NULL; - --- AlterTable -ALTER TABLE `Product_Variants` -MODIFY `basePrice` DECIMAL(15, 2) NOT NULL, -MODIFY `salePrice` DECIMAL(15, 2) NOT NULL, -MODIFY `quantity` DECIMAL(10, 0) NULL DEFAULT 0.00, -MODIFY `alertQuantity` DECIMAL(10, 0) NULL DEFAULT 5.00; - --- AlterTable -ALTER TABLE `Products` -MODIFY `salePrice` DECIMAL(15, 0) NOT NULL DEFAULT 0.00; - --- AlterTable -ALTER TABLE `Purchase_Receipt_Items` -MODIFY `count` DECIMAL(10, 0) NOT NULL, -MODIFY `fee` DECIMAL(15, 2) NOT NULL, -MODIFY `total` DECIMAL(15, 2) NOT NULL; - --- AlterTable -ALTER TABLE `Purchase_Receipt_Payments` -ADD COLUMN `inventoryId` INTEGER NOT NULL, -ADD COLUMN `type` ENUM('PAYMENT', 'REFUND') NOT NULL, -MODIFY `amount` DECIMAL(15, 2) NOT NULL, -MODIFY `bankAccountId` INTEGER NOT NULL; - --- AlterTable -ALTER TABLE `Purchase_Receipts` -DROP COLUMN `isSettled`, -ADD COLUMN `status` ENUM( - 'UNPAID', - 'PARTIALLY_PAID', - 'PAID' -) NOT NULL DEFAULT 'UNPAID', -MODIFY `totalAmount` DECIMAL(15, 2) NOT NULL, -MODIFY `paidAmount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00; - --- AlterTable -ALTER TABLE `Sales_Invoice_Items` -MODIFY `count` DECIMAL(10, 0) NOT NULL, -MODIFY `fee` DECIMAL(15, 2) NOT NULL, -MODIFY `total` DECIMAL(15, 2) NOT NULL; - --- AlterTable -ALTER TABLE `Sales_Invoices` -MODIFY `totalAmount` DECIMAL(15, 2) NOT NULL; - --- AlterTable -ALTER TABLE `Stock_Adjustments` -MODIFY `adjustedQuantity` DECIMAL(10, 0) NOT NULL; - --- AlterTable -ALTER TABLE `Stock_Movements` -MODIFY `quantity` DECIMAL(10, 0) NOT NULL, -MODIFY `fee` DECIMAL(15, 2) NOT NULL, -MODIFY `totalCost` DECIMAL(15, 2) NOT NULL, -MODIFY `avgCost` DECIMAL(15, 2) NOT NULL, -MODIFY `remainedInStock` DECIMAL(10, 0) NOT NULL DEFAULT 0.00; - --- AlterTable -ALTER TABLE `Supplier_Ledger` -MODIFY `debit` DECIMAL(15, 2) NOT NULL DEFAULT 0, -MODIFY `credit` DECIMAL(15, 2) NOT NULL DEFAULT 0, -MODIFY `balance` DECIMAL(15, 2) NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX `Bank_Accounts_iban_key` ON `Bank_Accounts` (`iban`); - --- AddForeignKey -ALTER TABLE `Pos_Accounts` -ADD CONSTRAINT `Pos_Accounts_inventoryId_bankAccountId_fkey` FOREIGN KEY ( - `inventoryId`, - `bankAccountId` -) REFERENCES `Inventory_Bank_Accounts` ( - `inventoryId`, - `bankAccountId` -) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Purchase_Receipt_Payments` -ADD CONSTRAINT `Purchase_Receipt_Payments_inventoryId_bankAccountId_fkey` FOREIGN KEY ( - `inventoryId`, - `bankAccountId` -) REFERENCES `Inventory_Bank_Accounts` ( - `inventoryId`, - `bankAccountId` -) ON DELETE RESTRICT ON UPDATE CASCADE; - --- RenameIndex -ALTER TABLE `Supplier_Ledger` -RENAME INDEX `Supplier_Ledger_supplierId_fkey` TO `Supplier_Ledger_supplierId_idx`; diff --git a/prisma/migrations/20251226183649_update/migration.sql b/prisma/migrations/20251226183649_update/migration.sql deleted file mode 100644 index 9d2672a..0000000 --- a/prisma/migrations/20251226183649_update/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX `Pos_Accounts_inventoryId_idx` ON `Pos_Accounts`(`inventoryId`); diff --git a/prisma/migrations/20251227131204_update/migration.sql b/prisma/migrations/20251227131204_update/migration.sql deleted file mode 100644 index 6adb118..0000000 --- a/prisma/migrations/20251227131204_update/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `inventoryId` on the `Purchase_Receipt_Payments` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE `Purchase_Receipt_Payments` DROP FOREIGN KEY `Purchase_Receipt_Payments_inventoryId_bankAccountId_fkey`; - --- DropIndex -DROP INDEX `Purchase_Receipt_Payments_inventoryId_bankAccountId_fkey` ON `Purchase_Receipt_Payments`; - --- AlterTable -ALTER TABLE `Purchase_Receipt_Payments` DROP COLUMN `inventoryId`; diff --git a/prisma/migrations/20251228151659_update/migration.sql b/prisma/migrations/20251228151659_update/migration.sql deleted file mode 100644 index 2c663ac..0000000 --- a/prisma/migrations/20251228151659_update/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AddForeignKey -ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20251230122834_update/migration.sql b/prisma/migrations/20251230122834_update/migration.sql deleted file mode 100644 index a8403e7..0000000 --- a/prisma/migrations/20251230122834_update/migration.sql +++ /dev/null @@ -1,50 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `inventoryId` on the `Sales_Invoices` table. All the data in the column will be lost. - - Added the required column `posAccountId` to the `Sales_Invoices` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE `Sales_Invoices` DROP FOREIGN KEY `Sales_Invoices_inventoryId_fkey`; - --- DropIndex -DROP INDEX `Sales_Invoices_inventoryId_fkey` ON `Sales_Invoices`; - --- AlterTable -ALTER TABLE `Purchase_Receipt_Payments` ADD COLUMN `inventoryBankAccountBankAccountId` INTEGER NULL, - ADD COLUMN `inventoryBankAccountInventoryId` INTEGER NULL; - --- AlterTable -ALTER TABLE `Sales_Invoices` DROP COLUMN `inventoryId`, - ADD COLUMN `posAccountId` INTEGER NOT NULL; - --- CreateIndex -CREATE INDEX `Sales_Invoices_posAccountId_idx` ON `Sales_Invoices`(`posAccountId`); - --- AddForeignKey -ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_posAccountId_fkey` FOREIGN KEY (`posAccountId`) REFERENCES `Pos_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_inventoryBankAccountInventoryId_i_fkey` FOREIGN KEY (`inventoryBankAccountInventoryId`, `inventoryBankAccountBankAccountId`) REFERENCES `Inventory_Bank_Accounts`(`inventoryId`, `bankAccountId`) ON DELETE SET NULL ON UPDATE CASCADE; - --- RenameIndex -ALTER TABLE `Orders` RENAME INDEX `Orders_customerId_fkey` TO `Orders_customerId_idx`; - --- RenameIndex -ALTER TABLE `Product_Variants` RENAME INDEX `products_barcode_unique` TO `Product_Variants_barcode_key`; - --- RenameIndex -ALTER TABLE `Products` RENAME INDEX `products_barcode_unique` TO `Products_barcode_key`; - --- RenameIndex -ALTER TABLE `Products` RENAME INDEX `products_sku_unique` TO `Products_sku_key`; - --- RenameIndex -ALTER TABLE `Sales_Invoice_Items` RENAME INDEX `Sales_Invoice_Items_invoiceId_fkey` TO `Sales_Invoice_Items_invoiceId_idx`; - --- RenameIndex -ALTER TABLE `Sales_Invoice_Items` RENAME INDEX `Sales_Invoice_Items_productId_fkey` TO `Sales_Invoice_Items_productId_idx`; - --- RenameIndex -ALTER TABLE `Sales_Invoices` RENAME INDEX `Sales_Invoices_customerId_fkey` TO `Sales_Invoices_customerId_idx`; diff --git a/prisma/migrations/20251230154405_update/migration.sql b/prisma/migrations/20251230154405_update/migration.sql deleted file mode 100644 index ebe5cd4..0000000 --- a/prisma/migrations/20251230154405_update/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Products` ADD COLUMN `minimumStockAlertLevel` DECIMAL(10, 0) NOT NULL DEFAULT 1.00; diff --git a/prisma/migrations/20251224163703_init/migration.sql b/prisma/migrations/20260102204301_init/migration.sql similarity index 75% rename from prisma/migrations/20251224163703_init/migration.sql rename to prisma/migrations/20260102204301_init/migration.sql index aa8cceb..ce31427 100644 --- a/prisma/migrations/20251224163703_init/migration.sql +++ b/prisma/migrations/20260102204301_init/migration.sql @@ -84,9 +84,35 @@ CREATE TABLE `Bank_Accounts` ( UNIQUE INDEX `Bank_Accounts_accountNumber_key`(`accountNumber`), UNIQUE INDEX `Bank_Accounts_cardNumber_key`(`cardNumber`), + UNIQUE INDEX `Bank_Accounts_iban_key`(`iban`), PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +-- CreateTable +CREATE TABLE `Bank_Account_Transactions` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `bankAccountId` INTEGER NOT NULL, + `type` ENUM('DEPOSIT', 'WITHDRAWAL') NOT NULL, + `amount` DECIMAL(15, 2) NOT NULL, + `balanceAfter` DECIMAL(15, 2) NOT NULL, + `referenceId` INTEGER NOT NULL, + `referenceType` ENUM('PURCHASE_PAYMENT', 'PURCHASE_REFUND', 'POS_SALE', 'POS_REFUND', 'BANK_TRANSFER', 'MANUAL_ADJUSTMENT') NOT NULL, + `description` TEXT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + + INDEX `Bank_Account_Transactions_bankAccountId_idx`(`bankAccountId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Bank_Account_Balance` ( + `bankAccountId` INTEGER NOT NULL, + `balance` DECIMAL(15, 2) NOT NULL, + `updatedAt` TIMESTAMP(0) NOT NULL, + + UNIQUE INDEX `Bank_Account_Balance_bankAccountId_key`(`bankAccountId`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + -- CreateTable CREATE TABLE `Inventories` ( `id` INTEGER NOT NULL AUTO_INCREMENT, @@ -97,11 +123,36 @@ CREATE TABLE `Inventories` ( `updatedAt` TIMESTAMP(0) NOT NULL, `deletedAt` TIMESTAMP(0) NULL, `isPointOfSale` BOOLEAN NOT NULL DEFAULT false, - `bankAccountId` INTEGER NULL, PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +-- CreateTable +CREATE TABLE `Inventory_Bank_Accounts` ( + `inventoryId` INTEGER NOT NULL, + `bankAccountId` INTEGER NOT NULL, + + INDEX `Inventory_Bank_Accounts_bankAccountId_idx`(`bankAccountId`), + PRIMARY KEY (`inventoryId`, `bankAccountId`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Pos_Accounts` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255) NOT NULL, + `code` VARCHAR(10) NOT NULL, + `description` VARCHAR(500) NULL, + `bankAccountId` INTEGER NOT NULL, + `inventoryId` INTEGER NOT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `updatedAt` TIMESTAMP(0) NOT NULL, + `deletedAt` TIMESTAMP(0) NULL, + + UNIQUE INDEX `Pos_Accounts_code_key`(`code`), + INDEX `Pos_Accounts_inventoryId_idx`(`inventoryId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + -- CreateTable CREATE TABLE `Inventory_Transfers` ( `id` INTEGER NOT NULL AUTO_INCREMENT, @@ -120,7 +171,7 @@ CREATE TABLE `Inventory_Transfers` ( -- CreateTable CREATE TABLE `Inventory_Transfer_Items` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `count` DECIMAL(10, 2) NOT NULL, + `count` DECIMAL(10, 0) NOT NULL, `productId` INTEGER NOT NULL, `transferId` INTEGER NOT NULL, @@ -129,31 +180,6 @@ CREATE TABLE `Inventory_Transfer_Items` ( PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; --- CreateTable -CREATE TABLE `Inventory_Bank_Accounts` ( - `inventoryId` INTEGER NOT NULL, - `bankAccountId` INTEGER NOT NULL, - - INDEX `Inventory_Bank_Accounts_bankAccountId_idx`(`bankAccountId`), - PRIMARY KEY (`inventoryId`, `bankAccountId`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Pos_Accounts` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255) NOT NULL, - `code` VARCHAR(10) NOT NULL, - `description` VARCHAR(500) NULL, - `bankAccountId` INTEGER NULL, - `inventoryId` INTEGER NOT NULL, - `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `updatedAt` TIMESTAMP(0) NOT NULL, - `deletedAt` TIMESTAMP(0) NULL, - - UNIQUE INDEX `Pos_Accounts_code_key`(`code`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -- CreateTable CREATE TABLE `Banks` ( `id` INTEGER NOT NULL AUTO_INCREMENT, @@ -168,38 +194,34 @@ CREATE TABLE `Banks` ( ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable -CREATE TABLE `Suppliers` ( +CREATE TABLE `Orders` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `firstName` VARCHAR(255) NOT NULL, - `lastName` VARCHAR(255) NOT NULL, - `email` VARCHAR(255) NULL, - `mobileNumber` CHAR(11) NOT NULL, - `address` TEXT NULL, - `city` VARCHAR(100) NULL, - `state` VARCHAR(100) NULL, - `country` VARCHAR(100) NULL, - `isActive` BOOLEAN NOT NULL DEFAULT true, + `orderNumber` VARCHAR(100) NOT NULL, + `status` ENUM('PENDING', 'REJECT', 'DONE') NOT NULL DEFAULT 'PENDING', + `totalAmount` DECIMAL(15, 2) NOT NULL, + `description` TEXT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), `updatedAt` TIMESTAMP(0) NOT NULL, `deletedAt` TIMESTAMP(0) NULL, + `customerId` INTEGER NULL, - UNIQUE INDEX `Suppliers_mobileNumber_key`(`mobileNumber`), + UNIQUE INDEX `Orders_orderNumber_key`(`orderNumber`), + INDEX `Orders_customerId_idx`(`customerId`), PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable -CREATE TABLE `Supplier_Ledger` ( +CREATE TABLE `Order_Items` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `description` TEXT NULL, - `debit` DECIMAL(10, 2) NOT NULL, - `credit` DECIMAL(10, 2) NOT NULL, - `balance` DECIMAL(10, 2) NOT NULL, - `sourceType` ENUM('PURCHASE', 'PAYMENT', 'ADJUSTMENT', 'REFUND') NOT NULL, - `sourceId` INTEGER NOT NULL, + `quantity` DECIMAL(10, 0) NOT NULL, + `unitPrice` DECIMAL(15, 2) NOT NULL, + `totalPrice` DECIMAL(15, 2) NOT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `supplierId` INTEGER NOT NULL, + `orderId` INTEGER NOT NULL, + `productId` INTEGER NOT NULL, - INDEX `Supplier_Ledger_supplierId_fkey`(`supplierId`), + INDEX `Order_Items_orderId_idx`(`orderId`), + INDEX `Order_Items_productId_idx`(`productId`), PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; @@ -223,56 +245,6 @@ CREATE TABLE `Customers` ( PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; --- CreateTable -CREATE TABLE `Orders` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `orderNumber` VARCHAR(100) NOT NULL, - `status` ENUM('PENDING', 'REJECT', 'DONE') NOT NULL DEFAULT 'PENDING', - `paymentMethod` ENUM('CASH', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL DEFAULT 'CARD', - `totalAmount` DECIMAL(10, 2) NOT NULL, - `description` TEXT NULL, - `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `updatedAt` TIMESTAMP(0) NOT NULL, - `deletedAt` TIMESTAMP(0) NULL, - `customerId` INTEGER NOT NULL, - - UNIQUE INDEX `Orders_orderNumber_key`(`orderNumber`), - INDEX `Orders_customerId_fkey`(`customerId`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Sales_Invoices` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `code` VARCHAR(100) NOT NULL, - `totalAmount` DECIMAL(10, 2) NOT NULL, - `description` TEXT NULL, - `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `updatedAt` TIMESTAMP(0) NOT NULL, - `customerId` INTEGER NULL, - `inventoryId` INTEGER NOT NULL, - - UNIQUE INDEX `Sales_Invoices_code_key`(`code`), - INDEX `Sales_Invoices_inventoryId_fkey`(`inventoryId`), - INDEX `Sales_Invoices_customerId_fkey`(`customerId`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Sales_Invoice_Items` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `count` DECIMAL(10, 2) NOT NULL, - `fee` DECIMAL(10, 2) NOT NULL, - `total` DECIMAL(10, 2) NOT NULL, - `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `invoiceId` INTEGER NOT NULL, - `productId` INTEGER NOT NULL, - - INDEX `Sales_Invoice_Items_invoiceId_fkey`(`invoiceId`), - INDEX `Sales_Invoice_Items_productId_fkey`(`productId`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -- CreateTable CREATE TABLE `Trigger_Logs` ( `id` INTEGER NOT NULL AUTO_INCREMENT, @@ -287,14 +259,14 @@ CREATE TABLE `Trigger_Logs` ( CREATE TABLE `Product_Variants` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, - `basePrice` DECIMAL(10, 2) NOT NULL, - `salePrice` DECIMAL(10, 2) NOT NULL, + `basePrice` DECIMAL(15, 2) NOT NULL, + `salePrice` DECIMAL(15, 2) NOT NULL, `description` TEXT NULL, `barcode` VARCHAR(100) NULL, `imageUrl` VARCHAR(255) NULL, `unit` VARCHAR(10) NULL, - `quantity` DECIMAL(10, 2) NULL DEFAULT 0.00, - `alertQuantity` DECIMAL(10, 2) NULL DEFAULT 5.00, + `quantity` DECIMAL(10, 0) NULL DEFAULT 0.00, + `alertQuantity` DECIMAL(10, 0) NULL DEFAULT 5.00, `isActive` BOOLEAN NOT NULL DEFAULT true, `isFeatured` BOOLEAN NOT NULL DEFAULT false, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), @@ -302,7 +274,7 @@ CREATE TABLE `Product_Variants` ( `deletedAt` TIMESTAMP(0) NULL, `productId` INTEGER NOT NULL, - UNIQUE INDEX `products_barcode_unique`(`barcode`), + UNIQUE INDEX `Product_Variants_barcode_key`(`barcode`), INDEX `Product_Variants_productId_fkey`(`productId`), PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; @@ -319,10 +291,11 @@ CREATE TABLE `Products` ( `deletedAt` TIMESTAMP(0) NULL, `brandId` INTEGER NULL, `categoryId` INTEGER NULL, - `salePrice` DECIMAL(10, 2) NOT NULL DEFAULT 0.00, + `salePrice` DECIMAL(15, 0) NOT NULL DEFAULT 0.00, + `minimumStockAlertLevel` DECIMAL(10, 0) NOT NULL DEFAULT 1.00, - UNIQUE INDEX `products_sku_unique`(`sku`), - UNIQUE INDEX `products_barcode_unique`(`barcode`), + UNIQUE INDEX `Products_sku_key`(`sku`), + UNIQUE INDEX `Products_barcode_key`(`barcode`), INDEX `Products_brandId_fkey`(`brandId`), INDEX `Products_categoryId_fkey`(`categoryId`), PRIMARY KEY (`id`) @@ -358,12 +331,12 @@ CREATE TABLE `Product_categories` ( CREATE TABLE `Purchase_Receipts` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `code` VARCHAR(100) NOT NULL, - `totalAmount` DECIMAL(10, 2) NOT NULL, - `paidAmount` DECIMAL(10, 2) NOT NULL DEFAULT 0.00, - `isSettled` BOOLEAN NOT NULL DEFAULT false, + `totalAmount` DECIMAL(15, 2) NOT NULL, + `paidAmount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00, `description` TEXT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), `updatedAt` TIMESTAMP(0) NOT NULL, + `status` ENUM('UNPAID', 'PARTIALLY_PAID', 'PAID') NOT NULL DEFAULT 'UNPAID', `supplierId` INTEGER NOT NULL, `inventoryId` INTEGER NOT NULL, @@ -376,13 +349,13 @@ CREATE TABLE `Purchase_Receipts` ( -- CreateTable CREATE TABLE `Purchase_Receipt_Items` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `count` DECIMAL(10, 2) NOT NULL, - `fee` DECIMAL(10, 2) NOT NULL, - `total` DECIMAL(10, 2) NOT NULL, - `description` TEXT NULL, - `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `count` DECIMAL(10, 0) NOT NULL, + `unitPrice` DECIMAL(15, 2) NOT NULL, + `totalPrice` DECIMAL(15, 2) NOT NULL, `receiptId` INTEGER NOT NULL, `productId` INTEGER NOT NULL, + `description` TEXT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), INDEX `Purchase_Receipt_Items_productId_fkey`(`productId`), INDEX `Purchase_Receipt_Items_receiptId_fkey`(`receiptId`), @@ -392,16 +365,63 @@ CREATE TABLE `Purchase_Receipt_Items` ( -- CreateTable CREATE TABLE `Purchase_Receipt_Payments` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `amount` DECIMAL(10, 2) NOT NULL, + `amount` DECIMAL(15, 2) NOT NULL, `paymentMethod` ENUM('CASH', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL, - `bankAccountId` INTEGER NULL, - `description` TEXT NULL, - `payedAt` TIMESTAMP(0) NOT NULL, + `type` ENUM('PAYMENT', 'REFUND') NOT NULL, + `bankAccountId` INTEGER NOT NULL, `receiptId` INTEGER NOT NULL, + `payedAt` TIMESTAMP(0) NOT NULL, + `description` TEXT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `inventoryBankAccountInventoryId` INTEGER NULL, + `inventoryBankAccountBankAccountId` INTEGER NULL, INDEX `Purchase_Receipt_Payments_receiptId_fkey`(`receiptId`), - INDEX `Purchase_Receipt_Payments_bankAccountId_fkey`(`bankAccountId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Sales_Invoices` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `code` VARCHAR(100) NOT NULL, + `totalAmount` DECIMAL(15, 2) NOT NULL, + `description` TEXT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `updatedAt` TIMESTAMP(0) NOT NULL, + `customerId` INTEGER NULL, + `posAccountId` INTEGER NOT NULL, + + UNIQUE INDEX `Sales_Invoices_code_key`(`code`), + INDEX `Sales_Invoices_customerId_idx`(`customerId`), + INDEX `Sales_Invoices_posAccountId_idx`(`posAccountId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Sales_Invoice_Items` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `count` DECIMAL(10, 0) NOT NULL, + `unitPrice` DECIMAL(15, 2) NOT NULL DEFAULT 0.00, + `totalPrice` DECIMAL(15, 2) NOT NULL DEFAULT 0.00, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `invoiceId` INTEGER NOT NULL, + `productId` INTEGER NOT NULL, + + INDEX `Sales_Invoice_Items_invoiceId_idx`(`invoiceId`), + INDEX `Sales_Invoice_Items_productId_idx`(`productId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `SalesInvoicePayment` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `invoiceId` INTEGER NOT NULL, + `amount` DECIMAL(15, 2) NOT NULL, + `paymentMethod` ENUM('CASH', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL, + `paidAt` DATETIME(3) NOT NULL, + `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + + INDEX `SalesInvoicePayment_invoiceId_idx`(`invoiceId`), PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; @@ -409,17 +429,17 @@ CREATE TABLE `Purchase_Receipt_Payments` ( CREATE TABLE `Stock_Movements` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `type` ENUM('IN', 'OUT', 'ADJUST') NOT NULL, - `quantity` DECIMAL(10, 2) NOT NULL, - `fee` DECIMAL(10, 2) NOT NULL, - `totalCost` DECIMAL(10, 2) NOT NULL, + `quantity` DECIMAL(10, 0) NOT NULL, + `unitPrice` DECIMAL(15, 2) NOT NULL, + `totalCost` DECIMAL(15, 2) NOT NULL, `referenceType` ENUM('PURCHASE', 'SALES', 'ADJUSTMENT', 'INVENTORY_TRANSFER') NOT NULL, `referenceId` VARCHAR(191) NOT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), `productId` INTEGER NOT NULL, `inventoryId` INTEGER NOT NULL, - `avgCost` DECIMAL(10, 2) NOT NULL, + `avgCost` DECIMAL(15, 2) NOT NULL, `supplierId` INTEGER NULL, - `remainedInStock` DECIMAL(10, 2) NOT NULL DEFAULT 0.00, + `remainedInStock` DECIMAL(10, 0) NOT NULL DEFAULT 0.00, `counterInventoryId` INTEGER NULL, `customerId` INTEGER NULL, @@ -451,7 +471,7 @@ CREATE TABLE `Stock_Balance` ( -- CreateTable CREATE TABLE `Stock_Adjustments` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `adjustedQuantity` DECIMAL(10, 2) NOT NULL, + `adjustedQuantity` DECIMAL(10, 0) NOT NULL, `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), `productId` INTEGER NOT NULL, `inventoryId` INTEGER NOT NULL, @@ -462,12 +482,54 @@ CREATE TABLE `Stock_Adjustments` ( ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- CreateTable -CREATE TABLE `_Bank_Accounts_inventoryId_fkey` ( - `A` INTEGER NOT NULL, - `B` INTEGER NOT NULL, +CREATE TABLE `Stock_Reservations` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `quantity` DECIMAL(10, 0) NOT NULL, + `expiresAt` TIMESTAMP(0) NOT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `productId` INTEGER NOT NULL, + `inventoryId` INTEGER NOT NULL, + `orderId` INTEGER NOT NULL, - UNIQUE INDEX `_Bank_Accounts_inventoryId_fkey_AB_unique`(`A`, `B`), - INDEX `_Bank_Accounts_inventoryId_fkey_B_index`(`B`) + INDEX `Stock_Reservations_inventoryId_idx`(`inventoryId`), + INDEX `Stock_Reservations_productId_idx`(`productId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Suppliers` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `firstName` VARCHAR(255) NOT NULL, + `lastName` VARCHAR(255) NOT NULL, + `email` VARCHAR(255) NULL, + `mobileNumber` CHAR(11) NOT NULL, + `address` TEXT NULL, + `city` VARCHAR(100) NULL, + `state` VARCHAR(100) NULL, + `country` VARCHAR(100) NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `updatedAt` TIMESTAMP(0) NOT NULL, + `deletedAt` TIMESTAMP(0) NULL, + + UNIQUE INDEX `Suppliers_mobileNumber_key`(`mobileNumber`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Supplier_Ledger` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `description` TEXT NULL, + `debit` DECIMAL(15, 2) NOT NULL DEFAULT 0, + `credit` DECIMAL(15, 2) NOT NULL DEFAULT 0, + `balance` DECIMAL(15, 2) NOT NULL, + `sourceType` ENUM('PURCHASE', 'PAYMENT', 'ADJUSTMENT', 'REFUND') NOT NULL, + `sourceId` INTEGER NOT NULL, + `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `supplierId` INTEGER NOT NULL, + + INDEX `Supplier_Ledger_supplierId_idx`(`supplierId`), + PRIMARY KEY (`id`) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- AddForeignKey @@ -482,6 +544,21 @@ ALTER TABLE `Bank_Branches` ADD CONSTRAINT `Bank_Branches_bankId_fkey` FOREIGN K -- AddForeignKey ALTER TABLE `Bank_Accounts` ADD CONSTRAINT `Bank_Accounts_branchId_fkey` FOREIGN KEY (`branchId`) REFERENCES `Bank_Branches`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; +-- AddForeignKey +ALTER TABLE `Bank_Account_Transactions` ADD CONSTRAINT `Bank_Account_Transactions_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Bank_Account_Balance` ADD CONSTRAINT `Bank_Account_Balance_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Inventory_Bank_Accounts` ADD CONSTRAINT `Inventory_Bank_Accounts_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Inventory_Bank_Accounts` ADD CONSTRAINT `Inventory_Bank_Accounts_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Pos_Accounts` ADD CONSTRAINT `Pos_Accounts_inventoryId_bankAccountId_fkey` FOREIGN KEY (`inventoryId`, `bankAccountId`) REFERENCES `Inventory_Bank_Accounts`(`inventoryId`, `bankAccountId`) ON DELETE RESTRICT ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE `Inventory_Transfers` ADD CONSTRAINT `Inventory_Transfers_fromInventoryId_fkey` FOREIGN KEY (`fromInventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; @@ -495,37 +572,13 @@ ALTER TABLE `Inventory_Transfer_Items` ADD CONSTRAINT `Inventory_Transfer_Items_ ALTER TABLE `Inventory_Transfer_Items` ADD CONSTRAINT `Inventory_Transfer_Items_transferId_fkey` FOREIGN KEY (`transferId`) REFERENCES `Inventory_Transfers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE `Inventory_Bank_Accounts` ADD CONSTRAINT `Inventory_Bank_Accounts_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE `Orders` ADD CONSTRAINT `Orders_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION; -- AddForeignKey -ALTER TABLE `Inventory_Bank_Accounts` ADD CONSTRAINT `Inventory_Bank_Accounts_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE `Order_Items` ADD CONSTRAINT `Order_Items_orderId_fkey` FOREIGN KEY (`orderId`) REFERENCES `Orders`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION; -- AddForeignKey -ALTER TABLE `Pos_Accounts` ADD CONSTRAINT `Pos_Accounts_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Pos_Accounts` ADD CONSTRAINT `Pos_Accounts_bankAccountId_inventoryId_fkey` FOREIGN KEY (`bankAccountId`, `inventoryId`) REFERENCES `Inventory_Bank_Accounts`(`bankAccountId`, `inventoryId`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Pos_Accounts` ADD CONSTRAINT `Pos_Accounts_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Supplier_Ledger` ADD CONSTRAINT `Supplier_Ledger_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Orders` ADD CONSTRAINT `Orders_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION; - --- AddForeignKey -ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE `Order_Items` ADD CONSTRAINT `Order_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION; -- AddForeignKey ALTER TABLE `Product_Variants` ADD CONSTRAINT `Product_Variants_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION; @@ -552,7 +605,25 @@ ALTER TABLE `Purchase_Receipt_Items` ADD CONSTRAINT `Purchase_Receipt_Items_rece ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_receiptId_fkey` FOREIGN KEY (`receiptId`) REFERENCES `Purchase_Receipts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_bankAccountId_fkey` FOREIGN KEY (`bankAccountId`) REFERENCES `Bank_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Purchase_Receipt_Payments` ADD CONSTRAINT `Purchase_Receipt_Payments_inventoryBankAccountInventoryId_i_fkey` FOREIGN KEY (`inventoryBankAccountInventoryId`, `inventoryBankAccountBankAccountId`) REFERENCES `Inventory_Bank_Accounts`(`inventoryId`, `bankAccountId`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_posAccountId_fkey` FOREIGN KEY (`posAccountId`) REFERENCES `Pos_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `SalesInvoicePayment` ADD CONSTRAINT `SalesInvoicePayment_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT 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; @@ -582,7 +653,10 @@ ALTER TABLE `Stock_Adjustments` ADD CONSTRAINT `Stock_Adjustments_inventoryId_fk ALTER TABLE `Stock_Adjustments` ADD CONSTRAINT `Stock_Adjustments_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE `_Bank_Accounts_inventoryId_fkey` ADD CONSTRAINT `_Bank_Accounts_inventoryId_fkey_A_fkey` FOREIGN KEY (`A`) REFERENCES `Bank_Accounts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `Stock_Reservations` ADD CONSTRAINT `Stock_Reservations_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE `_Bank_Accounts_inventoryId_fkey` ADD CONSTRAINT `_Bank_Accounts_inventoryId_fkey_B_fkey` FOREIGN KEY (`B`) REFERENCES `Inventories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `Stock_Reservations` ADD CONSTRAINT `Stock_Reservations_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Supplier_Ledger` ADD CONSTRAINT `Supplier_Ledger_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20260102205948_init/migration.sql b/prisma/migrations/20260102205948_init/migration.sql new file mode 100644 index 0000000..9b01486 --- /dev/null +++ b/prisma/migrations/20260102205948_init/migration.sql @@ -0,0 +1,21 @@ +/* + Warnings: + + - You are about to drop the column `totalPrice` on the `Order_Items` table. All the data in the column will be lost. + - You are about to drop the column `totalPrice` on the `Purchase_Receipt_Items` table. All the data in the column will be lost. + - You are about to drop the column `totalPrice` on the `Sales_Invoice_Items` table. All the data in the column will be lost. + - Added the required column `totalAmount` to the `Order_Items` table without a default value. This is not possible if the table is not empty. + - Added the required column `totalAmount` to the `Purchase_Receipt_Items` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE `Order_Items` DROP COLUMN `totalPrice`, + ADD COLUMN `totalAmount` DECIMAL(15, 2) NOT NULL; + +-- AlterTable +ALTER TABLE `Purchase_Receipt_Items` DROP COLUMN `totalPrice`, + ADD COLUMN `totalAmount` DECIMAL(15, 2) NOT NULL; + +-- AlterTable +ALTER TABLE `Sales_Invoice_Items` DROP COLUMN `totalPrice`, + ADD COLUMN `totalAmount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00; diff --git a/prisma/migrations/20260102214244_init/migration.sql b/prisma/migrations/20260102214244_init/migration.sql new file mode 100644 index 0000000..224907b --- /dev/null +++ b/prisma/migrations/20260102214244_init/migration.sql @@ -0,0 +1,27 @@ +/* + Warnings: + + - You are about to drop the `SalesInvoicePayment` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE `SalesInvoicePayment` DROP FOREIGN KEY `SalesInvoicePayment_invoiceId_fkey`; + +-- DropTable +DROP TABLE `SalesInvoicePayment`; + +-- CreateTable +CREATE TABLE `Sales_Invoice_Payments` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `invoiceId` INTEGER NOT NULL, + `amount` DECIMAL(15, 2) NOT NULL, + `paymentMethod` ENUM('CASH', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL, + `paidAt` DATETIME(3) NOT NULL, + `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + + INDEX `Sales_Invoice_Payments_invoiceId_idx`(`invoiceId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- AddForeignKey +ALTER TABLE `Sales_Invoice_Payments` ADD CONSTRAINT `Sales_Invoice_Payments_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20260104092437_init/migration.sql b/prisma/migrations/20260104092437_init/migration.sql new file mode 100644 index 0000000..c212949 --- /dev/null +++ b/prisma/migrations/20260104092437_init/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - The values [REJECT] on the enum `Orders_status` will be removed. If these variants are still used in the database, this will fail. + +*/ +-- AlterTable +ALTER TABLE `Orders` MODIFY `status` ENUM('PENDING', 'REJECTED', 'CANCELED', 'DONE') NOT NULL DEFAULT 'PENDING'; diff --git a/prisma/migrations/triggers.sql b/prisma/migrations/triggers.sql index 33aa1aa..34ad72a 100644 --- a/prisma/migrations/triggers.sql +++ b/prisma/migrations/triggers.sql @@ -25,13 +25,13 @@ DECLARE fromInv INT; -- OUT from source INSERT INTO Stock_Movements - (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + (type, quantity, unitPrice, 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) + (type, quantity, unitPrice, 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; @@ -66,7 +66,7 @@ DECLARE invId INT; INSERT INTO Stock_Movements ( type, quantity, - fee, + unitPrice, totalCost, referenceType, referenceId, @@ -80,7 +80,7 @@ DECLARE invId INT; VALUES ( 'IN', NEW.count, - NEW.fee, + NEW.unitPrice, NEW.total, 'PURCHASE', NEW.receiptId, @@ -157,7 +157,7 @@ DECLARE customer_id INT; INSERT INTO Stock_Movements ( type, quantity, - fee, + unitPrice, totalCost, referenceType, referenceId, @@ -171,7 +171,7 @@ DECLARE customer_id INT; VALUES ( 'OUT', NEW.count, - NEW.fee, + NEW.unitPrice, NEW.total, 'SALES', NEW.invoiceId, @@ -260,8 +260,8 @@ VALUES ( NEW.productId, NEW.inventoryId, - NEW.quantity, - - COALESCE(NEW.fee, 0) * NEW.quantity, - COALESCE(NEW.fee, 0), + - COALESCE(NEW.unitPrice, 0) * NEW.quantity, + COALESCE(NEW.unitPrice, 0), NOW() ); @@ -294,7 +294,7 @@ INSERT INTO VALUES ( NEW.productId, NEW.quantity, - NEW.fee, + NEW.unitPrice, NEW.totalCost, NEW.inventoryId, NOW() @@ -329,7 +329,7 @@ INSERT INTO VALUES ( NEW.productId, NEW.quantity, - NEW.fee, + NEW.unitPrice, NEW.totalCost, NEW.inventoryId, NOW() diff --git a/prisma/schema/bank.prisma b/prisma/schema/bank.prisma index a94350b..c2dba7a 100644 --- a/prisma/schema/bank.prisma +++ b/prisma/schema/bank.prisma @@ -28,6 +28,35 @@ model BankAccount { branch BankBranch @relation("Bank_Accounts_branchId_fkey", fields: [branchId], references: [id]) inventoryBankAccounts InventoryBankAccount[] purchaseReceiptPayments PurchaseReceiptPayments[] + bankAccountTransactions BankAccountTransaction[] + bankAccountBalances BankAccountBalance[] @@map("Bank_Accounts") } + +model BankAccountTransaction { + id Int @id @default(autoincrement()) + bankAccountId Int + type BankAccountTransactionType + amount Decimal @db.Decimal(15, 2) + balanceAfter Decimal @db.Decimal(15, 2) + referenceId Int + referenceType BankTransactionRefType + description String? @db.Text + createdAt DateTime @default(now()) @db.Timestamp(0) + + bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) + + @@index([bankAccountId]) + @@map("Bank_Account_Transactions") +} + +model BankAccountBalance { + bankAccountId Int @unique + balance Decimal @db.Decimal(15, 2) + updatedAt DateTime @updatedAt @db.Timestamp(0) + + bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) + + @@map("Bank_Account_Balance") +} diff --git a/prisma/schema/enum.prisma b/prisma/schema/enum.prisma index af990fa..033e61e 100644 --- a/prisma/schema/enum.prisma +++ b/prisma/schema/enum.prisma @@ -1,6 +1,7 @@ enum OrderStatus { PENDING - REJECT + REJECTED + CANCELED DONE } @@ -42,3 +43,17 @@ enum PurchaseReceiptStatus { PARTIALLY_PAID PAID } + +enum BankAccountTransactionType { + DEPOSIT + WITHDRAWAL +} + +enum BankTransactionRefType { + PURCHASE_PAYMENT + PURCHASE_REFUND + POS_SALE + POS_REFUND + BANK_TRANSFER + MANUAL_ADJUSTMENT +} diff --git a/prisma/schema/inventory.prisma b/prisma/schema/inventory.prisma index fefed3f..62f67b8 100644 --- a/prisma/schema/inventory.prisma +++ b/prisma/schema/inventory.prisma @@ -15,6 +15,7 @@ model Inventory { counterStockMovements StockMovement[] @relation("StockMovement_CounterInventory") stockMovements StockMovement[] @relation("StockMovement_Inventory") inventoryBankAccounts InventoryBankAccount[] + stockReservations StockReservation[] @@map("Inventories") } diff --git a/prisma/schema/order.prisma b/prisma/schema/order.prisma new file mode 100644 index 0000000..d416f08 --- /dev/null +++ b/prisma/schema/order.prisma @@ -0,0 +1,33 @@ +model Order { + id Int @id @default(autoincrement()) + orderNumber String @unique @db.VarChar(100) + status OrderStatus @default(PENDING) + totalAmount Decimal @db.Decimal(15, 2) + description String? @db.Text + createdAt DateTime @default(now()) @db.Timestamp(0) + updatedAt DateTime @updatedAt @db.Timestamp(0) + deletedAt DateTime? @db.Timestamp(0) + customerId Int? + customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction) + orderItems OrderItem[] + + @@index([customerId]) + @@map("Orders") +} + +model OrderItem { + id Int @id @default(autoincrement()) + quantity Decimal @db.Decimal(10, 0) + unitPrice Decimal @db.Decimal(15, 2) + totalAmount Decimal @db.Decimal(15, 2) + createdAt DateTime @default(now()) @db.Timestamp(0) + orderId Int + productId Int + + order Order @relation(fields: [orderId], references: [id], onUpdate: NoAction) + product Product @relation(fields: [productId], references: [id], onUpdate: NoAction) + + @@index([orderId]) + @@index([productId]) + @@map("Order_Items") +} diff --git a/prisma/schema/others.prisma b/prisma/schema/others.prisma index e87ff52..10198bf 100644 --- a/prisma/schema/others.prisma +++ b/prisma/schema/others.prisma @@ -19,57 +19,6 @@ model Customer { @@map("Customers") } -model Order { - id Int @id @default(autoincrement()) - orderNumber String @unique @db.VarChar(100) - status OrderStatus @default(PENDING) - paymentMethod PaymentMethodType @default(CARD) - totalAmount Decimal @db.Decimal(15, 2) - description String? @db.Text - createdAt DateTime @default(now()) @db.Timestamp(0) - updatedAt DateTime @updatedAt @db.Timestamp(0) - deletedAt DateTime? @db.Timestamp(0) - customerId Int - customer Customer @relation(fields: [customerId], references: [id], onUpdate: NoAction) - - @@index([customerId]) - @@map("Orders") -} - -model SalesInvoice { - id Int @id @default(autoincrement()) - code String @unique @db.VarChar(100) - totalAmount Decimal @db.Decimal(15, 2) - description String? @db.Text - createdAt DateTime @default(now()) @db.Timestamp(0) - updatedAt DateTime @updatedAt @db.Timestamp(0) - customerId Int? - posAccountId Int - items SalesInvoiceItem[] - customer Customer? @relation(fields: [customerId], references: [id]) - posAccount PosAccount @relation(fields: [posAccountId], references: [id]) - - @@index([customerId]) - @@index([posAccountId]) - @@map("Sales_Invoices") -} - -model SalesInvoiceItem { - id Int @id @default(autoincrement()) - count Decimal @db.Decimal(10, 0) - fee Decimal @db.Decimal(15, 2) - total Decimal @db.Decimal(15, 2) - createdAt DateTime @default(now()) @db.Timestamp(0) - invoiceId Int - productId Int - invoice SalesInvoice @relation(fields: [invoiceId], references: [id]) - product Product @relation(fields: [productId], references: [id]) - - @@index([invoiceId]) - @@index([productId]) - @@map("Sales_Invoice_Items") -} - model TriggerLog { id Int @id @default(autoincrement()) message String @db.Text diff --git a/prisma/schema/product.prisma b/prisma/schema/product.prisma index 4b96a25..1e2a840 100644 --- a/prisma/schema/product.prisma +++ b/prisma/schema/product.prisma @@ -43,6 +43,8 @@ model Product { stockBalances StockBalance[] @relation("StockBalance_Product") stockMovements StockMovement[] @relation("StockMovement_Product") salesInvoiceItems SalesInvoiceItem[] + stockReservations StockReservation[] + orderItems OrderItem[] @@index([brandId], map: "Products_brandId_fkey") @@index([categoryId], map: "Products_categoryId_fkey") diff --git a/prisma/schema/purchase.prisma b/prisma/schema/purchase.prisma index 9f960b9..2a7b7b3 100644 --- a/prisma/schema/purchase.prisma +++ b/prisma/schema/purchase.prisma @@ -22,8 +22,8 @@ model PurchaseReceipt { model PurchaseReceiptItem { id Int @id @default(autoincrement()) count Decimal @db.Decimal(10, 0) - fee Decimal @db.Decimal(15, 2) - total Decimal @db.Decimal(15, 2) + unitPrice Decimal @db.Decimal(15, 2) + totalAmount Decimal @db.Decimal(15, 2) receiptId Int productId Int description String? @db.Text diff --git a/prisma/schema/sales.prisma b/prisma/schema/sales.prisma new file mode 100644 index 0000000..2758632 --- /dev/null +++ b/prisma/schema/sales.prisma @@ -0,0 +1,48 @@ +model SalesInvoice { + id Int @id @default(autoincrement()) + code String @unique @db.VarChar(100) + totalAmount Decimal @db.Decimal(15, 2) + description String? @db.Text + createdAt DateTime @default(now()) @db.Timestamp(0) + updatedAt DateTime @updatedAt @db.Timestamp(0) + customerId Int? + posAccountId Int + customer Customer? @relation(fields: [customerId], references: [id]) + posAccount PosAccount @relation(fields: [posAccountId], references: [id]) + items SalesInvoiceItem[] + salesInvoicePayments SalesInvoicePayment[] + + @@index([customerId]) + @@index([posAccountId]) + @@map("Sales_Invoices") +} + +model SalesInvoiceItem { + id Int @id @default(autoincrement()) + count Decimal @db.Decimal(10, 0) + unitPrice Decimal @default(0.00) @db.Decimal(15, 2) + totalAmount Decimal @default(0.00) @db.Decimal(15, 2) + createdAt DateTime @default(now()) @db.Timestamp(0) + invoiceId Int + productId Int + invoice SalesInvoice @relation(fields: [invoiceId], references: [id]) + product Product @relation(fields: [productId], references: [id]) + + @@index([invoiceId]) + @@index([productId]) + @@map("Sales_Invoice_Items") +} + +model SalesInvoicePayment { + id Int @id @default(autoincrement()) + invoiceId Int + amount Decimal @db.Decimal(15, 2) + paymentMethod PaymentMethodType + paidAt DateTime + createdAt DateTime @default(now()) + + invoice SalesInvoice @relation(fields: [invoiceId], references: [id]) + + @@index([invoiceId]) + @@map("Sales_Invoice_Payments") +} diff --git a/prisma/schema/stock.prisma b/prisma/schema/stock.prisma index 8df0580..035ca35 100644 --- a/prisma/schema/stock.prisma +++ b/prisma/schema/stock.prisma @@ -2,7 +2,7 @@ model StockMovement { id Int @id @default(autoincrement()) type MovementType quantity Decimal @db.Decimal(10, 0) - fee Decimal @db.Decimal(15, 2) + unitPrice Decimal @db.Decimal(15, 2) totalCost Decimal @db.Decimal(15, 2) referenceType MovementReferenceType referenceId String @@ -59,3 +59,19 @@ model StockAdjustment { @@index([productId], map: "Stock_Adjustments_productId_fkey") @@map("Stock_Adjustments") } + +model StockReservation { + id Int @id @default(autoincrement()) + quantity Decimal @db.Decimal(10, 0) + expiresAt DateTime @db.Timestamp(0) + createdAt DateTime @default(now()) @db.Timestamp(0) + productId Int + inventoryId Int + orderId Int + inventory Inventory @relation(fields: [inventoryId], references: [id]) + product Product @relation(fields: [productId], references: [id]) + + @@index([inventoryId]) + @@index([productId]) + @@map("Stock_Reservations") +} diff --git a/prisma/seed.ts b/prisma/seed.ts index b0a4f8e..96b8f0a 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -10,7 +10,6 @@ async function main() { }, }) } - if ((await prisma.user.count()) === 0) { const adminRole = await prisma.role.findUnique({ where: { name: 'Admin' } }) if (!adminRole) { @@ -28,7 +27,6 @@ async function main() { }, }) } - if ((await prisma.inventory.count()) === 0) { await prisma.inventory.createMany({ data: [ @@ -48,19 +46,16 @@ async function main() { ], }) } - if ((await prisma.productCategory.count()) === 0) { await prisma.productCategory.createMany({ data: Array.from({ length: 10 }, (_, i) => ({ name: `دسته‌ی ${i + 1}` })), }) } - if ((await prisma.productBrand.count()) === 0) { await prisma.productBrand.createMany({ data: Array.from({ length: 10 }, (_, i) => ({ name: `برند ${i + 1}` })), }) } - if ((await prisma.supplier.count()) === 0) { await prisma.supplier.createMany({ data: Array.from({ length: 9 }, (_, i) => ({ @@ -71,7 +66,6 @@ async function main() { })), }) } - if ((await prisma.customer.count()) === 0) { await prisma.customer.createMany({ data: Array.from({ length: 5 }, (_, i) => ({ @@ -82,12 +76,11 @@ async function main() { })), }) } - if ((await prisma.product.count()) === 0) { const categories = await prisma.productCategory.findMany() const brands = await prisma.productBrand.findMany() await prisma.product.createMany({ - data: Array.from({ length: 100 }, (_, i) => ({ + data: Array.from({ length: 20 }, (_, i) => ({ name: `کالای ${i + 1}`, sku: `SKU-${1000 + i + 1}`, salePrice: parseInt((Math.random() * (100 - 10) + 10).toString()) * 10000, @@ -96,7 +89,6 @@ async function main() { })), }) } - if ((await prisma.bank.count()) === 0) { await prisma.bank.createMany({ data: [ @@ -231,7 +223,6 @@ async function main() { ], }) } - if ((await prisma.bankBranch.count()) === 0) { await prisma.bankBranch.createMany({ data: [ @@ -253,7 +244,6 @@ async function main() { ], }) } - if ((await prisma.bankAccount.count()) === 0) { await prisma.bankAccount.createMany({ data: [ @@ -278,56 +268,54 @@ async function main() { ], }) } + if ((await prisma.inventoryBankAccount.count()) === 0) { + const inventories = await prisma.inventory.findMany() + const bankAccounts = await prisma.bankAccount.findMany() + if (inventories.length || bankAccounts.length) { + // Assign bank accounts to inventories + const inventoryBankAccounts = [] + for (let i = 0; i < inventories.length; i++) { + const inventory = inventories[i] + const bankAccount = bankAccounts[i % bankAccounts.length] // Cycle through bank accounts + // @ts-ignore + inventoryBankAccounts.push({ + inventoryId: inventory.id, + bankAccountId: bankAccount.id, + }) + } + await prisma.inventoryBankAccount.createMany({ + data: inventoryBankAccounts, + }) + } + } + if ((await prisma.posAccount.count()) === 0) { + const inventories = await prisma.inventory.findMany({ + where: { isPointOfSale: true }, + }) + const inventoryBankAccounts = await prisma.inventoryBankAccount.findMany() + const posAccounts = [] + for (let i = 0; i < inventories.length; i++) { + const inventory = inventories[i] + // Find a bank account assigned to this inventory + const inventoryBankAccount = inventoryBankAccounts.find( + iba => iba.inventoryId === inventory.id, + ) + if (inventoryBankAccount) { + // @ts-ignore - // if ((await prisma.inventoryBankAccount.count()) === 0) { - // const inventories = await prisma.inventory.findMany() - // const bankAccounts = await prisma.bankAccount.findMany() - - // // Assign bank accounts to inventories - // const inventoryBankAccounts = [] - // for (let i = 0; i < inventories.length; i++) { - // const inventory = inventories[i] - // const bankAccount = bankAccounts[i % bankAccounts.length] // Cycle through bank accounts - // inventoryBankAccounts.push({ - // inventoryId: inventory.id, - // bankAccountId: bankAccount.id, - // }) - // } - - // await prisma.inventoryBankAccount.createMany({ - // data: inventoryBankAccounts, - // }) - // } - - // if ((await prisma.posAccount.count()) === 0) { - // const inventories = await prisma.inventory.findMany({ - // where: { isPointOfSale: true }, - // }) - // const inventoryBankAccounts = await prisma.inventoryBankAccount.findMany() - - // const posAccounts = [] - // for (let i = 0; i < inventories.length; i++) { - // const inventory = inventories[i] - // // Find a bank account assigned to this inventory - // const inventoryBankAccount = inventoryBankAccounts.find( - // iba => iba.inventoryId === inventory.id, - // ) - // if (inventoryBankAccount) { - // posAccounts.push({ - // name: `پوز ${inventory.name}`, - // code: `POS${(i + 1).toString().padStart(3, '0')}`, - // description: `پوز فروشگاه ${inventory.name}`, - // inventoryId: inventory.id, - // bankAccountId: inventoryBankAccount.bankAccountId, - // }) - // } - // } - - // await prisma.posAccount.createMany({ - // data: posAccounts, - // }) - // } - + posAccounts.push({ + name: `پوز ${inventory.name}`, + code: `POS${(i + 1).toString().padStart(3, '0')}`, + description: `پوز فروشگاه ${inventory.name}`, + inventoryId: inventory.id, + bankAccountId: inventoryBankAccount.bankAccountId, + }) + } + } + await prisma.posAccount.createMany({ + data: posAccounts, + }) + } // Seed purchase, transfer, and sales transactions // const inventories = await prisma.inventory.findMany() // const products = await prisma.product.findMany({ take: 5 }) // select 5 products for demo @@ -343,7 +331,7 @@ async function main() { // items: products.map(product => ({ // productId: product.id, // count: 10, - // fee: Number(product.salePrice), + // unitPrice: Number(product.salePrice), // total: 10 * Number(product.salePrice), // })), // }) diff --git a/prisma/triggers/20250101_add_triggers/migration.sql b/prisma/triggers/20250101_add_triggers/migration.sql deleted file mode 100644 index bb53723..0000000 --- a/prisma/triggers/20250101_add_triggers/migration.sql +++ /dev/null @@ -1,332 +0,0 @@ --- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-10T10:03:36.966Z - --- ------------------------------------------ --- Trigger: trg_transfer_item_after_insert --- Event: INSERT --- 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 toInv INT; - - SELECT fromInventoryId, toInventoryId INTO fromInv, toInv - FROM Inventory_Transfers WHERE id = NEW.transferId; - - -- OUT from source - INSERT INTO Stock_Movements - (type, quantity, referenceType, referenceId, productId, inventoryId, createdAt) - VALUES - ('OUT', NEW.count, 'InventoryTransfer', NEW.transferId, NEW.productId, fromInv, NOW()); - - -- IN to destination - INSERT INTO Stock_Movements - (type, quantity, referenceType, referenceId, productId, inventoryId, createdAt) - VALUES - ('IN', NEW.count, 'InventoryTransfer', NEW.transferId, NEW.productId, toInv, NOW()); -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 DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER INSERT ON `Purchase_Receipt_Items` FOR EACH ROW begin - INSERT INTO Stock_Movements - ( - type, - quantity, - fee, - totalCost, - referenceType, - referenceId, - productId, - inventoryId, - avgCost, - createdAt - ) - VALUES - ( - 'IN', - NEW.count, - NEW.fee, - NEW.total, - 'PURCHASE', - NEW.receiptId, - NEW.productId, - (SELECT inventoryId FROM Purchase_Receipts WHERE id = NEW.receiptId), - NEW.total / NEW.count, - NOW() - ); -end; - --- ------------------------------------------ --- Trigger: trg_purchase_receipt_item_after_update --- Event: UPDATE --- Table: Purchase_Receipt_Items --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_update`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_update` AFTER UPDATE ON `Purchase_Receipt_Items` FOR EACH ROW begin - DELETE FROM Stock_Movements - WHERE referenceType = 'PURCHASE' - AND referenceId = NEW.receiptId - AND productId = NEW.productId; - - INSERT INTO Stock_Movements - ( - type, - quantity, - referenceType, - referenceId, - productId, - inventoryId, - createdAt - ) - VALUES - ( - 'IN', - NEW.count, - 'SALES', - NEW.id, - NEW.productId, - (SELECT inventoryId FROM Stores LIMIT 1), - NOW() - ); -end; - --- ------------------------------------------ --- Trigger: trg_purchase_receipt_item_after_delete --- Event: DELETE --- Table: Purchase_Receipt_Items --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_delete`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_delete` AFTER DELETE ON `Purchase_Receipt_Items` FOR EACH ROW begin - DELETE FROM Stock_Movements - WHERE referenceType = 'PURCHASE' - AND referenceId = OLD.receiptId - AND productId = OLD.productId; -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 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); - - SELECT stock INTO current_stock - FROM stock_view - WHERE productId = NEW.productId - LIMIT 1; - - IF current_stock IS NULL THEN - SET current_stock = 0; - END IF; - - IF NEW.count > current_stock THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Not enough stock to complete sale.'; - 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 DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin - INSERT INTO Stock_Movements - ( - type, - quantity, - referenceType, - referenceId, - productId, - inventoryId, - createdAt - ) - VALUES - ( - 'IN', - NEW.count, - 'PURCHASE', - NEW.id, - NEW.productId, - (SELECT inventoryId FROM Sales_Invoices WHERE id = NEW.id), - NOW() - ); -end; - --- ------------------------------------------ --- Trigger: trg_stock_adjustment_after_insert --- Event: INSERT --- Table: Stock_Adjustments --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_adjustment_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_adjustment_after_insert` AFTER INSERT ON `Stock_Adjustments` FOR EACH ROW begin - INSERT INTO Stock_Movements - (type, quantity, referenceType, referenceId, productId, inventoryId, createdAt) - VALUES - ('ADJUST', NEW.adjustedQuantity, 'ADJUSTMENT', NEW.id, NEW.productId, NEW.inventoryId, NOW()); -end; - --- ------------------------------------------ --- Trigger: trg_stock_sale_insert --- Event: INSERT --- 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 - - UPDATE stock_balance - SET - quantity = quantity - NEW.quantity, - totalCost = quantity * avgCost - WHERE productId = NEW.productId ; - - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_purchase_insert --- Event: INSERT --- 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) - VALUES ( - NEW.productId, - NEW.quantity, - NEW.fee, - NEW.totalCost - ) - ON DUPLICATE KEY UPDATE - quantity = quantity + NEW.quantity, - totalCost = totalCost + NEW.totalCost, - avgCost = totalCost / quantity; - - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_movement_after_insert --- Event: INSERT --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_movement_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_movement_after_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW begin - UPDATE Products pv - SET pv.quantity = ( - SELECT COALESCE(SUM( - CASE - WHEN type = 'IN' THEN quantity - WHEN type = 'OUT' THEN -quantity - WHEN type = 'ADJUST' THEN quantity - END - ), 0) - FROM Stock_Movements - WHERE productId = NEW.productId - ) - WHERE pv.id = NEW.productId; -end; - --- ------------------------------------------ --- Trigger: trg_stock_sale_update --- Event: UPDATE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_sale_update`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_update` AFTER UPDATE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity + OLD.quantity, - totalCost = (quantity + OLD.quantity) * avgCost - WHERE productId = OLD.productId; - END IF; - - IF NEW.referenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity - NEW.quantity, - totalCost = (quantity - NEW.quantity) * avgCost - WHERE productId = NEW.productId; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_purchase_update --- Event: UPDATE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_purchase_update`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_update` AFTER UPDATE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'PURCHASE' THEN - UPDATE stock_balance - SET - quantity = quantity - OLD.quantity, - totalCost = totalCost - (OLD.quantity * OLD.fee) - WHERE productId = OLD.productId; - END IF; - - IF NEW.referenceType = 'PURCHASE' THEN - INSERT INTO stock_balance (productId, quantity, avgCost, totalCost) - VALUES ( - NEW.productId, - NEW.quantity, - NEW.fee, - NEW.totalCost - ) - ON DUPLICATE KEY UPDATE - quantity = quantity + NEW.quantity, - totalCost = totalCost + NEW.totalCost, - avgCost = totalCost / quantity; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_sale_delete --- Event: DELETE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_sale_delete`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_delete` AFTER DELETE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.ReferenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity + OLD.quantity, - totalCost = (quantity + OLD.quantity) * avgCost - WHERE productId = OLD.productId; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_purchase_delete --- Event: DELETE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_purchase_delete`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_delete` AFTER DELETE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'PURCHASE' THEN - UPDATE stock_balance - SET - quantity = quantity - OLD.quantity, - totalCost = totalCost - (OLD.quantity * OLD.fee), - avgCost = CASE - WHEN quantity - OLD.quantity = 0 THEN 0 - ELSE (totalCost - (OLD.quantity * OLD.fee)) / (quantity - OLD.quantity) - END - WHERE productId = OLD.productId; - END IF; -END; - diff --git a/prisma/triggers/auto_dump_triggers.sql b/prisma/triggers/auto_dump_triggers.sql deleted file mode 100644 index 9987177..0000000 --- a/prisma/triggers/auto_dump_triggers.sql +++ /dev/null @@ -1,5 +0,0 @@ --- Auto-generated trigger dump -DELIMITER 8488 --- Trigger: 1 -8488 -DELIMITER ; diff --git a/prisma/triggers/dump_triggers.sql b/prisma/triggers/dump_triggers.sql index 8ff0cd1..a0e2921 100644 --- a/prisma/triggers/dump_triggers.sql +++ b/prisma/triggers/dump_triggers.sql @@ -1,7 +1,34 @@ -- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-30T15:42:45.224Z +-- Generated at: 2026-01-04T09:46:30.365Z -- ------------------------------------------ +-- index: 1 +-- Trigger: trg_bank_account_transaction_after_insert +-- Event: INSERT +-- Table: Bank_Account_Transactions +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_bank_account_transaction_after_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_bank_account_transaction_after_insert` AFTER INSERT ON `Bank_Account_Transactions` FOR EACH ROW BEGIN + IF NEW.type = 'DEPOSIT' THEN + UPDATE Bank_Account_Balance SET balance = balance + NEW.amount WHERE bankAccountId = NEW.bankAccountId; + ELSEIF NEW.type = 'WITHDRAWAL' THEN + UPDATE Bank_Account_Balance SET balance = balance - NEW.amount WHERE bankAccountId = NEW.bankAccountId; + END IF; +END; + +-- ------------------------------------------ +-- index: 2 +-- Trigger: trg_bank_account_transaction_after_delete +-- Event: DELETE +-- Table: Bank_Account_Transactions +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_bank_account_transaction_after_delete`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_bank_account_transaction_after_delete` AFTER DELETE ON `Bank_Account_Transactions` FOR EACH ROW BEGIN + UPDATE Bank_Accounts SET balance = balance - OLD.amount; +END; + +-- ------------------------------------------ +-- index: 3 -- Trigger: trg_transfer_item_after_insert -- Event: INSERT -- Table: Inventory_Transfer_Items @@ -27,18 +54,71 @@ DECLARE fromInv INT; -- OUT from source INSERT INTO Stock_Movements - (type, quantity, fee, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + (type, quantity, unitPrice, 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) + (type, quantity, unitPrice, 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; -- ------------------------------------------ +-- index: 4 +-- Trigger: trg_order_item_after_insert +-- Event: INSERT +-- Table: Order_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_item_after_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_insert` AFTER INSERT ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations SET quantity = quantity + NEW.quantity + WHERE orderId = NEW.orderId AND productId = NEW.productId; +END; + +-- ------------------------------------------ +-- index: 5 +-- Trigger: trg_order_item_after_update +-- Event: UPDATE +-- Table: Order_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_item_after_update`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_update` AFTER UPDATE ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations + SET quantity = quantity - OLD.quantity + NEW.quantity + WHERE orderId = NEW.orderId AND productId = NEW.productId; +END; + +-- ------------------------------------------ +-- index: 6 +-- Trigger: trg_order_item_after_delete +-- Event: DELETE +-- Table: Order_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_item_after_delete`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_delete` AFTER DELETE ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations SET quantity = quantity - OLD.quantity + WHERE orderId = OLD.orderId AND productId = OLD.productId; + +END; + +-- ------------------------------------------ +-- index: 7 +-- Trigger: trg_order_after_cancel +-- Event: UPDATE +-- Table: Orders +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_after_cancel`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_after_cancel` AFTER UPDATE ON `Orders` FOR EACH ROW BEGIN + IF NEW.status = 'CANCELED' OR NEW.status = 'REJECTED' OR NEW.status = 'DONE' THEN + UPDATE Stock_Reservations sr SET quantity = 0 + WHERE sr.orderId = NEW.id; + END IF; +END; + +-- ------------------------------------------ +-- index: 8 -- Trigger: trg_purchase_receipt_item_after_insert -- Event: INSERT -- Table: Purchase_Receipt_Items @@ -49,7 +129,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER DECLARE invId INT; DECLARE suppId INT; - -- Get inventory & supplier from + -- Get inventory & supplier from SELECT inventoryId, supplierId INTO invId, suppId FROM Purchase_Receipts @@ -67,7 +147,7 @@ DECLARE invId INT; INSERT INTO Stock_Movements ( type, quantity, - fee, + unitPrice, totalCost, referenceType, referenceId, @@ -81,15 +161,15 @@ DECLARE invId INT; VALUES ( 'IN', NEW.count, - NEW.fee, - NEW.total, + NEW.unitPrice, + NEW.totalAmount, 'PURCHASE', NEW.receiptId, NEW.productId, invId, CASE WHEN NEW.count = 0 THEN 0 - ELSE NEW.total / NEW.count + ELSE NEW.totalAmount / NEW.count END , @@ -101,16 +181,18 @@ DECLARE invId INT; END; -- ------------------------------------------ +-- index: 9 -- Trigger: trg_pr_payment_before_insert -- Event: INSERT -- Table: Purchase_Receipt_Payments -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_pr_payment_before_insert`; CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_before_insert` BEFORE INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + + DECLARE receiptTotal DECIMAL(14,2); DECLARE paid DECIMAL(14,2); - INSERT INTO Trigger_Logs (name , message) VALUES ('trigger' , 'started'); SELECT totalAmount, paidAmount INTO receiptTotal, paid @@ -125,6 +207,121 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_before_insert` BEFORE INSERT ON END; -- ------------------------------------------ +-- index: 10 +-- Trigger: trg_purchase_payment_update_receipt +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_payment_update_receipt`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_payment_update_receipt` AFTER INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + DECLARE paid DECIMAL(15,2); + DECLARE total DECIMAL(15,2); + + SELECT + COALESCE(SUM( + CASE WHEN type = 'PAYMENT' THEN amount ELSE -amount END + ),0) + INTO paid + FROM Purchase_Receipt_Payments + WHERE receiptId = NEW.receiptId; + + SELECT totalAmount INTO total + FROM Purchase_Receipts + WHERE id = NEW.receiptId; + + UPDATE Purchase_Receipts + SET + paidAmount = paid, + status = CASE + WHEN paid = 0 THEN 'UNPAID' + WHEN paid < total THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = NEW.receiptId; +END; + +-- ------------------------------------------ +-- index: 11 +-- Trigger: trg_purchase_payment_after_insert +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_payment_after_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_payment_after_insert` AFTER INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + +DECLARE currentBalance DECIMAL(15, 2); + + +SELECT balance INTO currentBalance +FROM Bank_Account_Balance +WHERE + bankAccountId = NEW.bankAccountId FOR +UPDATE; + + +IF currentBalance IS NULL THEN SET currentBalance = 0; + + +INSERT INTO + Bank_Account_Balance (bankAccountId, balance, updatedAt) +VALUES (NEW.bankAccountId, 0, NOW()); + +END IF; + +IF NEW.type = 'PAYMENT' THEN +SET + currentBalance = currentBalance - NEW.amount; + +INSERT INTO + Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) +VALUES ( + NEW.bankAccountId, + 'WITHDRAWAL', + NEW.amount, + currentBalance, + 'PURCHASE_PAYMENT', + NEW.id + ); + +ELSE SET currentBalance = currentBalance + NEW.amount; + +INSERT INTO + Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) +VALUES ( + NEW.bankAccountId, + 'DEPOSIT', + NEW.amount, + currentBalance, + 'PURCHASE_REFUND', + NEW.id + ); + +END IF; + +UPDATE Bank_Account_Balance +SET + balance = currentBalance +WHERE + bankAccountId = NEW.bankAccountId; + +END; + +-- ------------------------------------------ +-- index: 12 -- Trigger: trg_pr_payment_after_insert -- Event: INSERT -- Table: Purchase_Receipt_Payments @@ -134,7 +331,8 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_insert` AFTER INSERT ON ` DECLARE receiptTotal DECIMAL(14,2) Default 0; DECLARE newPaid DECIMAL(14,2) Default 0; DECLARE _supplierId INT; - DECLARE lastBalance DECIMAL(14,2)Default 0; + DECLARE lastBalance DECIMAL(14,2) Default 0; + -- Lock receipt row SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId @@ -142,8 +340,6 @@ SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId FROM Purchase_Receipts WHERE id = NEW.receiptId FOR UPDATE; - - INSERT INTO Trigger_Logs (name, message) VALUES ('supplierId', _supplierId); -- Apply payment or refund IF NEW.type = 'PAYMENT' THEN @@ -172,6 +368,8 @@ SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId ORDER BY id DESC LIMIT 1; + + -- Insert supplier ledger INSERT INTO Supplier_Ledger ( @@ -198,6 +396,7 @@ SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId END; -- ------------------------------------------ +-- index: 13 -- Trigger: trg_pr_payment_after_delete -- Event: DELETE -- Table: Purchase_Receipt_Payments @@ -232,6 +431,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_delete` AFTER DELETE ON ` END; -- ------------------------------------------ +-- index: 14 -- Trigger: trg_purchase_receipt_after_insert -- Event: INSERT -- Table: Purchase_Receipts @@ -270,23 +470,24 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_after_insert` AFTER INSER END; -- ------------------------------------------ +-- index: 15 -- Trigger: trg_sales_invoice_items_before_insert -- Event: INSERT -- 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 +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 pa.inventoryId INTO inventory_id FROM Pos_Accounts pa INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId WHERE si.id = NEW.invoiceId; - + SELECT COALESCE(quantity, 0) INTO current_stock FROM Stock_Balance sb @@ -302,6 +503,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE end; -- ------------------------------------------ +-- index: 16 -- Trigger: trg_sales_invoice_items_after_insert -- Event: INSERT -- Table: Sales_Invoice_Items @@ -340,7 +542,7 @@ DECLARE pos_id INT; INSERT INTO Stock_Movements ( type, quantity, - fee, + unitPrice, totalCost, referenceType, referenceId, @@ -354,8 +556,8 @@ DECLARE pos_id INT; VALUES ( 'OUT', NEW.count, - NEW.fee, - NEW.total, + NEW.unitPrice, + NEW.totalAmount, 'SALES', NEW.invoiceId, NEW.productId, @@ -363,7 +565,7 @@ DECLARE pos_id INT; CASE WHEN NEW.count = 0 THEN 0 - ELSE NEW.total / NEW.count + ELSE NEW.totalAmount / NEW.count END, current_stock - NEW.count, customer_id, @@ -374,6 +576,82 @@ DECLARE pos_id INT; END; -- ------------------------------------------ +-- index: 17 +-- Trigger: trg_sales_invoice_payment_after_insert +-- Event: INSERT +-- Table: Sales_Invoice_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_sales_invoice_payment_after_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_payment_after_insert` AFTER INSERT ON `Sales_Invoice_Payments` FOR EACH ROW BEGIN + DECLARE currentBalance DECIMAL(15,2); + DECLARE bankAccountId INT; + + SELECT pa.bankAccountId INTO bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + + SELECT balance INTO currentBalance + FROM Bank_Account_Balance + WHERE bankAccountId = bankAccountId + FOR UPDATE; + + IF currentBalance IS NULL THEN + SET currentBalance = 0; + INSERT INTO Bank_Account_Balance (bankAccountId, balance) + VALUES (bankAccountId, 0); + END IF; + + SET currentBalance = currentBalance + NEW.amount; + + INSERT INTO Bank_Account_Transactions + (bankAccountId, type, amount, balanceAfter, referenceType, referenceId) + VALUES + (bankAccountId, 'DEPOSIT', NEW.amount, currentBalance, 'POS_SALE', NEW.id); + + UPDATE Bank_Account_Balance + SET balance = currentBalance + WHERE bankAccountId = bankAccountId; +END; + +-- ------------------------------------------ +-- index: 18 +-- Trigger: trg_pos_account_payment_after_insert +-- Event: INSERT +-- Table: Sales_Invoice_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_pos_account_payment_after_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_pos_account_payment_after_insert` AFTER INSERT ON `Sales_Invoice_Payments` FOR EACH ROW BEGIN + + DECLARE _bankAccountId INT; + + IF(NEW.paymentMethod != 'CASH') THEN + SELECT cashBankAccountId INTO _bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + End IF; + + INSERT INTO Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) + VALUES( + _bankAccountId, + 'DEPOSIT', + NEW.amount, + 0, + 'POS_SALE', + NEW.id + ); +END; + +-- ------------------------------------------ +-- index: 19 -- Trigger: trg_stock_transfer -- Event: INSERT -- Table: Stock_Movements @@ -442,8 +720,8 @@ VALUES ( NEW.productId, NEW.inventoryId, - NEW.quantity, - - COALESCE(NEW.fee, 0) * NEW.quantity, - COALESCE(NEW.fee, 0), + - COALESCE(NEW.unitPrice, 0) * NEW.quantity, + COALESCE(NEW.unitPrice, 0), NOW() ); @@ -456,6 +734,7 @@ END IF; END; -- ------------------------------------------ +-- index: 20 -- Trigger: trg_stock_purchase_insert -- Event: INSERT -- Table: Stock_Movements @@ -475,7 +754,7 @@ INSERT INTO VALUES ( NEW.productId, NEW.quantity, - NEW.fee, + NEW.unitPrice, NEW.totalCost, NEW.inventoryId, NOW() @@ -490,6 +769,7 @@ END IF; END; -- ------------------------------------------ +-- index: 21 -- Trigger: trg_stock_sale_insert -- Event: INSERT -- Table: Stock_Movements @@ -509,7 +789,7 @@ INSERT INTO VALUES ( NEW.productId, NEW.quantity, - NEW.fee, + NEW.unitPrice, NEW.totalCost, NEW.inventoryId, NOW() diff --git a/prisma/triggers/dump_triggers_Backup.sql b/prisma/triggers/dump_triggers_Backup.sql index 94732b9..8b84924 100644 --- a/prisma/triggers/dump_triggers_Backup.sql +++ b/prisma/triggers/dump_triggers_Backup.sql @@ -1,476 +1,825 @@ -- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-10T10:03:36.966Z +-- Generated at: 2026-01-04T09:46:30.365Z -- ------------------------------------------ +-- index: 1 +-- Trigger: trg_bank_account_transaction_after_insert +-- Event: INSERT +-- Table: Bank_Account_Transactions +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_bank_account_transaction_after_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_bank_account_transaction_after_insert` AFTER INSERT ON `Bank_Account_Transactions` FOR EACH ROW BEGIN + IF NEW.type = 'DEPOSIT' THEN + UPDATE Bank_Account_Balance SET balance = balance + NEW.amount WHERE bankAccountId = NEW.bankAccountId; + ELSEIF NEW.type = 'WITHDRAWAL' THEN + UPDATE Bank_Account_Balance SET balance = balance - NEW.amount WHERE bankAccountId = NEW.bankAccountId; + END IF; +END; + +-- ------------------------------------------ +-- index: 2 +-- Trigger: trg_bank_account_transaction_after_delete +-- Event: DELETE +-- Table: Bank_Account_Transactions +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_bank_account_transaction_after_delete`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_bank_account_transaction_after_delete` AFTER DELETE ON `Bank_Account_Transactions` FOR EACH ROW BEGIN + UPDATE Bank_Accounts SET balance = balance - OLD.amount; +END; + +-- ------------------------------------------ +-- index: 3 -- Trigger: trg_transfer_item_after_insert -- Event: INSERT -- Table: Inventory_Transfer_Items --- Status: ACTIVE -- ------------------------------------------ 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); + DECLARE latestQuantityInDestination DECIMAL(10,2); SELECT fromInventoryId, toInventoryId INTO fromInv, toInv FROM Inventory_Transfers WHERE id = NEW.transferId; - SELECT COALESCE(avgCost, 0) INTO _avgCost FROM Stock_Balance + 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, createdAt) + (type, quantity, unitPrice, 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, NOW()); + ('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) + (type, quantity, unitPrice, 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, NOW()); + ('IN', NEW.count,_avgCost, _avgCost*NEW.count,_avgCost, 'INVENTORY_TRANSFER', NEW.transferId, NEW.productId, toInv, fromInv, NOW(), latestQuantityInOrigin-NEW.count); end; -- ------------------------------------------ --- Trigger: trg_stock_purchase_insert +-- index: 4 +-- Trigger: trg_order_item_after_insert -- Event: INSERT --- Table: Stock_Movements --- Status: ACTIVE +-- Table: Order_Items -- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_purchase_insert`; +DROP TRIGGER IF EXISTS `trg_order_item_after_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; - - END IF; -END +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_insert` AFTER INSERT ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations SET quantity = quantity + NEW.quantity + WHERE orderId = NEW.orderId AND productId = NEW.productId; +END; -- ------------------------------------------ --- Trigger: trg_stock_transfer --- Event: INSERT --- Table: Stock_Movements --- Status: ACTIVE --- ------------------------------------------ -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 ( - 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_purchase_receipt_item_after_insert --- Event: INSERT --- Table: Purchase_Receipt_Items --- Status: ACTIVE --- ------------------------------------------ -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 - INSERT INTO Stock_Movements - ( - type, - quantity, - fee, - totalCost, - referenceType, - referenceId, - productId, - inventoryId, - supplierId, - avgCost, - createdAt - ) - VALUES - ( - 'IN', - NEW.count, - NEW.fee, - NEW.total, - 'PURCHASE', - NEW.receiptId, - NEW.productId, - (SELECT inventoryId FROM Purchase_Receipts WHERE id = NEW.receiptId), - (SELECT supplierId FROM Purchase_Receipts WHERE id = NEW.receiptId), - NEW.total/NEW.count, - NOW() - ); -end - --- NEW -- - --- ------------------------------------------ --- Trigger: trg_purchase_receipt_item_after_insert --- Event: INSERT --- 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 - INSERT INTO Stock_Movements - ( - type, - quantity, - referenceType, - referenceId, - productId, - inventoryId, - createdAt - ) - VALUES - ( - 'IN', - NEW.count, - 'PURCHASE', - NEW.receiptId, - NEW.productId, - (SELECT inventoryId FROM Purchase_Receipts WHERE id = NEW.receiptId), - NOW() - ); -end; - --- ------------------------------------------ --- Trigger: trg_purchase_receipt_item_after_update +-- index: 5 +-- Trigger: trg_order_item_after_update -- Event: UPDATE +-- Table: Order_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_item_after_update`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_update` AFTER UPDATE ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations + SET quantity = quantity - OLD.quantity + NEW.quantity + WHERE orderId = NEW.orderId AND productId = NEW.productId; +END; + +-- ------------------------------------------ +-- index: 6 +-- Trigger: trg_order_item_after_delete +-- Event: DELETE +-- Table: Order_Items +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_item_after_delete`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_delete` AFTER DELETE ON `Order_Items` FOR EACH ROW BEGIN + UPDATE Stock_Reservations SET quantity = quantity - OLD.quantity + WHERE orderId = OLD.orderId AND productId = OLD.productId; + +END; + +-- ------------------------------------------ +-- index: 7 +-- Trigger: trg_order_after_cancel +-- Event: UPDATE +-- Table: Orders +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_order_after_cancel`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_after_cancel` AFTER UPDATE ON `Orders` FOR EACH ROW BEGIN + IF NEW.status = 'CANCELED' OR NEW.status = 'REJECTED' OR NEW.status = 'DONE' THEN + UPDATE Stock_Reservations sr SET quantity = 0 + WHERE sr.orderId = NEW.id; + END IF; +END; + +-- ------------------------------------------ +-- index: 8 +-- Trigger: trg_purchase_receipt_item_after_insert +-- Event: INSERT -- Table: Purchase_Receipt_Items -- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_update`; +DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_update` AFTER UPDATE ON `Purchase_Receipt_Items` FOR EACH ROW begin - DELETE FROM Stock_Movements - WHERE referenceType = 'PURCHASE' - AND referenceId = NEW.receiptId - AND productId = NEW.productId; +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; - INSERT INTO Stock_Movements - ( +DECLARE invId INT; + DECLARE suppId INT; + + -- Get inventory & supplier from + 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, + unitPrice, + totalCost, referenceType, referenceId, productId, inventoryId, + avgCost, + supplierId, + remainedInStock, createdAt ) - VALUES - ( - 'IN', - NEW.count, - 'SALES', - NEW.id, - NEW.productId, - (SELECT inventoryId FROM Stores LIMIT 1), - NOW() - ); -end; + VALUES ( + 'IN', + NEW.count, + NEW.unitPrice, + NEW.totalAmount, + 'PURCHASE', + NEW.receiptId, + NEW.productId, + invId, + CASE + WHEN NEW.count = 0 THEN 0 + ELSE NEW.totalAmount / NEW.count + END + +, + suppId, + latestQuantity + NEW.count, + NOW() + ); + +END; -- ------------------------------------------ --- Trigger: trg_purchase_receipt_item_after_delete +-- index: 9 +-- Trigger: trg_pr_payment_before_insert +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_pr_payment_before_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_before_insert` BEFORE INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + + + DECLARE receiptTotal DECIMAL(14,2); + DECLARE paid DECIMAL(14,2); + + + SELECT totalAmount, paidAmount + INTO receiptTotal, paid + FROM Purchase_Receipts + WHERE id = NEW.receiptId + FOR UPDATE; + + IF NEW.type = 'PAYMENT' AND paid + NEW.amount > receiptTotal THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'مجموع مبلغ پرداختی بیشتر از مبلغ فاکتور است.'; + END IF; +END; + +-- ------------------------------------------ +-- index: 10 +-- Trigger: trg_purchase_payment_update_receipt +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_payment_update_receipt`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_payment_update_receipt` AFTER INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + DECLARE paid DECIMAL(15,2); + DECLARE total DECIMAL(15,2); + + SELECT + COALESCE(SUM( + CASE WHEN type = 'PAYMENT' THEN amount ELSE -amount END + ),0) + INTO paid + FROM Purchase_Receipt_Payments + WHERE receiptId = NEW.receiptId; + + SELECT totalAmount INTO total + FROM Purchase_Receipts + WHERE id = NEW.receiptId; + + UPDATE Purchase_Receipts + SET + paidAmount = paid, + status = CASE + WHEN paid = 0 THEN 'UNPAID' + WHEN paid < total THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = NEW.receiptId; +END; + +-- ------------------------------------------ +-- index: 11 +-- Trigger: trg_purchase_payment_after_insert +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_payment_after_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_payment_after_insert` AFTER INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + +DECLARE currentBalance DECIMAL(15, 2); + + +SELECT balance INTO currentBalance +FROM Bank_Account_Balance +WHERE + bankAccountId = NEW.bankAccountId FOR +UPDATE; + + +IF currentBalance IS NULL THEN SET currentBalance = 0; + + +INSERT INTO + Bank_Account_Balance (bankAccountId, balance, updatedAt) +VALUES (NEW.bankAccountId, 0, NOW()); + +END IF; + +IF NEW.type = 'PAYMENT' THEN +SET + currentBalance = currentBalance - NEW.amount; + +INSERT INTO + Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) +VALUES ( + NEW.bankAccountId, + 'WITHDRAWAL', + NEW.amount, + currentBalance, + 'PURCHASE_PAYMENT', + NEW.id + ); + +ELSE SET currentBalance = currentBalance + NEW.amount; + +INSERT INTO + Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) +VALUES ( + NEW.bankAccountId, + 'DEPOSIT', + NEW.amount, + currentBalance, + 'PURCHASE_REFUND', + NEW.id + ); + +END IF; + +UPDATE Bank_Account_Balance +SET + balance = currentBalance +WHERE + bankAccountId = NEW.bankAccountId; + +END; + +-- ------------------------------------------ +-- index: 12 +-- Trigger: trg_pr_payment_after_insert +-- Event: INSERT +-- Table: Purchase_Receipt_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_pr_payment_after_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_insert` AFTER INSERT ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + DECLARE receiptTotal DECIMAL(14,2) Default 0; + DECLARE newPaid DECIMAL(14,2) Default 0; + DECLARE _supplierId INT; + DECLARE lastBalance DECIMAL(14,2) Default 0; + + + -- Lock receipt row +SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId + INTO receiptTotal, newPaid, _supplierId + FROM Purchase_Receipts + WHERE id = NEW.receiptId + FOR UPDATE; + + -- Apply payment or refund + IF NEW.type = 'PAYMENT' THEN + SET newPaid = newPaid + NEW.amount; + ELSE + SET newPaid = newPaid - NEW.amount; + END IF; + + -- Update receipt + UPDATE Purchase_Receipts + SET + paidAmount = newPaid, + status = + CASE + WHEN newPaid = 0 THEN 'UNPAID' + WHEN newPaid < receiptTotal THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = NEW.receiptId; + + -- Get last supplier balance + SELECT IFNULL(balance, 0) + INTO lastBalance + FROM Supplier_Ledger + WHERE supplierId = _supplierId + ORDER BY id DESC + LIMIT 1; + + + + -- Insert supplier ledger + INSERT INTO Supplier_Ledger + ( + supplierId, + debit, + credit, + balance, + sourceType, + sourceId, + createdAt + ) + VALUES + ( + _supplierId, + IF(NEW.type = 'REFUND', NEW.amount, 0), + IF(NEW.type = 'PAYMENT', NEW.amount, 0), + lastBalance + + IF(NEW.type = 'PAYMENT', NEW.amount, 0) + - IF(NEW.type = 'REFUND', NEW.amount, 0), + 'PAYMENT', + NEW.id, + NOW() + ); +END; + +-- ------------------------------------------ +-- index: 13 +-- Trigger: trg_pr_payment_after_delete -- Event: DELETE --- Table: Purchase_Receipt_Items +-- Table: Purchase_Receipt_Payments -- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_delete`; +DROP TRIGGER IF EXISTS `trg_pr_payment_after_delete`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_delete` AFTER DELETE ON `Purchase_Receipt_Items` FOR EACH ROW begin - DELETE FROM Stock_Movements - WHERE referenceType = 'PURCHASE' - AND referenceId = OLD.receiptId - AND productId = OLD.productId; -end; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_delete` AFTER DELETE ON `Purchase_Receipt_Payments` FOR EACH ROW BEGIN + DECLARE receiptTotal DECIMAL(14,2); + DECLARE newPaid DECIMAL(14,2); + + SELECT totalAmount, paidAmount + INTO receiptTotal, newPaid + FROM Purchase_Receipts + WHERE id = OLD.receiptId + FOR UPDATE; + + IF OLD.type = 'PAYMENT' THEN + SET newPaid = newPaid - OLD.amount; + ELSE + SET newPaid = newPaid + OLD.amount; + END IF; + + UPDATE Purchase_Receipts + SET + paidAmount = newPaid, + status = + CASE + WHEN newPaid = 0 THEN 'UNPAID' + WHEN newPaid < receiptTotal THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = OLD.receiptId; +END; -- ------------------------------------------ +-- index: 14 +-- Trigger: trg_purchase_receipt_after_insert +-- Event: INSERT +-- Table: Purchase_Receipts +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_purchase_receipt_after_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_after_insert` AFTER INSERT ON `Purchase_Receipts` FOR EACH ROW BEGIN + DECLARE lastBalance DECIMAL(14,2) DEFAULT 0; + + SELECT COALESCE(balance, 0) + INTO lastBalance + FROM Supplier_Ledger + WHERE supplierId = NEW.supplierId + ORDER BY id DESC + LIMIT 1; + + INSERT INTO Supplier_Ledger + ( + supplierId, + debit, + credit, + balance, + sourceType, + sourceId, + createdAt + ) + VALUES + ( + NEW.supplierId, + NEW.totalAmount, + 0, + lastBalance - NEW.totalAmount, + 'PURCHASE', + NEW.id, + NOW() + ); +END; + +-- ------------------------------------------ +-- index: 15 -- Trigger: trg_sales_invoice_items_before_insert -- Event: INSERT -- 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); +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE INSERT ON `Sales_Invoice_Items` FOR EACH ROW BEGIN - SELECT stock INTO current_stock - FROM stock_view - WHERE productId = NEW.productId + DECLARE current_stock DECIMAL(10, 2); + DECLARE inventory_id INT; + + + + SELECT pa.inventoryId INTO inventory_id + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + + + SELECT COALESCE(quantity, 0) INTO current_stock + FROM Stock_Balance sb + WHERE productId = NEW.productId AND sb.inventoryId = inventory_id LIMIT 1; - IF current_stock IS NULL THEN - SET current_stock = 0; - END IF; + IF NEW.count > current_stock THEN SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Not enough stock to complete sale.'; + SET MESSAGE_TEXT = 'موجودی کالا در انبار کافی نیست.'; END IF; end; -- ------------------------------------------ +-- index: 16 -- Trigger: trg_sales_invoice_items_after_insert -- Event: INSERT -- 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 - INSERT INTO Stock_Movements - ( +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; +DECLARE pos_id INT; + + + + SELECT posAccountId, customerId INTO pos_id, customer_id + FROM Sales_Invoices si + WHERE si.id = NEW.invoiceId + LIMIT 1; + INSERT INTO Trigger_Logs (name , message) VALUES ('pos_id', pos_id); + INSERT INTO Trigger_Logs (name , message) VALUES ('customer_id', customer_id); + + + SELECT pa.inventoryId INTO inventory_id + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + + + + 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, + unitPrice, + totalCost, referenceType, referenceId, productId, inventoryId, + avgCost, + remainedInStock, + customerId, createdAt ) - VALUES - ( - 'IN', - NEW.count, - 'PURCHASE', - NEW.id, - NEW.productId, - (SELECT inventoryId FROM Sales_Invoices WHERE id = NEW.id), - NOW() - ); -end; + VALUES ( + 'OUT', + NEW.count, + NEW.unitPrice, + NEW.totalAmount, + 'SALES', + NEW.invoiceId, + NEW.productId, + inventory_id, + + CASE + WHEN NEW.count = 0 THEN 0 + ELSE NEW.totalAmount / NEW.count + END, + current_stock - NEW.count, + customer_id, + NOW() + ); + + +END; -- ------------------------------------------ --- Trigger: trg_stock_adjustment_after_insert +-- index: 17 +-- Trigger: trg_sales_invoice_payment_after_insert -- Event: INSERT --- Table: Stock_Adjustments +-- Table: Sales_Invoice_Payments -- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_adjustment_after_insert`; +DROP TRIGGER IF EXISTS `trg_sales_invoice_payment_after_insert`; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_adjustment_after_insert` AFTER INSERT ON `Stock_Adjustments` FOR EACH ROW begin - INSERT INTO Stock_Movements - (type, quantity, referenceType, referenceId, productId, inventoryId, createdAt) - VALUES - ('ADJUST', NEW.adjustedQuantity, 'ADJUSTMENT', NEW.id, NEW.productId, NEW.inventoryId, NOW()); -end; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_payment_after_insert` AFTER INSERT ON `Sales_Invoice_Payments` FOR EACH ROW BEGIN + DECLARE currentBalance DECIMAL(15,2); + DECLARE bankAccountId INT; + + SELECT pa.bankAccountId INTO bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + + SELECT balance INTO currentBalance + FROM Bank_Account_Balance + WHERE bankAccountId = bankAccountId + FOR UPDATE; + + IF currentBalance IS NULL THEN + SET currentBalance = 0; + INSERT INTO Bank_Account_Balance (bankAccountId, balance) + VALUES (bankAccountId, 0); + END IF; + + SET currentBalance = currentBalance + NEW.amount; + + INSERT INTO Bank_Account_Transactions + (bankAccountId, type, amount, balanceAfter, referenceType, referenceId) + VALUES + (bankAccountId, 'DEPOSIT', NEW.amount, currentBalance, 'POS_SALE', NEW.id); + + UPDATE Bank_Account_Balance + SET balance = currentBalance + WHERE bankAccountId = bankAccountId; +END; -- ------------------------------------------ +-- index: 18 +-- Trigger: trg_pos_account_payment_after_insert +-- Event: INSERT +-- Table: Sales_Invoice_Payments +-- ------------------------------------------ +DROP TRIGGER IF EXISTS `trg_pos_account_payment_after_insert`; + +CREATE DEFINER=`pos`@`%` TRIGGER `trg_pos_account_payment_after_insert` AFTER INSERT ON `Sales_Invoice_Payments` FOR EACH ROW BEGIN + + DECLARE _bankAccountId INT; + + IF(NEW.paymentMethod != 'CASH') THEN + SELECT cashBankAccountId INTO _bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = NEW.invoiceId; + End IF; + + INSERT INTO Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) + VALUES( + _bankAccountId, + 'DEPOSIT', + NEW.amount, + 0, + 'POS_SALE', + NEW.id + ); +END; + +-- ------------------------------------------ +-- index: 19 +-- Trigger: trg_stock_transfer +-- Event: INSERT +-- 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 ( + 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.unitPrice, 0) * NEW.quantity, + COALESCE(NEW.unitPrice, 0), + NOW() + ); + +END IF; + +END IF; + +END IF; + +END; + +-- ------------------------------------------ +-- index: 20 +-- Trigger: trg_stock_purchase_insert +-- Event: INSERT +-- 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.unitPrice, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity + NEW.quantity, + totalCost = totalCost + NEW.totalCost, + avgCost = totalCost / quantity; + +END IF; + +END; + +-- ------------------------------------------ +-- index: 21 -- Trigger: trg_stock_sale_insert -- Event: INSERT -- 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 +CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity - NEW.quantity, - totalCost = quantity * avgCost - WHERE productId = NEW.productId ; - - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_movement_after_insert --- Event: INSERT --- Table: Stock_Movements --- Status: ARCHIVED --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_movement_after_insert`; - -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_movement_after_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW begin - UPDATE Products pv - SET pv.quantity = ( - SELECT COALESCE(SUM( - CASE - WHEN type = 'IN' THEN quantity - WHEN type = 'OUT' THEN -quantity - WHEN type = 'ADJUST' THEN quantity - END - ), 0) - FROM Stock_Movements - WHERE productId = NEW.productId +INSERT INTO + Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt ) - WHERE pv.id = NEW.productId; -end; +VALUES ( + NEW.productId, + NEW.quantity, + NEW.unitPrice, + NEW.totalCost, + NEW.inventoryId, + NOW() + ) +ON DUPLICATE KEY UPDATE + quantity = quantity - NEW.quantity, + totalCost = totalCost - NEW.totalCost, + avgCost = totalCost / quantity; --- ------------------------------------------ --- Trigger: trg_stock_sale_update --- Event: UPDATE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_sale_update`; +END IF; -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_update` AFTER UPDATE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity + OLD.quantity, - totalCost = (quantity + OLD.quantity) * avgCost - WHERE productId = OLD.productId; - END IF; - - IF NEW.referenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity - NEW.quantity, - totalCost = (quantity - NEW.quantity) * avgCost - WHERE productId = NEW.productId; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_purchase_update --- Event: UPDATE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_purchase_update`; - -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_update` AFTER UPDATE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'PURCHASE' THEN - UPDATE stock_balance - SET - quantity = quantity - OLD.quantity, - totalCost = totalCost - (OLD.quantity * OLD.fee) - WHERE productId = OLD.productId; - END IF; - - IF NEW.referenceType = 'PURCHASE' THEN - INSERT INTO stock_balance (productId, quantity, avgCost, totalCost) - VALUES ( - NEW.productId, - NEW.quantity, - NEW.fee, - NEW.totalCost - ) - ON DUPLICATE KEY UPDATE - quantity = quantity + NEW.quantity, - totalCost = totalCost + NEW.totalCost, - avgCost = totalCost / quantity; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_sale_delete --- Event: DELETE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_sale_delete`; - -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_delete` AFTER DELETE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.ReferenceType = 'SALES' THEN - UPDATE stock_balance - SET - quantity = quantity + OLD.quantity, - totalCost = (quantity + OLD.quantity) * avgCost - WHERE productId = OLD.productId; - END IF; -END; - --- ------------------------------------------ --- Trigger: trg_stock_purchase_delete --- Event: DELETE --- Table: Stock_Movements --- ------------------------------------------ -DROP TRIGGER IF EXISTS `trg_stock_purchase_delete`; - -CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_delete` AFTER DELETE ON `Stock_Movements` FOR EACH ROW BEGIN - IF OLD.referenceType = 'PURCHASE' THEN - UPDATE stock_balance - SET - quantity = quantity - OLD.quantity, - totalCost = totalCost - (OLD.quantity * OLD.fee), - avgCost = CASE - WHEN quantity - OLD.quantity = 0 THEN 0 - ELSE (totalCost - (OLD.quantity * OLD.fee)) / (quantity - OLD.quantity) - END - WHERE productId = OLD.productId; - END IF; END; diff --git a/prisma/triggers/stored_procedures.sql b/prisma/triggers/stored_procedures.sql new file mode 100644 index 0000000..18b34e8 --- /dev/null +++ b/prisma/triggers/stored_procedures.sql @@ -0,0 +1,633 @@ +-- Stored Procedures equivalent to triggers + +DELIMITER // + +-- Procedure for trg_bank_account_transaction_after_insert +CREATE PROCEDURE update_bank_balance(IN p_bankAccountId INT, IN p_type VARCHAR(20), IN p_amount DECIMAL(15,2)) +BEGIN + IF p_type = 'DEPOSIT' THEN + UPDATE Bank_Account_Balance SET balance = balance + p_amount WHERE bankAccountId = p_bankAccountId; + ELSEIF p_type = 'WITHDRAWAL' THEN + UPDATE Bank_Account_Balance SET balance = balance - p_amount WHERE bankAccountId = p_bankAccountId; + END IF; +END // + +-- Procedure for trg_bank_account_transaction_after_delete +CREATE PROCEDURE update_bank_balance_on_delete(IN p_bankAccountId INT, IN p_amount DECIMAL(15,2)) +BEGIN + UPDATE Bank_Accounts SET balance = balance - p_amount WHERE id = p_bankAccountId; +END // + +-- Procedure for trg_transfer_item_after_insert +CREATE PROCEDURE process_transfer_item(IN p_transferId INT, IN p_productId INT, IN p_count DECIMAL(10,2)) +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 = p_transferId; + + SELECT COALESCE(avgCost, 0), COALESCE(quantity, 0) INTO _avgCost, latestQuantityInOrigin FROM Stock_Balance + WHERE ProductId = p_productId AND inventoryId = fromInv LIMIT 1; + + SELECT COALESCE(quantity, 0) INTO latestQuantityInDestination FROM Stock_Balance + WHERE ProductId = p_productId AND inventoryId = toInv LIMIT 1; + + -- OUT from source + INSERT INTO Stock_Movements + (type, quantity, unitPrice, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + VALUES + ('OUT', p_count, _avgCost, _avgCost*p_count, _avgCost, 'INVENTORY_TRANSFER', p_transferId, p_productId, fromInv, toInv, NOW(), latestQuantityInOrigin-p_count); + + -- IN to destination + INSERT INTO Stock_Movements + (type, quantity, unitPrice, totalCost, avgCost, referenceType, referenceId, productId, inventoryId, counterInventoryId, createdAt, remainedInStock) + VALUES + ('IN', p_count, _avgCost, _avgCost*p_count, _avgCost, 'INVENTORY_TRANSFER', p_transferId, p_productId, toInv, fromInv, NOW(), latestQuantityInOrigin-p_count); +END // + +-- Procedure for trg_order_item_after_insert +CREATE PROCEDURE update_stock_reservation_insert(IN p_orderId INT, IN p_productId INT, IN p_quantity DECIMAL(10,2)) +BEGIN + UPDATE Stock_Reservations SET quantity = quantity + p_quantity + WHERE orderId = p_orderId AND productId = p_productId; +END // + +-- Procedure for trg_order_item_after_update +CREATE PROCEDURE update_stock_reservation_update(IN p_orderId INT, IN p_productId INT, IN p_old_quantity DECIMAL(10,2), IN p_new_quantity DECIMAL(10,2)) +BEGIN + UPDATE Stock_Reservations + SET quantity = quantity - p_old_quantity + p_new_quantity + WHERE orderId = p_orderId AND productId = p_productId; +END // + +-- Procedure for trg_order_item_after_delete +CREATE PROCEDURE update_stock_reservation_delete(IN p_orderId INT, IN p_productId INT, IN p_quantity DECIMAL(10,2)) +BEGIN + UPDATE Stock_Reservations SET quantity = quantity - p_quantity + WHERE orderId = p_orderId AND productId = p_productId; +END // + +-- Procedure for trg_order_after_cancel +CREATE PROCEDURE cancel_order_stock(IN p_orderId INT, IN p_status VARCHAR(20)) +BEGIN + IF p_status = 'CANCELED' OR p_status = 'REJECTED' OR p_status = 'DONE' THEN + UPDATE Stock_Reservations sr SET quantity = 0 + WHERE sr.orderId = p_orderId; + END IF; +END // + +-- Procedure for trg_purchase_receipt_item_after_insert +CREATE PROCEDURE process_purchase_item(IN p_receiptId INT, IN p_productId INT, IN p_count DECIMAL(10,2), IN p_unitPrice DECIMAL(15,2), IN p_totalAmount DECIMAL(15,2)) +BEGIN + DECLARE latestQuantity DECIMAL(10, 2) DEFAULT 0; + DECLARE invId INT; + DECLARE suppId INT; + + -- Get inventory & supplier from + SELECT inventoryId, supplierId + INTO invId, suppId + FROM Purchase_Receipts + WHERE id = p_receiptId; + + -- Get current stock quantity (if exists) + SELECT COALESCE(quantity, 0) + INTO latestQuantity + FROM Stock_Balance sb + WHERE sb.inventoryId = invId + AND sb.productId = p_productId + LIMIT 1; + + -- Insert stock movement + INSERT INTO Stock_Movements ( + type, + quantity, + unitPrice, + totalCost, + referenceType, + referenceId, + productId, + inventoryId, + avgCost, + supplierId, + remainedInStock, + createdAt + ) + VALUES ( + 'IN', + p_count, + p_unitPrice, + p_totalAmount, + 'PURCHASE', + p_receiptId, + p_productId, + invId, + CASE + WHEN p_count = 0 THEN 0 + ELSE p_totalAmount / p_count + END, + suppId, + latestQuantity + p_count, + NOW() + ); +END // + +-- Procedure for trg_pr_payment_before_insert +CREATE PROCEDURE validate_payment_before_insert(IN p_receiptId INT, IN p_type VARCHAR(20), IN p_amount DECIMAL(15,2)) +BEGIN + DECLARE receiptTotal DECIMAL(14,2); + DECLARE paid DECIMAL(14,2); + + SELECT totalAmount, paidAmount + INTO receiptTotal, paid + FROM Purchase_Receipts + WHERE id = p_receiptId + FOR UPDATE; + + IF p_type = 'PAYMENT' AND paid + p_amount > receiptTotal THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'مجموع مبلغ پرداختی بیشتر از مبلغ فاکتور است.'; + END IF; +END // + +-- Procedure for trg_purchase_payment_update_receipt +CREATE PROCEDURE update_receipt_payment(IN p_receiptId INT) +BEGIN + DECLARE paid DECIMAL(15,2); + DECLARE total DECIMAL(15,2); + + SELECT + COALESCE(SUM( + CASE WHEN type = 'PAYMENT' THEN amount ELSE -amount END + ),0) + INTO paid + FROM Purchase_Receipt_Payments + WHERE receiptId = p_receiptId; + + SELECT totalAmount INTO total + FROM Purchase_Receipts + WHERE id = p_receiptId; + + UPDATE Purchase_Receipts + SET + paidAmount = paid, + status = CASE + WHEN paid = 0 THEN 'UNPAID' + WHEN paid < total THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = p_receiptId; +END // + +-- Procedure for trg_purchase_payment_after_insert +CREATE PROCEDURE process_purchase_payment(IN p_bankAccountId INT, IN p_type VARCHAR(20), IN p_amount DECIMAL(15,2), IN p_id INT) +BEGIN + DECLARE currentBalance DECIMAL(15, 2); + + SELECT balance INTO currentBalance + FROM Bank_Account_Balance + WHERE bankAccountId = p_bankAccountId FOR UPDATE; + + IF currentBalance IS NULL THEN SET currentBalance = 0; + INSERT INTO Bank_Account_Balance (bankAccountId, balance, updatedAt) + VALUES (p_bankAccountId, 0, NOW()); + END IF; + + IF p_type = 'PAYMENT' THEN + SET currentBalance = currentBalance - p_amount; + INSERT INTO Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) + VALUES ( + p_bankAccountId, + 'WITHDRAWAL', + p_amount, + currentBalance, + 'PURCHASE_PAYMENT', + p_id + ); + ELSE + SET currentBalance = currentBalance + p_amount; + INSERT INTO Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) + VALUES ( + p_bankAccountId, + 'DEPOSIT', + p_amount, + currentBalance, + 'PURCHASE_REFUND', + p_id + ); + END IF; + + UPDATE Bank_Account_Balance + SET balance = currentBalance + WHERE bankAccountId = p_bankAccountId; +END // + +-- Procedure for trg_pr_payment_after_insert +CREATE PROCEDURE update_supplier_ledger(IN p_receiptId INT, IN p_type VARCHAR(20), IN p_amount DECIMAL(15,2), IN p_id INT) +BEGIN + DECLARE receiptTotal DECIMAL(14,2) DEFAULT 0; + DECLARE newPaid DECIMAL(14,2) DEFAULT 0; + DECLARE _supplierId INT; + DECLARE lastBalance DECIMAL(14,2) DEFAULT 0; + + -- Lock receipt row + SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId + INTO receiptTotal, newPaid, _supplierId + FROM Purchase_Receipts + WHERE id = p_receiptId + FOR UPDATE; + + -- Apply payment or refund + IF p_type = 'PAYMENT' THEN + SET newPaid = newPaid + p_amount; + ELSE + SET newPaid = newPaid - p_amount; + END IF; + + -- Update receipt + UPDATE Purchase_Receipts + SET + paidAmount = newPaid, + status = + CASE + WHEN newPaid = 0 THEN 'UNPAID' + WHEN newPaid < receiptTotal THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = p_receiptId; + + -- Get last supplier balance + SELECT IFNULL(balance, 0) + INTO lastBalance + FROM Supplier_Ledger + WHERE supplierId = _supplierId + ORDER BY id DESC + LIMIT 1; + + -- Insert supplier ledger + INSERT INTO Supplier_Ledger + ( + supplierId, + debit, + credit, + balance, + sourceType, + sourceId, + createdAt + ) + VALUES + ( + _supplierId, + IF(p_type = 'REFUND', p_amount, 0), + IF(p_type = 'PAYMENT', p_amount, 0), + lastBalance + + IF(p_type = 'PAYMENT', p_amount, 0) + - IF(p_type = 'REFUND', p_amount, 0), + 'PAYMENT', + p_id, + NOW() + ); +END // + +-- Procedure for trg_pr_payment_after_delete +CREATE PROCEDURE update_receipt_on_payment_delete(IN p_receiptId INT, IN p_type VARCHAR(20), IN p_amount DECIMAL(15,2)) +BEGIN + DECLARE receiptTotal DECIMAL(14,2); + DECLARE newPaid DECIMAL(14,2); + + SELECT totalAmount, paidAmount + INTO receiptTotal, newPaid + FROM Purchase_Receipts + WHERE id = p_receiptId + FOR UPDATE; + + IF p_type = 'PAYMENT' THEN + SET newPaid = newPaid - p_amount; + ELSE + SET newPaid = newPaid + p_amount; + END IF; + + UPDATE Purchase_Receipts + SET + paidAmount = newPaid, + status = + CASE + WHEN newPaid = 0 THEN 'UNPAID' + WHEN newPaid < receiptTotal THEN 'PARTIALLY_PAID' + ELSE 'PAID' + END + WHERE id = p_receiptId; +END // + +-- Procedure for trg_purchase_receipt_after_insert +CREATE PROCEDURE insert_supplier_ledger_purchase(IN p_supplierId INT, IN p_totalAmount DECIMAL(15,2), IN p_id INT) +BEGIN + DECLARE lastBalance DECIMAL(14,2) DEFAULT 0; + + SELECT COALESCE(balance, 0) + INTO lastBalance + FROM Supplier_Ledger + WHERE supplierId = p_supplierId + ORDER BY id DESC + LIMIT 1; + + INSERT INTO Supplier_Ledger + ( + supplierId, + debit, + credit, + balance, + sourceType, + sourceId, + createdAt + ) + VALUES + ( + p_supplierId, + p_totalAmount, + 0, + lastBalance - p_totalAmount, + 'PURCHASE', + p_id, + NOW() + ); +END // + +-- Procedure for trg_sales_invoice_items_before_insert +CREATE PROCEDURE validate_stock_before_sale(IN p_invoiceId INT, IN p_productId INT, IN p_count DECIMAL(10,2)) +BEGIN + DECLARE current_stock DECIMAL(10, 2); + DECLARE inventory_id INT; + + SELECT pa.inventoryId INTO inventory_id + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = p_invoiceId; + + SELECT COALESCE(quantity, 0) INTO current_stock + FROM Stock_Balance sb + WHERE productId = p_productId AND sb.inventoryId = inventory_id + LIMIT 1; + + IF p_count > current_stock THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'موجودی کالا در انبار کافی نیست.'; + END IF; +END // + +-- Procedure for trg_sales_invoice_items_after_insert +CREATE PROCEDURE process_sale_item(IN p_invoiceId INT, IN p_productId INT, IN p_count DECIMAL(10,2), IN p_unitPrice DECIMAL(15,2), IN p_totalAmount DECIMAL(15,2)) +BEGIN + DECLARE current_stock DECIMAL(10, 2); + DECLARE inventory_id INT; + DECLARE customer_id INT; + DECLARE pos_id INT; + + SELECT posAccountId, customerId INTO pos_id, customer_id + FROM Sales_Invoices si + WHERE si.id = p_invoiceId + LIMIT 1; + + SELECT pa.inventoryId INTO inventory_id + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = p_invoiceId; + + SELECT COALESCE(quantity, 0) INTO current_stock + FROM Stock_Balance sb + WHERE productId = p_productId AND sb.inventoryId = inventory_id + LIMIT 1; + + INSERT INTO Stock_Movements ( + type, + quantity, + unitPrice, + totalCost, + referenceType, + referenceId, + productId, + inventoryId, + avgCost, + remainedInStock, + customerId, + createdAt + ) + VALUES ( + 'OUT', + p_count, + p_unitPrice, + p_totalAmount, + 'SALES', + p_invoiceId, + p_productId, + inventory_id, + CASE + WHEN p_count = 0 THEN 0 + ELSE p_totalAmount / p_count + END, + current_stock - p_count, + customer_id, + NOW() + ); +END // + +-- Procedure for trg_sales_invoice_payment_after_insert +CREATE PROCEDURE process_sale_payment(IN p_invoiceId INT, IN p_amount DECIMAL(15,2), IN p_id INT) +BEGIN + DECLARE currentBalance DECIMAL(15,2); + DECLARE bankAccountId INT; + + SELECT pa.bankAccountId INTO bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = p_invoiceId; + + SELECT balance INTO currentBalance + FROM Bank_Account_Balance + WHERE bankAccountId = bankAccountId + FOR UPDATE; + + IF currentBalance IS NULL THEN + SET currentBalance = 0; + INSERT INTO Bank_Account_Balance (bankAccountId, balance, updatedAt) + VALUES (bankAccountId, 0, NOW()); + END IF; + + SET currentBalance = currentBalance + p_amount; + + INSERT INTO Bank_Account_Transactions + (bankAccountId, type, amount, balanceAfter, referenceType, referenceId) + VALUES + (bankAccountId, 'DEPOSIT', p_amount, currentBalance, 'POS_SALE', p_id); + + UPDATE Bank_Account_Balance + SET balance = currentBalance + WHERE bankAccountId = bankAccountId; +END // + +-- Procedure for trg_pos_account_payment_after_insert +CREATE PROCEDURE process_pos_payment(IN p_invoiceId INT, IN p_paymentMethod VARCHAR(20), IN p_amount DECIMAL(15,2), IN p_id INT) +BEGIN + DECLARE _bankAccountId INT; + + IF(p_paymentMethod != 'CASH') THEN + SELECT cashBankAccountId INTO _bankAccountId + FROM Pos_Accounts pa + INNER JOIN Sales_Invoices si ON pa.id = si.posAccountId + WHERE si.id = p_invoiceId; + END IF; + + INSERT INTO Bank_Account_Transactions ( + bankAccountId, + type, + amount, + balanceAfter, + referenceType, + referenceId + ) + VALUES( + _bankAccountId, + 'DEPOSIT', + p_amount, + 0, + 'POS_SALE', + p_id + ); +END // + +-- Procedure for trg_stock_transfer +CREATE PROCEDURE update_stock_balance_transfer(IN p_productId INT, IN p_inventoryId INT, IN p_quantity DECIMAL(10,2), IN p_unitPrice DECIMAL(15,2), IN p_totalCost DECIMAL(15,2), IN p_type VARCHAR(10)) +BEGIN + IF p_type = 'IN' THEN + INSERT INTO Stock_Balance ( + productId, + inventoryId, + quantity, + totalCost, + avgCost, + updatedAt + ) + VALUES ( + p_productId, + p_inventoryId, + p_quantity, + p_totalCost, + CASE + WHEN p_quantity = 0 THEN 0 + ELSE p_totalCost / p_quantity + END, + NOW() + ) + ON DUPLICATE KEY UPDATE + quantity = quantity + p_quantity, + totalCost = totalCost + p_totalCost, + avgCost = CASE + WHEN (quantity + p_quantity) = 0 THEN 0 + ELSE (totalCost + p_totalCost) / (quantity + p_quantity) + END, + updatedAt = NOW(); + END IF; + + IF p_type = 'OUT' THEN + IF EXISTS ( + SELECT 1 + FROM Stock_Balance sb + WHERE sb.productId = p_productId AND sb.inventoryId = p_inventoryId + ) THEN + UPDATE Stock_Balance sb + SET + sb.quantity = sb.quantity - p_quantity, + sb.totalCost = sb.totalCost - (sb.avgCost * p_quantity), + sb.updatedAt = NOW() + WHERE + sb.productId = p_productId + AND sb.inventoryId = p_inventoryId; + ELSE + INSERT INTO Stock_Balance ( + productId, + inventoryId, + quantity, + totalCost, + avgCost, + updatedAt + ) + VALUES ( + p_productId, + p_inventoryId, + - p_quantity, + - COALESCE(p_unitPrice, 0) * p_quantity, + COALESCE(p_unitPrice, 0), + NOW() + ); + END IF; + END IF; +END // + +-- Procedure for trg_stock_purchase_insert +CREATE PROCEDURE update_stock_balance_purchase(IN p_productId INT, IN p_quantity DECIMAL(10,2), IN p_unitPrice DECIMAL(15,2), IN p_totalCost DECIMAL(15,2), IN p_inventoryId INT) +BEGIN + INSERT INTO Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) + VALUES ( + p_productId, + p_quantity, + p_unitPrice, + p_totalCost, + p_inventoryId, + NOW() + ) + ON DUPLICATE KEY UPDATE + quantity = quantity + p_quantity, + totalCost = totalCost + p_totalCost, + avgCost = totalCost / quantity; +END // + +-- Procedure for trg_stock_sale_insert +CREATE PROCEDURE update_stock_balance_sale(IN p_productId INT, IN p_quantity DECIMAL(10,2), IN p_unitPrice DECIMAL(15,2), IN p_totalCost DECIMAL(15,2), IN p_inventoryId INT) +BEGIN + INSERT INTO Stock_Balance ( + productId, + quantity, + avgCost, + totalCost, + inventoryId, + updatedAt + ) + VALUES ( + p_productId, + p_quantity, + p_unitPrice, + p_totalCost, + p_inventoryId, + NOW() + ) + ON DUPLICATE KEY UPDATE + quantity = quantity - p_quantity, + totalCost = totalCost - p_totalCost, + avgCost = totalCost / quantity; +END // + +DELIMITER ; \ No newline at end of file diff --git a/scripts/dump-triggers.ts b/scripts/dump-triggers.ts index d361d88..fd3f821 100644 --- a/scripts/dump-triggers.ts +++ b/scripts/dump-triggers.ts @@ -33,7 +33,7 @@ async function main() { let sqlOutput = '-- AUTO-GENERATED MYSQL TRIGGER DUMP\n' sqlOutput += '-- Generated at: ' + new Date().toISOString() + '\n\n' - for (const trg of triggers) { + for (const [index, trg] of triggers.entries()) { const name = trg.Trigger console.log(`📥 Extracting trigger: ${name}`) @@ -42,6 +42,7 @@ async function main() { const createStatement = rows[0]['SQL Original Statement'] sqlOutput += `-- ------------------------------------------\n` + sqlOutput += `-- index: ${index + 1}\n` sqlOutput += `-- Trigger: ${name}\n` sqlOutput += `-- Event: ${trg.Event}\n` sqlOutput += `-- Table: ${trg.Table}\n` diff --git a/src/app.module.ts b/src/app.module.ts index 09e3b3c..ef95f5b 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -12,6 +12,7 @@ import { CardexModule } from './modules/cardex/cardex.module' import { InventoriesModule } from './modules/inventories/inventories.module' import { PosModule } from './modules/pos/pos.module' import { PurchaseReceiptPaymentsModule } from './modules/purchase-receipt-payments/purchase-receipt-payments.module' +import { StatisticsModule } from './modules/statistics/statistics.module' import { SuppliersModule } from './modules/suppliers/suppliers.module' import { PrismaModule } from './prisma/prisma.module' import { ProductBrandsModule } from './product-brands/product-brands.module' @@ -56,6 +57,7 @@ import { UsersModule } from './users/users.module' BanksModule, BankBranchesModule, BankAccountsModule, + StatisticsModule, ], controllers: [AppController], providers: [AppService], diff --git a/src/generated/prisma/browser.ts b/src/generated/prisma/browser.ts index 71884f6..9b97edd 100644 --- a/src/generated/prisma/browser.ts +++ b/src/generated/prisma/browser.ts @@ -47,6 +47,16 @@ export type BankBranch = Prisma.BankBranchModel * */ export type BankAccount = Prisma.BankAccountModel +/** + * Model BankAccountTransaction + * + */ +export type BankAccountTransaction = Prisma.BankAccountTransactionModel +/** + * Model BankAccountBalance + * + */ +export type BankAccountBalance = Prisma.BankAccountBalanceModel /** * Model Inventory * @@ -77,26 +87,21 @@ export type InventoryTransferItem = Prisma.InventoryTransferItemModel * */ export type Bank = Prisma.BankModel -/** - * Model Customer - * - */ -export type Customer = Prisma.CustomerModel /** * Model Order * */ export type Order = Prisma.OrderModel /** - * Model SalesInvoice + * Model OrderItem * */ -export type SalesInvoice = Prisma.SalesInvoiceModel +export type OrderItem = Prisma.OrderItemModel /** - * Model SalesInvoiceItem + * Model Customer * */ -export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel +export type Customer = Prisma.CustomerModel /** * Model TriggerLog * @@ -137,6 +142,21 @@ export type PurchaseReceiptItem = Prisma.PurchaseReceiptItemModel * */ export type PurchaseReceiptPayments = Prisma.PurchaseReceiptPaymentsModel +/** + * Model SalesInvoice + * + */ +export type SalesInvoice = Prisma.SalesInvoiceModel +/** + * Model SalesInvoiceItem + * + */ +export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel +/** + * Model SalesInvoicePayment + * + */ +export type SalesInvoicePayment = Prisma.SalesInvoicePaymentModel /** * Model StockMovement * @@ -152,6 +172,11 @@ export type StockBalance = Prisma.StockBalanceModel * */ export type StockAdjustment = Prisma.StockAdjustmentModel +/** + * Model StockReservation + * + */ +export type StockReservation = Prisma.StockReservationModel /** * Model Supplier * diff --git a/src/generated/prisma/client.ts b/src/generated/prisma/client.ts index 68984c6..94636e4 100644 --- a/src/generated/prisma/client.ts +++ b/src/generated/prisma/client.ts @@ -67,6 +67,16 @@ export type BankBranch = Prisma.BankBranchModel * */ export type BankAccount = Prisma.BankAccountModel +/** + * Model BankAccountTransaction + * + */ +export type BankAccountTransaction = Prisma.BankAccountTransactionModel +/** + * Model BankAccountBalance + * + */ +export type BankAccountBalance = Prisma.BankAccountBalanceModel /** * Model Inventory * @@ -97,26 +107,21 @@ export type InventoryTransferItem = Prisma.InventoryTransferItemModel * */ export type Bank = Prisma.BankModel -/** - * Model Customer - * - */ -export type Customer = Prisma.CustomerModel /** * Model Order * */ export type Order = Prisma.OrderModel /** - * Model SalesInvoice + * Model OrderItem * */ -export type SalesInvoice = Prisma.SalesInvoiceModel +export type OrderItem = Prisma.OrderItemModel /** - * Model SalesInvoiceItem + * Model Customer * */ -export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel +export type Customer = Prisma.CustomerModel /** * Model TriggerLog * @@ -157,6 +162,21 @@ export type PurchaseReceiptItem = Prisma.PurchaseReceiptItemModel * */ export type PurchaseReceiptPayments = Prisma.PurchaseReceiptPaymentsModel +/** + * Model SalesInvoice + * + */ +export type SalesInvoice = Prisma.SalesInvoiceModel +/** + * Model SalesInvoiceItem + * + */ +export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel +/** + * Model SalesInvoicePayment + * + */ +export type SalesInvoicePayment = Prisma.SalesInvoicePaymentModel /** * Model StockMovement * @@ -172,6 +192,11 @@ export type StockBalance = Prisma.StockBalanceModel * */ export type StockAdjustment = Prisma.StockAdjustmentModel +/** + * Model StockReservation + * + */ +export type StockReservation = Prisma.StockReservationModel /** * Model Supplier * diff --git a/src/generated/prisma/commonInputTypes.ts b/src/generated/prisma/commonInputTypes.ts index 2266cc1..a5bae19 100644 --- a/src/generated/prisma/commonInputTypes.ts +++ b/src/generated/prisma/commonInputTypes.ts @@ -226,6 +226,13 @@ export type BoolWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedBoolFilter<$PrismaModel> } +export type EnumBankAccountTransactionTypeFilter<$PrismaModel = never> = { + equals?: $Enums.BankAccountTransactionType | Prisma.EnumBankAccountTransactionTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankAccountTransactionType[] + notIn?: $Enums.BankAccountTransactionType[] + not?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> | $Enums.BankAccountTransactionType +} + export type DecimalFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -237,6 +244,23 @@ export type DecimalFilter<$PrismaModel = never> = { not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string } +export type EnumBankTransactionRefTypeFilter<$PrismaModel = never> = { + equals?: $Enums.BankTransactionRefType | Prisma.EnumBankTransactionRefTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankTransactionRefType[] + notIn?: $Enums.BankTransactionRefType[] + not?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> | $Enums.BankTransactionRefType +} + +export type EnumBankAccountTransactionTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.BankAccountTransactionType | Prisma.EnumBankAccountTransactionTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankAccountTransactionType[] + notIn?: $Enums.BankAccountTransactionType[] + not?: Prisma.NestedEnumBankAccountTransactionTypeWithAggregatesFilter<$PrismaModel> | $Enums.BankAccountTransactionType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> +} + export type DecimalWithAggregatesFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -253,6 +277,16 @@ export type DecimalWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDecimalFilter<$PrismaModel> } +export type EnumBankTransactionRefTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.BankTransactionRefType | Prisma.EnumBankTransactionRefTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankTransactionRefType[] + notIn?: $Enums.BankTransactionRefType[] + not?: Prisma.NestedEnumBankTransactionRefTypeWithAggregatesFilter<$PrismaModel> | $Enums.BankTransactionRefType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> +} + export type EnumOrderStatusFilter<$PrismaModel = never> = { equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel> in?: $Enums.OrderStatus[] @@ -260,33 +294,6 @@ export type EnumOrderStatusFilter<$PrismaModel = never> = { not?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> | $Enums.OrderStatus } -export type EnumPaymentMethodTypeFilter<$PrismaModel = never> = { - equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> - in?: $Enums.PaymentMethodType[] - notIn?: $Enums.PaymentMethodType[] - not?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> | $Enums.PaymentMethodType -} - -export type EnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel> - in?: $Enums.OrderStatus[] - notIn?: $Enums.OrderStatus[] - not?: Prisma.NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel> | $Enums.OrderStatus - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> - _max?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> -} - -export type EnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> - in?: $Enums.PaymentMethodType[] - notIn?: $Enums.PaymentMethodType[] - not?: Prisma.NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.PaymentMethodType - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> - _max?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> -} - export type IntNullableFilter<$PrismaModel = never> = { equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null in?: number[] | null @@ -298,6 +305,16 @@ export type IntNullableFilter<$PrismaModel = never> = { not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null } +export type EnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel> + in?: $Enums.OrderStatus[] + notIn?: $Enums.OrderStatus[] + not?: Prisma.NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel> | $Enums.OrderStatus + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> + _max?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> +} + export type IntNullableWithAggregatesFilter<$PrismaModel = never> = { equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null in?: number[] | null @@ -358,6 +375,13 @@ export type EnumPurchaseReceiptStatusWithAggregatesFilter<$PrismaModel = never> _max?: Prisma.NestedEnumPurchaseReceiptStatusFilter<$PrismaModel> } +export type EnumPaymentMethodTypeFilter<$PrismaModel = never> = { + equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> + in?: $Enums.PaymentMethodType[] + notIn?: $Enums.PaymentMethodType[] + not?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> | $Enums.PaymentMethodType +} + export type EnumPaymentTypeFilter<$PrismaModel = never> = { equals?: $Enums.PaymentType | Prisma.EnumPaymentTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentType[] @@ -365,6 +389,16 @@ export type EnumPaymentTypeFilter<$PrismaModel = never> = { not?: Prisma.NestedEnumPaymentTypeFilter<$PrismaModel> | $Enums.PaymentType } +export type EnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> + in?: $Enums.PaymentMethodType[] + notIn?: $Enums.PaymentMethodType[] + not?: Prisma.NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.PaymentMethodType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> +} + export type EnumPaymentTypeWithAggregatesFilter<$PrismaModel = never> = { equals?: $Enums.PaymentType | Prisma.EnumPaymentTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentType[] @@ -628,6 +662,13 @@ export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedBoolFilter<$PrismaModel> } +export type NestedEnumBankAccountTransactionTypeFilter<$PrismaModel = never> = { + equals?: $Enums.BankAccountTransactionType | Prisma.EnumBankAccountTransactionTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankAccountTransactionType[] + notIn?: $Enums.BankAccountTransactionType[] + not?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> | $Enums.BankAccountTransactionType +} + export type NestedDecimalFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -639,6 +680,23 @@ export type NestedDecimalFilter<$PrismaModel = never> = { not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string } +export type NestedEnumBankTransactionRefTypeFilter<$PrismaModel = never> = { + equals?: $Enums.BankTransactionRefType | Prisma.EnumBankTransactionRefTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankTransactionRefType[] + notIn?: $Enums.BankTransactionRefType[] + not?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> | $Enums.BankTransactionRefType +} + +export type NestedEnumBankAccountTransactionTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.BankAccountTransactionType | Prisma.EnumBankAccountTransactionTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankAccountTransactionType[] + notIn?: $Enums.BankAccountTransactionType[] + not?: Prisma.NestedEnumBankAccountTransactionTypeWithAggregatesFilter<$PrismaModel> | $Enums.BankAccountTransactionType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumBankAccountTransactionTypeFilter<$PrismaModel> +} + export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -655,6 +713,16 @@ export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDecimalFilter<$PrismaModel> } +export type NestedEnumBankTransactionRefTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.BankTransactionRefType | Prisma.EnumBankTransactionRefTypeFieldRefInput<$PrismaModel> + in?: $Enums.BankTransactionRefType[] + notIn?: $Enums.BankTransactionRefType[] + not?: Prisma.NestedEnumBankTransactionRefTypeWithAggregatesFilter<$PrismaModel> | $Enums.BankTransactionRefType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumBankTransactionRefTypeFilter<$PrismaModel> +} + export type NestedEnumOrderStatusFilter<$PrismaModel = never> = { equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel> in?: $Enums.OrderStatus[] @@ -662,13 +730,6 @@ export type NestedEnumOrderStatusFilter<$PrismaModel = never> = { not?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> | $Enums.OrderStatus } -export type NestedEnumPaymentMethodTypeFilter<$PrismaModel = never> = { - equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> - in?: $Enums.PaymentMethodType[] - notIn?: $Enums.PaymentMethodType[] - not?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> | $Enums.PaymentMethodType -} - export type NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = { equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel> in?: $Enums.OrderStatus[] @@ -679,16 +740,6 @@ export type NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> } -export type NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> - in?: $Enums.PaymentMethodType[] - notIn?: $Enums.PaymentMethodType[] - not?: Prisma.NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.PaymentMethodType - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> - _max?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> -} - export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = { equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null in?: number[] | null @@ -760,6 +811,13 @@ export type NestedEnumPurchaseReceiptStatusWithAggregatesFilter<$PrismaModel = n _max?: Prisma.NestedEnumPurchaseReceiptStatusFilter<$PrismaModel> } +export type NestedEnumPaymentMethodTypeFilter<$PrismaModel = never> = { + equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> + in?: $Enums.PaymentMethodType[] + notIn?: $Enums.PaymentMethodType[] + not?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> | $Enums.PaymentMethodType +} + export type NestedEnumPaymentTypeFilter<$PrismaModel = never> = { equals?: $Enums.PaymentType | Prisma.EnumPaymentTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentType[] @@ -767,6 +825,16 @@ export type NestedEnumPaymentTypeFilter<$PrismaModel = never> = { not?: Prisma.NestedEnumPaymentTypeFilter<$PrismaModel> | $Enums.PaymentType } +export type NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> + in?: $Enums.PaymentMethodType[] + notIn?: $Enums.PaymentMethodType[] + not?: Prisma.NestedEnumPaymentMethodTypeWithAggregatesFilter<$PrismaModel> | $Enums.PaymentMethodType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumPaymentMethodTypeFilter<$PrismaModel> +} + export type NestedEnumPaymentTypeWithAggregatesFilter<$PrismaModel = never> = { equals?: $Enums.PaymentType | Prisma.EnumPaymentTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentType[] diff --git a/src/generated/prisma/enums.ts b/src/generated/prisma/enums.ts index d80f886..050874c 100644 --- a/src/generated/prisma/enums.ts +++ b/src/generated/prisma/enums.ts @@ -11,7 +11,8 @@ export const OrderStatus = { PENDING: 'PENDING', - REJECT: 'REJECT', + REJECTED: 'REJECTED', + CANCELED: 'CANCELED', DONE: 'DONE' } as const @@ -73,3 +74,23 @@ export const PurchaseReceiptStatus = { } as const export type PurchaseReceiptStatus = (typeof PurchaseReceiptStatus)[keyof typeof PurchaseReceiptStatus] + + +export const BankAccountTransactionType = { + DEPOSIT: 'DEPOSIT', + WITHDRAWAL: 'WITHDRAWAL' +} as const + +export type BankAccountTransactionType = (typeof BankAccountTransactionType)[keyof typeof BankAccountTransactionType] + + +export const BankTransactionRefType = { + PURCHASE_PAYMENT: 'PURCHASE_PAYMENT', + PURCHASE_REFUND: 'PURCHASE_REFUND', + POS_SALE: 'POS_SALE', + POS_REFUND: 'POS_REFUND', + BANK_TRANSFER: 'BANK_TRANSFER', + MANUAL_ADJUSTMENT: 'MANUAL_ADJUSTMENT' +} as const + +export type BankTransactionRefType = (typeof BankTransactionRefType)[keyof typeof BankTransactionRefType] diff --git a/src/generated/prisma/internal/class.ts b/src/generated/prisma/internal/class.ts index 28b44bd..c1eaf37 100644 --- a/src/generated/prisma/internal/class.ts +++ b/src/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.2.0", "engineVersion": "0c8ef2ce45c83248ab3df073180d5eda9e8be7a3", "activeProvider": "mysql", - "inlineSchema": "model 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 refreshTokens RefreshToken[]\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\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 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 user User @relation(fields: [userId], references: [id])\n\n @@index([userId])\n @@map(\"Refresh_Tokens\")\n}\n\nmodel BankBranch {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n code String @unique() @db.VarChar(10)\n address String? @db.VarChar(500)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n bankId Int\n\n bank Bank @relation(\"bank_branches\", fields: [bankId], references: [id])\n bankAccounts BankAccount[] @relation(\"Bank_Accounts_branchId_fkey\")\n\n @@map(\"Bank_Branches\")\n}\n\nmodel BankAccount {\n id Int @id @default(autoincrement())\n accountNumber String? @unique @db.VarChar(20)\n cardNumber String? @unique @db.VarChar(16)\n name String @db.VarChar(255)\n iban String? @unique @db.VarChar(34)\n branchId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n branch BankBranch @relation(\"Bank_Accounts_branchId_fkey\", fields: [branchId], references: [id])\n inventoryBankAccounts InventoryBankAccount[]\n purchaseReceiptPayments PurchaseReceiptPayments[]\n\n @@map(\"Bank_Accounts\")\n}\n\nenum OrderStatus {\n PENDING\n REJECT\n DONE\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 PaymentMethodType {\n CASH\n CARD\n BANK\n CHECK\n OTHER\n}\n\nenum LedgerSourceType {\n PURCHASE\n PAYMENT\n ADJUSTMENT\n REFUND\n}\n\nenum PaymentType {\n PAYMENT\n REFUND\n}\n\nenum PurchaseReceiptStatus {\n UNPAID\n PARTIALLY_PAID\n PAID\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 createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n isPointOfSale Boolean @default(false)\n inventoryTransfersFrom InventoryTransfer[] @relation(\"Inventory_From\")\n inventoryTransfersTo InventoryTransfer[] @relation(\"Inventory_To\")\n purchaseReceipts PurchaseReceipt[]\n stockAdjustments StockAdjustment[] @relation(\"Inventory_Stock_Adjustments\")\n stockBalances StockBalance[] @relation(\"StockBalance_inventory\")\n counterStockMovements StockMovement[] @relation(\"StockMovement_CounterInventory\")\n stockMovements StockMovement[] @relation(\"StockMovement_Inventory\")\n inventoryBankAccounts InventoryBankAccount[]\n\n @@map(\"Inventories\")\n}\n\nmodel InventoryBankAccount {\n inventoryId Int\n bankAccountId Int\n\n inventory Inventory @relation(fields: [inventoryId], references: [id])\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n posAccounts PosAccount[]\n purchaseReceiptPayments PurchaseReceiptPayments[]\n\n @@id([inventoryId, bankAccountId])\n @@index([bankAccountId])\n @@map(\"Inventory_Bank_Accounts\")\n}\n\nmodel PosAccount {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n code String @unique() @db.VarChar(10)\n description String? @db.VarChar(500)\n bankAccountId Int\n inventoryId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])\n salesInvoices SalesInvoice[]\n\n @@index([inventoryId])\n @@map(\"Pos_Accounts\")\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, 0)\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 Bank {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n shortName String @unique() @db.VarChar(3)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n bankBranches BankBranch[] @relation(\"bank_branches\")\n\n @@map(\"Banks\")\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()\n stockMovements StockMovement[] @relation()\n salesInvoices SalesInvoice[]\n\n @@map(\"Customers\")\n}\n\nmodel Order {\n id Int @id @default(autoincrement())\n orderNumber String @unique @db.VarChar(100)\n status OrderStatus @default(PENDING)\n paymentMethod PaymentMethodType @default(CARD)\n totalAmount Decimal @db.Decimal(15, 2)\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 customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onUpdate: NoAction)\n\n @@index([customerId])\n @@map(\"Orders\")\n}\n\nmodel SalesInvoice {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(15, 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 posAccountId Int\n items SalesInvoiceItem[]\n customer Customer? @relation(fields: [customerId], references: [id])\n posAccount PosAccount @relation(fields: [posAccountId], references: [id])\n\n @@index([customerId])\n @@index([posAccountId])\n @@map(\"Sales_Invoices\")\n}\n\nmodel SalesInvoiceItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 0)\n fee Decimal @db.Decimal(15, 2)\n total Decimal @db.Decimal(15, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n invoiceId Int\n productId Int\n invoice SalesInvoice @relation(fields: [invoiceId], references: [id])\n product Product @relation(fields: [productId], references: [id])\n\n @@index([invoiceId])\n @@index([productId])\n @@map(\"Sales_Invoice_Items\")\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n name String @db.Text\n\n @@map(\"Trigger_Logs\")\n}\n\nmodel ProductVariant {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n basePrice Decimal @db.Decimal(15, 2)\n salePrice Decimal @db.Decimal(15, 2)\n description String? @db.Text\n barcode String? @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, 0)\n alertQuantity Decimal? @default(5.00) @db.Decimal(10, 0)\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() @db.VarChar(100)\n barcode String? @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 brandId Int?\n categoryId Int?\n salePrice Decimal @default(0.00) @db.Decimal(15, 0)\n minimumStockAlertLevel Decimal @default(0.00) @db.Decimal(10, 0)\n inventoryTransferItems InventoryTransferItem[] @relation(\"InventoryTransferItem_Product\")\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 stockAdjustments StockAdjustment[] @relation(\"Product_Stock_Adjustments\")\n stockBalances StockBalance[] @relation(\"StockBalance_Product\")\n stockMovements StockMovement[] @relation(\"StockMovement_Product\")\n salesInvoiceItems SalesInvoiceItem[]\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 PurchaseReceipt {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(15, 2)\n paidAmount Decimal @default(0.00) @db.Decimal(15, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n status PurchaseReceiptStatus @default(UNPAID)\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 payments PurchaseReceiptPayments[]\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, 0)\n fee Decimal @db.Decimal(15, 2)\n total Decimal @db.Decimal(15, 2)\n receiptId Int\n productId Int\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n product Product @relation(\"Product_PurchaseReceiptItems\", fields: [productId], references: [id])\n receipt PurchaseReceipt @relation(\"PurchaseReceipt_Items\", fields: [receiptId], 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 PurchaseReceiptPayments {\n id Int @id @default(autoincrement())\n amount Decimal @db.Decimal(15, 2)\n paymentMethod PaymentMethodType\n type PaymentType\n bankAccountId Int\n receiptId Int\n payedAt DateTime @db.Timestamp(0)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n receipt PurchaseReceipt @relation(fields: [receiptId], references: [id])\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n inventoryBankAccount InventoryBankAccount? @relation(fields: [inventoryBankAccountInventoryId, inventoryBankAccountBankAccountId], references: [inventoryId, bankAccountId])\n inventoryBankAccountInventoryId Int?\n inventoryBankAccountBankAccountId Int?\n\n @@index([receiptId], map: \"Purchase_Receipt_Payments_receiptId_fkey\")\n @@map(\"Purchase_Receipt_Payments\")\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../../src/generated/prisma\"\n moduleFormat = \"cjs\"\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel StockMovement {\n id Int @id @default(autoincrement())\n type MovementType\n quantity Decimal @db.Decimal(10, 0)\n fee Decimal @db.Decimal(15, 2)\n totalCost Decimal @db.Decimal(15, 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(15, 2)\n supplierId Int?\n remainedInStock Decimal @default(0.00) @db.Decimal(10, 0)\n counterInventoryId Int?\n customerId Int?\n counterInventory Inventory? @relation(\"StockMovement_CounterInventory\", fields: [counterInventoryId], references: [id])\n customer Customer? @relation(fields: [customerId], references: [id])\n inventory Inventory @relation(\"StockMovement_Inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockMovement_Product\", fields: [productId], references: [id])\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 @@index([counterInventoryId], map: \"Stock_Movements_counterInventoryId_fkey\")\n @@index([customerId], map: \"Stock_Movements_customerId_fkey\")\n @@index([supplierId], map: \"Stock_Movements_supplierId_fkey\")\n @@map(\"Stock_Movements\")\n}\n\nmodel StockBalance {\n quantity Decimal @default(0.000) @db.Decimal(14, 3)\n totalCost Decimal @default(0.00) @db.Decimal(14, 2)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n avgCost Decimal @default(0.00) @db.Decimal(14, 2)\n inventoryId Int\n productId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n id Int @id @default(autoincrement())\n inventory Inventory @relation(\"StockBalance_inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockBalance_Product\", fields: [productId], references: [id])\n\n @@unique([productId, inventoryId])\n @@index([productId])\n @@index([inventoryId])\n @@map(\"Stock_Balance\")\n}\n\nmodel StockAdjustment {\n id Int @id @default(autoincrement())\n adjustedQuantity Decimal @db.Decimal(10, 0)\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\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 stockMovements StockMovement[] @relation(\"StockMovement_Supplier\")\n receipts PurchaseReceipt[]\n ledger SupplierLedger[]\n\n @@map(\"Suppliers\")\n}\n\nmodel SupplierLedger {\n id Int @id @default(autoincrement())\n description String? @db.Text\n debit Decimal @default(0) @db.Decimal(15, 2)\n credit Decimal @default(0) @db.Decimal(15, 2)\n balance Decimal @db.Decimal(15, 2)\n sourceType LedgerSourceType\n sourceId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n supplierId Int\n supplier Supplier @relation(fields: [supplierId], references: [id])\n\n @@index([supplierId])\n @@map(\"Supplier_Ledger\")\n}\n", + "inlineSchema": "model 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 refreshTokens RefreshToken[]\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\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 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 user User @relation(fields: [userId], references: [id])\n\n @@index([userId])\n @@map(\"Refresh_Tokens\")\n}\n\nmodel BankBranch {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n code String @unique() @db.VarChar(10)\n address String? @db.VarChar(500)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n bankId Int\n\n bank Bank @relation(\"bank_branches\", fields: [bankId], references: [id])\n bankAccounts BankAccount[] @relation(\"Bank_Accounts_branchId_fkey\")\n\n @@map(\"Bank_Branches\")\n}\n\nmodel BankAccount {\n id Int @id @default(autoincrement())\n accountNumber String? @unique @db.VarChar(20)\n cardNumber String? @unique @db.VarChar(16)\n name String @db.VarChar(255)\n iban String? @unique @db.VarChar(34)\n branchId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n branch BankBranch @relation(\"Bank_Accounts_branchId_fkey\", fields: [branchId], references: [id])\n inventoryBankAccounts InventoryBankAccount[]\n purchaseReceiptPayments PurchaseReceiptPayments[]\n bankAccountTransactions BankAccountTransaction[]\n bankAccountBalances BankAccountBalance[]\n\n @@map(\"Bank_Accounts\")\n}\n\nmodel BankAccountTransaction {\n id Int @id @default(autoincrement())\n bankAccountId Int\n type BankAccountTransactionType\n amount Decimal @db.Decimal(15, 2)\n balanceAfter Decimal @db.Decimal(15, 2)\n referenceId Int\n referenceType BankTransactionRefType\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n\n @@index([bankAccountId])\n @@map(\"Bank_Account_Transactions\")\n}\n\nmodel BankAccountBalance {\n bankAccountId Int @unique\n balance Decimal @db.Decimal(15, 2)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n\n @@map(\"Bank_Account_Balance\")\n}\n\nenum OrderStatus {\n PENDING\n REJECTED\n CANCELED\n DONE\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 PaymentMethodType {\n CASH\n CARD\n BANK\n CHECK\n OTHER\n}\n\nenum LedgerSourceType {\n PURCHASE\n PAYMENT\n ADJUSTMENT\n REFUND\n}\n\nenum PaymentType {\n PAYMENT\n REFUND\n}\n\nenum PurchaseReceiptStatus {\n UNPAID\n PARTIALLY_PAID\n PAID\n}\n\nenum BankAccountTransactionType {\n DEPOSIT\n WITHDRAWAL\n}\n\nenum BankTransactionRefType {\n PURCHASE_PAYMENT\n PURCHASE_REFUND\n POS_SALE\n POS_REFUND\n BANK_TRANSFER\n MANUAL_ADJUSTMENT\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 createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n isPointOfSale Boolean @default(false)\n inventoryTransfersFrom InventoryTransfer[] @relation(\"Inventory_From\")\n inventoryTransfersTo InventoryTransfer[] @relation(\"Inventory_To\")\n purchaseReceipts PurchaseReceipt[]\n stockAdjustments StockAdjustment[] @relation(\"Inventory_Stock_Adjustments\")\n stockBalances StockBalance[] @relation(\"StockBalance_inventory\")\n counterStockMovements StockMovement[] @relation(\"StockMovement_CounterInventory\")\n stockMovements StockMovement[] @relation(\"StockMovement_Inventory\")\n inventoryBankAccounts InventoryBankAccount[]\n stockReservations StockReservation[]\n\n @@map(\"Inventories\")\n}\n\nmodel InventoryBankAccount {\n inventoryId Int\n bankAccountId Int\n\n inventory Inventory @relation(fields: [inventoryId], references: [id])\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n posAccounts PosAccount[]\n purchaseReceiptPayments PurchaseReceiptPayments[]\n\n @@id([inventoryId, bankAccountId])\n @@index([bankAccountId])\n @@map(\"Inventory_Bank_Accounts\")\n}\n\nmodel PosAccount {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n code String @unique() @db.VarChar(10)\n description String? @db.VarChar(500)\n bankAccountId Int\n inventoryId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])\n salesInvoices SalesInvoice[]\n\n @@index([inventoryId])\n @@map(\"Pos_Accounts\")\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, 0)\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 Bank {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n shortName String @unique() @db.VarChar(3)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n bankBranches BankBranch[] @relation(\"bank_branches\")\n\n @@map(\"Banks\")\n}\n\nmodel Order {\n id Int @id @default(autoincrement())\n orderNumber String @unique @db.VarChar(100)\n status OrderStatus @default(PENDING)\n totalAmount Decimal @db.Decimal(15, 2)\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 customerId Int?\n customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction)\n orderItems OrderItem[]\n\n @@index([customerId])\n @@map(\"Orders\")\n}\n\nmodel OrderItem {\n id Int @id @default(autoincrement())\n quantity Decimal @db.Decimal(10, 0)\n unitPrice Decimal @db.Decimal(15, 2)\n totalAmount Decimal @db.Decimal(15, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n orderId Int\n productId Int\n\n order Order @relation(fields: [orderId], references: [id], onUpdate: NoAction)\n product Product @relation(fields: [productId], references: [id], onUpdate: NoAction)\n\n @@index([orderId])\n @@index([productId])\n @@map(\"Order_Items\")\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()\n stockMovements StockMovement[] @relation()\n salesInvoices SalesInvoice[]\n\n @@map(\"Customers\")\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n name String @db.Text\n\n @@map(\"Trigger_Logs\")\n}\n\nmodel ProductVariant {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n basePrice Decimal @db.Decimal(15, 2)\n salePrice Decimal @db.Decimal(15, 2)\n description String? @db.Text\n barcode String? @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, 0)\n alertQuantity Decimal? @default(5.00) @db.Decimal(10, 0)\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() @db.VarChar(100)\n barcode String? @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 brandId Int?\n categoryId Int?\n salePrice Decimal @default(0.00) @db.Decimal(15, 0)\n minimumStockAlertLevel Decimal @default(1.00) @db.Decimal(10, 0)\n inventoryTransferItems InventoryTransferItem[] @relation(\"InventoryTransferItem_Product\")\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 stockAdjustments StockAdjustment[] @relation(\"Product_Stock_Adjustments\")\n stockBalances StockBalance[] @relation(\"StockBalance_Product\")\n stockMovements StockMovement[] @relation(\"StockMovement_Product\")\n salesInvoiceItems SalesInvoiceItem[]\n stockReservations StockReservation[]\n orderItems OrderItem[]\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 PurchaseReceipt {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(15, 2)\n paidAmount Decimal @default(0.00) @db.Decimal(15, 2)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n status PurchaseReceiptStatus @default(UNPAID)\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 payments PurchaseReceiptPayments[]\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, 0)\n unitPrice Decimal @db.Decimal(15, 2)\n totalAmount Decimal @db.Decimal(15, 2)\n receiptId Int\n productId Int\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n product Product @relation(\"Product_PurchaseReceiptItems\", fields: [productId], references: [id])\n receipt PurchaseReceipt @relation(\"PurchaseReceipt_Items\", fields: [receiptId], 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 PurchaseReceiptPayments {\n id Int @id @default(autoincrement())\n amount Decimal @db.Decimal(15, 2)\n paymentMethod PaymentMethodType\n type PaymentType\n bankAccountId Int\n receiptId Int\n payedAt DateTime @db.Timestamp(0)\n description String? @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n receipt PurchaseReceipt @relation(fields: [receiptId], references: [id])\n bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])\n inventoryBankAccount InventoryBankAccount? @relation(fields: [inventoryBankAccountInventoryId, inventoryBankAccountBankAccountId], references: [inventoryId, bankAccountId])\n inventoryBankAccountInventoryId Int?\n inventoryBankAccountBankAccountId Int?\n\n @@index([receiptId], map: \"Purchase_Receipt_Payments_receiptId_fkey\")\n @@map(\"Purchase_Receipt_Payments\")\n}\n\nmodel SalesInvoice {\n id Int @id @default(autoincrement())\n code String @unique @db.VarChar(100)\n totalAmount Decimal @db.Decimal(15, 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 posAccountId Int\n customer Customer? @relation(fields: [customerId], references: [id])\n posAccount PosAccount @relation(fields: [posAccountId], references: [id])\n items SalesInvoiceItem[]\n salesInvoicePayments SalesInvoicePayment[]\n\n @@index([customerId])\n @@index([posAccountId])\n @@map(\"Sales_Invoices\")\n}\n\nmodel SalesInvoiceItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 0)\n unitPrice Decimal @default(0.00) @db.Decimal(15, 2)\n totalAmount Decimal @default(0.00) @db.Decimal(15, 2)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n invoiceId Int\n productId Int\n invoice SalesInvoice @relation(fields: [invoiceId], references: [id])\n product Product @relation(fields: [productId], references: [id])\n\n @@index([invoiceId])\n @@index([productId])\n @@map(\"Sales_Invoice_Items\")\n}\n\nmodel SalesInvoicePayment {\n id Int @id @default(autoincrement())\n invoiceId Int\n amount Decimal @db.Decimal(15, 2)\n paymentMethod PaymentMethodType\n paidAt DateTime\n createdAt DateTime @default(now())\n\n invoice SalesInvoice @relation(fields: [invoiceId], references: [id])\n\n @@index([invoiceId])\n @@map(\"Sales_Invoice_Payments\")\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../../src/generated/prisma\"\n moduleFormat = \"cjs\"\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel StockMovement {\n id Int @id @default(autoincrement())\n type MovementType\n quantity Decimal @db.Decimal(10, 0)\n unitPrice Decimal @db.Decimal(15, 2)\n totalCost Decimal @db.Decimal(15, 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(15, 2)\n supplierId Int?\n remainedInStock Decimal @default(0.00) @db.Decimal(10, 0)\n counterInventoryId Int?\n customerId Int?\n counterInventory Inventory? @relation(\"StockMovement_CounterInventory\", fields: [counterInventoryId], references: [id])\n customer Customer? @relation(fields: [customerId], references: [id])\n inventory Inventory @relation(\"StockMovement_Inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockMovement_Product\", fields: [productId], references: [id])\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 @@index([counterInventoryId], map: \"Stock_Movements_counterInventoryId_fkey\")\n @@index([customerId], map: \"Stock_Movements_customerId_fkey\")\n @@index([supplierId], map: \"Stock_Movements_supplierId_fkey\")\n @@map(\"Stock_Movements\")\n}\n\nmodel StockBalance {\n quantity Decimal @default(0.000) @db.Decimal(14, 3)\n totalCost Decimal @default(0.00) @db.Decimal(14, 2)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n avgCost Decimal @default(0.00) @db.Decimal(14, 2)\n inventoryId Int\n productId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n id Int @id @default(autoincrement())\n inventory Inventory @relation(\"StockBalance_inventory\", fields: [inventoryId], references: [id])\n product Product @relation(\"StockBalance_Product\", fields: [productId], references: [id])\n\n @@unique([productId, inventoryId])\n @@index([productId])\n @@index([inventoryId])\n @@map(\"Stock_Balance\")\n}\n\nmodel StockAdjustment {\n id Int @id @default(autoincrement())\n adjustedQuantity Decimal @db.Decimal(10, 0)\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\nmodel StockReservation {\n id Int @id @default(autoincrement())\n quantity Decimal @db.Decimal(10, 0)\n expiresAt DateTime @db.Timestamp(0)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n productId Int\n inventoryId Int\n orderId Int\n inventory Inventory @relation(fields: [inventoryId], references: [id])\n product Product @relation(fields: [productId], references: [id])\n\n @@index([inventoryId])\n @@index([productId])\n @@map(\"Stock_Reservations\")\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 stockMovements StockMovement[] @relation(\"StockMovement_Supplier\")\n receipts PurchaseReceipt[]\n ledger SupplierLedger[]\n\n @@map(\"Suppliers\")\n}\n\nmodel SupplierLedger {\n id Int @id @default(autoincrement())\n description String? @db.Text\n debit Decimal @default(0) @db.Decimal(15, 2)\n credit Decimal @default(0) @db.Decimal(15, 2)\n balance Decimal @db.Decimal(15, 2)\n sourceType LedgerSourceType\n sourceId Int\n createdAt DateTime @default(now()) @db.Timestamp(0)\n\n supplierId Int\n supplier Supplier @relation(fields: [supplierId], references: [id])\n\n @@index([supplierId])\n @@map(\"Supplier_Ledger\")\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -28,7 +28,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\":\"refreshTokens\",\"kind\":\"object\",\"type\":\"RefreshToken\",\"relationName\":\"RefreshTokenToUser\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"}],\"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\"},\"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\"},\"BankBranch\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"bank\",\"kind\":\"object\",\"type\":\"Bank\",\"relationName\":\"bank_branches\"},{\"name\":\"bankAccounts\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"Bank_Accounts_branchId_fkey\"}],\"dbName\":\"Bank_Branches\"},\"BankAccount\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"accountNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"cardNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"iban\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"branchId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"branch\",\"kind\":\"object\",\"type\":\"BankBranch\",\"relationName\":\"Bank_Accounts_branchId_fkey\"},{\"name\":\"inventoryBankAccounts\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"BankAccountToInventoryBankAccount\"},{\"name\":\"purchaseReceiptPayments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"BankAccountToPurchaseReceiptPayments\"}],\"dbName\":\"Bank_Accounts\"},\"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\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"isPointOfSale\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"inventoryTransfersFrom\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_From\"},{\"name\":\"inventoryTransfersTo\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_To\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"counterStockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_CounterInventory\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"inventoryBankAccounts\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryToInventoryBankAccount\"}],\"dbName\":\"Inventories\"},\"InventoryBankAccount\":{\"fields\":[{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"InventoryToInventoryBankAccount\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToInventoryBankAccount\"},{\"name\":\"posAccounts\",\"kind\":\"object\",\"type\":\"PosAccount\",\"relationName\":\"InventoryBankAccountToPosAccount\"},{\"name\":\"purchaseReceiptPayments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"InventoryBankAccountToPurchaseReceiptPayments\"}],\"dbName\":\"Inventory_Bank_Accounts\"},\"PosAccount\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"inventoryBankAccount\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryBankAccountToPosAccount\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"PosAccountToSalesInvoice\"}],\"dbName\":\"Pos_Accounts\"},\"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\"},\"Bank\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"shortName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankBranches\",\"kind\":\"object\",\"type\":\"BankBranch\",\"relationName\":\"bank_branches\"}],\"dbName\":\"Banks\"},\"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\":\"CustomerToOrder\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"CustomerToStockMovement\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"CustomerToSalesInvoice\"}],\"dbName\":\"Customers\"},\"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\":\"PaymentMethodType\"},{\"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\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToOrder\"}],\"dbName\":\"Orders\"},\"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\":\"posAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToSalesInvoice\"},{\"name\":\"posAccount\",\"kind\":\"object\",\"type\":\"PosAccount\",\"relationName\":\"PosAccountToSalesInvoice\"}],\"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\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"ProductToSalesInvoiceItem\"}],\"dbName\":\"Sales_Invoice_Items\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"Trigger_Logs\"},\"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\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"minimumStockAlertLevel\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventoryTransferItems\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransferItem_Product\"},{\"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\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Product_Stock_Adjustments\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_Product\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"salesInvoiceItems\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"ProductToSalesInvoiceItem\"}],\"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\"},\"PurchaseReceipt\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PurchaseReceiptStatus\"},{\"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\"},{\"name\":\"payments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"PurchaseReceiptToPurchaseReceiptPayments\"}],\"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\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_PurchaseReceiptItems\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceipt_Items\"}],\"dbName\":\"Purchase_Receipt_Items\"},\"PurchaseReceiptPayments\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"paymentMethod\",\"kind\":\"enum\",\"type\":\"PaymentMethodType\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"PaymentType\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"payedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToPurchaseReceiptPayments\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToPurchaseReceiptPayments\"},{\"name\":\"inventoryBankAccount\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryBankAccountToPurchaseReceiptPayments\"},{\"name\":\"inventoryBankAccountInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryBankAccountBankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Purchase_Receipt_Payments\"},\"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\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"remainedInStock\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"counterInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"counterInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_CounterInventory\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToStockMovement\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"StockMovement_Supplier\"}],\"dbName\":\"Stock_Movements\"},\"StockBalance\":{\"fields\":[{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockBalance_Product\"}],\"dbName\":\"Stock_Balance\"},\"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\"},\"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\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Supplier\"},{\"name\":\"receipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToSupplier\"},{\"name\":\"ledger\",\"kind\":\"object\",\"type\":\"SupplierLedger\",\"relationName\":\"SupplierToSupplierLedger\"}],\"dbName\":\"Suppliers\"},\"SupplierLedger\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"debit\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"credit\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"sourceType\",\"kind\":\"enum\",\"type\":\"LedgerSourceType\"},{\"name\":\"sourceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"SupplierToSupplierLedger\"}],\"dbName\":\"Supplier_Ledger\"}},\"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\":\"refreshTokens\",\"kind\":\"object\",\"type\":\"RefreshToken\",\"relationName\":\"RefreshTokenToUser\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"}],\"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\"},\"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\"},\"BankBranch\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"bank\",\"kind\":\"object\",\"type\":\"Bank\",\"relationName\":\"bank_branches\"},{\"name\":\"bankAccounts\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"Bank_Accounts_branchId_fkey\"}],\"dbName\":\"Bank_Branches\"},\"BankAccount\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"accountNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"cardNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"iban\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"branchId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"branch\",\"kind\":\"object\",\"type\":\"BankBranch\",\"relationName\":\"Bank_Accounts_branchId_fkey\"},{\"name\":\"inventoryBankAccounts\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"BankAccountToInventoryBankAccount\"},{\"name\":\"purchaseReceiptPayments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"BankAccountToPurchaseReceiptPayments\"},{\"name\":\"bankAccountTransactions\",\"kind\":\"object\",\"type\":\"BankAccountTransaction\",\"relationName\":\"BankAccountToBankAccountTransaction\"},{\"name\":\"bankAccountBalances\",\"kind\":\"object\",\"type\":\"BankAccountBalance\",\"relationName\":\"BankAccountToBankAccountBalance\"}],\"dbName\":\"Bank_Accounts\"},\"BankAccountTransaction\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"BankAccountTransactionType\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balanceAfter\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"referenceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"referenceType\",\"kind\":\"enum\",\"type\":\"BankTransactionRefType\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToBankAccountTransaction\"}],\"dbName\":\"Bank_Account_Transactions\"},\"BankAccountBalance\":{\"fields\":[{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"balance\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToBankAccountBalance\"}],\"dbName\":\"Bank_Account_Balance\"},\"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\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"isPointOfSale\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"inventoryTransfersFrom\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_From\"},{\"name\":\"inventoryTransfersTo\",\"kind\":\"object\",\"type\":\"InventoryTransfer\",\"relationName\":\"Inventory_To\"},{\"name\":\"purchaseReceipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"InventoryToPurchaseReceipt\"},{\"name\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Inventory_Stock_Adjustments\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"counterStockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_CounterInventory\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"inventoryBankAccounts\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryToInventoryBankAccount\"},{\"name\":\"stockReservations\",\"kind\":\"object\",\"type\":\"StockReservation\",\"relationName\":\"InventoryToStockReservation\"}],\"dbName\":\"Inventories\"},\"InventoryBankAccount\":{\"fields\":[{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"InventoryToInventoryBankAccount\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToInventoryBankAccount\"},{\"name\":\"posAccounts\",\"kind\":\"object\",\"type\":\"PosAccount\",\"relationName\":\"InventoryBankAccountToPosAccount\"},{\"name\":\"purchaseReceiptPayments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"InventoryBankAccountToPurchaseReceiptPayments\"}],\"dbName\":\"Inventory_Bank_Accounts\"},\"PosAccount\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"inventoryBankAccount\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryBankAccountToPosAccount\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"PosAccountToSalesInvoice\"}],\"dbName\":\"Pos_Accounts\"},\"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\"},\"Bank\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"shortName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"bankBranches\",\"kind\":\"object\",\"type\":\"BankBranch\",\"relationName\":\"bank_branches\"}],\"dbName\":\"Banks\"},\"Order\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"OrderStatus\"},{\"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\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToOrder\"},{\"name\":\"orderItems\",\"kind\":\"object\",\"type\":\"OrderItem\",\"relationName\":\"OrderToOrderItem\"}],\"dbName\":\"Orders\"},\"OrderItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"orderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"order\",\"kind\":\"object\",\"type\":\"Order\",\"relationName\":\"OrderToOrderItem\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"OrderItemToProduct\"}],\"dbName\":\"Order_Items\"},\"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\":\"CustomerToOrder\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"CustomerToStockMovement\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"CustomerToSalesInvoice\"}],\"dbName\":\"Customers\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"Trigger_Logs\"},\"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\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"minimumStockAlertLevel\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventoryTransferItems\",\"kind\":\"object\",\"type\":\"InventoryTransferItem\",\"relationName\":\"InventoryTransferItem_Product\"},{\"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\":\"stockAdjustments\",\"kind\":\"object\",\"type\":\"StockAdjustment\",\"relationName\":\"Product_Stock_Adjustments\"},{\"name\":\"stockBalances\",\"kind\":\"object\",\"type\":\"StockBalance\",\"relationName\":\"StockBalance_Product\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"salesInvoiceItems\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"ProductToSalesInvoiceItem\"},{\"name\":\"stockReservations\",\"kind\":\"object\",\"type\":\"StockReservation\",\"relationName\":\"ProductToStockReservation\"},{\"name\":\"orderItems\",\"kind\":\"object\",\"type\":\"OrderItem\",\"relationName\":\"OrderItemToProduct\"}],\"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\"},\"PurchaseReceipt\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PurchaseReceiptStatus\"},{\"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\"},{\"name\":\"payments\",\"kind\":\"object\",\"type\":\"PurchaseReceiptPayments\",\"relationName\":\"PurchaseReceiptToPurchaseReceiptPayments\"}],\"dbName\":\"Purchase_Receipts\"},\"PurchaseReceiptItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_PurchaseReceiptItems\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceipt_Items\"}],\"dbName\":\"Purchase_Receipt_Items\"},\"PurchaseReceiptPayments\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"paymentMethod\",\"kind\":\"enum\",\"type\":\"PaymentMethodType\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"PaymentType\"},{\"name\":\"bankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"receiptId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"payedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"receipt\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToPurchaseReceiptPayments\"},{\"name\":\"bankAccount\",\"kind\":\"object\",\"type\":\"BankAccount\",\"relationName\":\"BankAccountToPurchaseReceiptPayments\"},{\"name\":\"inventoryBankAccount\",\"kind\":\"object\",\"type\":\"InventoryBankAccount\",\"relationName\":\"InventoryBankAccountToPurchaseReceiptPayments\"},{\"name\":\"inventoryBankAccountInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryBankAccountBankAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Purchase_Receipt_Payments\"},\"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\":\"posAccountId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToSalesInvoice\"},{\"name\":\"posAccount\",\"kind\":\"object\",\"type\":\"PosAccount\",\"relationName\":\"PosAccountToSalesInvoice\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"salesInvoicePayments\",\"kind\":\"object\",\"type\":\"SalesInvoicePayment\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"Sales_Invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAmount\",\"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\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"ProductToSalesInvoiceItem\"}],\"dbName\":\"Sales_Invoice_Items\"},\"SalesInvoicePayment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"invoiceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"paymentMethod\",\"kind\":\"enum\",\"type\":\"PaymentMethodType\"},{\"name\":\"paidAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"Sales_Invoice_Payments\"},\"StockMovement\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"MovementType\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unitPrice\",\"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\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"remainedInStock\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"counterInventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"customerId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"counterInventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_CounterInventory\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToStockMovement\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockMovement_Inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockMovement_Product\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"StockMovement_Supplier\"}],\"dbName\":\"Stock_Movements\"},\"StockBalance\":{\"fields\":[{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"avgCost\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"StockBalance_inventory\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"StockBalance_Product\"}],\"dbName\":\"Stock_Balance\"},\"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\"},\"StockReservation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"orderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"InventoryToStockReservation\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"ProductToStockReservation\"}],\"dbName\":\"Stock_Reservations\"},\"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\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Supplier\"},{\"name\":\"receipts\",\"kind\":\"object\",\"type\":\"PurchaseReceipt\",\"relationName\":\"PurchaseReceiptToSupplier\"},{\"name\":\"ledger\",\"kind\":\"object\",\"type\":\"SupplierLedger\",\"relationName\":\"SupplierToSupplierLedger\"}],\"dbName\":\"Suppliers\"},\"SupplierLedger\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"debit\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"credit\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"balance\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"sourceType\",\"kind\":\"enum\",\"type\":\"LedgerSourceType\"},{\"name\":\"sourceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"SupplierToSupplierLedger\"}],\"dbName\":\"Supplier_Ledger\"}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -234,6 +234,26 @@ export interface PrismaClient< */ get bankAccount(): Prisma.BankAccountDelegate; + /** + * `prisma.bankAccountTransaction`: Exposes CRUD operations for the **BankAccountTransaction** model. + * Example usage: + * ```ts + * // Fetch zero or more BankAccountTransactions + * const bankAccountTransactions = await prisma.bankAccountTransaction.findMany() + * ``` + */ + get bankAccountTransaction(): Prisma.BankAccountTransactionDelegate; + + /** + * `prisma.bankAccountBalance`: Exposes CRUD operations for the **BankAccountBalance** model. + * Example usage: + * ```ts + * // Fetch zero or more BankAccountBalances + * const bankAccountBalances = await prisma.bankAccountBalance.findMany() + * ``` + */ + get bankAccountBalance(): Prisma.BankAccountBalanceDelegate; + /** * `prisma.inventory`: Exposes CRUD operations for the **Inventory** model. * Example usage: @@ -294,16 +314,6 @@ export interface PrismaClient< */ get bank(): Prisma.BankDelegate; - /** - * `prisma.customer`: Exposes CRUD operations for the **Customer** model. - * Example usage: - * ```ts - * // Fetch zero or more Customers - * const customers = await prisma.customer.findMany() - * ``` - */ - get customer(): Prisma.CustomerDelegate; - /** * `prisma.order`: Exposes CRUD operations for the **Order** model. * Example usage: @@ -315,24 +325,24 @@ export interface PrismaClient< get order(): Prisma.OrderDelegate; /** - * `prisma.salesInvoice`: Exposes CRUD operations for the **SalesInvoice** model. + * `prisma.orderItem`: Exposes CRUD operations for the **OrderItem** model. * Example usage: * ```ts - * // Fetch zero or more SalesInvoices - * const salesInvoices = await prisma.salesInvoice.findMany() + * // Fetch zero or more OrderItems + * const orderItems = await prisma.orderItem.findMany() * ``` */ - get salesInvoice(): Prisma.SalesInvoiceDelegate; + get orderItem(): Prisma.OrderItemDelegate; /** - * `prisma.salesInvoiceItem`: Exposes CRUD operations for the **SalesInvoiceItem** model. + * `prisma.customer`: Exposes CRUD operations for the **Customer** model. * Example usage: * ```ts - * // Fetch zero or more SalesInvoiceItems - * const salesInvoiceItems = await prisma.salesInvoiceItem.findMany() + * // Fetch zero or more Customers + * const customers = await prisma.customer.findMany() * ``` */ - get salesInvoiceItem(): Prisma.SalesInvoiceItemDelegate; + get customer(): Prisma.CustomerDelegate; /** * `prisma.triggerLog`: Exposes CRUD operations for the **TriggerLog** model. @@ -414,6 +424,36 @@ export interface PrismaClient< */ get purchaseReceiptPayments(): Prisma.PurchaseReceiptPaymentsDelegate; + /** + * `prisma.salesInvoice`: Exposes CRUD operations for the **SalesInvoice** model. + * Example usage: + * ```ts + * // Fetch zero or more SalesInvoices + * const salesInvoices = await prisma.salesInvoice.findMany() + * ``` + */ + get salesInvoice(): Prisma.SalesInvoiceDelegate; + + /** + * `prisma.salesInvoiceItem`: Exposes CRUD operations for the **SalesInvoiceItem** model. + * Example usage: + * ```ts + * // Fetch zero or more SalesInvoiceItems + * const salesInvoiceItems = await prisma.salesInvoiceItem.findMany() + * ``` + */ + get salesInvoiceItem(): Prisma.SalesInvoiceItemDelegate; + + /** + * `prisma.salesInvoicePayment`: Exposes CRUD operations for the **SalesInvoicePayment** model. + * Example usage: + * ```ts + * // Fetch zero or more SalesInvoicePayments + * const salesInvoicePayments = await prisma.salesInvoicePayment.findMany() + * ``` + */ + get salesInvoicePayment(): Prisma.SalesInvoicePaymentDelegate; + /** * `prisma.stockMovement`: Exposes CRUD operations for the **StockMovement** model. * Example usage: @@ -444,6 +484,16 @@ export interface PrismaClient< */ get stockAdjustment(): Prisma.StockAdjustmentDelegate; + /** + * `prisma.stockReservation`: Exposes CRUD operations for the **StockReservation** model. + * Example usage: + * ```ts + * // Fetch zero or more StockReservations + * const stockReservations = await prisma.stockReservation.findMany() + * ``` + */ + get stockReservation(): Prisma.StockReservationDelegate; + /** * `prisma.supplier`: Exposes CRUD operations for the **Supplier** model. * Example usage: diff --git a/src/generated/prisma/internal/prismaNamespace.ts b/src/generated/prisma/internal/prismaNamespace.ts index 97ddd94..8a87048 100644 --- a/src/generated/prisma/internal/prismaNamespace.ts +++ b/src/generated/prisma/internal/prismaNamespace.ts @@ -390,16 +390,17 @@ export const ModelName = { RefreshToken: 'RefreshToken', BankBranch: 'BankBranch', BankAccount: 'BankAccount', + BankAccountTransaction: 'BankAccountTransaction', + BankAccountBalance: 'BankAccountBalance', Inventory: 'Inventory', InventoryBankAccount: 'InventoryBankAccount', PosAccount: 'PosAccount', InventoryTransfer: 'InventoryTransfer', InventoryTransferItem: 'InventoryTransferItem', Bank: 'Bank', - Customer: 'Customer', Order: 'Order', - SalesInvoice: 'SalesInvoice', - SalesInvoiceItem: 'SalesInvoiceItem', + OrderItem: 'OrderItem', + Customer: 'Customer', TriggerLog: 'TriggerLog', ProductVariant: 'ProductVariant', Product: 'Product', @@ -408,9 +409,13 @@ export const ModelName = { PurchaseReceipt: 'PurchaseReceipt', PurchaseReceiptItem: 'PurchaseReceiptItem', PurchaseReceiptPayments: 'PurchaseReceiptPayments', + SalesInvoice: 'SalesInvoice', + SalesInvoiceItem: 'SalesInvoiceItem', + SalesInvoicePayment: 'SalesInvoicePayment', StockMovement: 'StockMovement', StockBalance: 'StockBalance', StockAdjustment: 'StockAdjustment', + StockReservation: 'StockReservation', Supplier: 'Supplier', SupplierLedger: 'SupplierLedger' } as const @@ -428,7 +433,7 @@ export type TypeMap + fields: Prisma.BankAccountTransactionFieldRefs + operations: { + findUnique: { + args: Prisma.BankAccountTransactionFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.BankAccountTransactionFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.BankAccountTransactionFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.BankAccountTransactionFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.BankAccountTransactionFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.BankAccountTransactionCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.BankAccountTransactionCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.BankAccountTransactionDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.BankAccountTransactionUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.BankAccountTransactionDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.BankAccountTransactionUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.BankAccountTransactionUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.BankAccountTransactionAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.BankAccountTransactionGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.BankAccountTransactionCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + BankAccountBalance: { + payload: Prisma.$BankAccountBalancePayload + fields: Prisma.BankAccountBalanceFieldRefs + operations: { + findUnique: { + args: Prisma.BankAccountBalanceFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.BankAccountBalanceFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.BankAccountBalanceFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.BankAccountBalanceFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.BankAccountBalanceFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.BankAccountBalanceCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.BankAccountBalanceCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.BankAccountBalanceDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.BankAccountBalanceUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.BankAccountBalanceDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.BankAccountBalanceUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.BankAccountBalanceUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.BankAccountBalanceAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.BankAccountBalanceGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.BankAccountBalanceCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } Inventory: { payload: Prisma.$InventoryPayload fields: Prisma.InventoryFieldRefs @@ -1224,72 +1361,6 @@ export type TypeMap - fields: Prisma.CustomerFieldRefs - operations: { - findUnique: { - args: Prisma.CustomerFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.CustomerFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.CustomerFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.CustomerFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.CustomerFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.CustomerCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.CustomerCreateManyArgs - result: BatchPayload - } - delete: { - args: Prisma.CustomerDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.CustomerUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.CustomerDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.CustomerUpdateManyArgs - result: BatchPayload - } - upsert: { - args: Prisma.CustomerUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.CustomerAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.CustomerGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.CustomerCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } Order: { payload: Prisma.$OrderPayload fields: Prisma.OrderFieldRefs @@ -1356,135 +1427,135 @@ export type TypeMap - fields: Prisma.SalesInvoiceFieldRefs + OrderItem: { + payload: Prisma.$OrderItemPayload + fields: Prisma.OrderItemFieldRefs operations: { findUnique: { - args: Prisma.SalesInvoiceFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null + args: Prisma.OrderItemFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null } findUniqueOrThrow: { - args: Prisma.SalesInvoiceFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult } findFirst: { - args: Prisma.SalesInvoiceFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null + args: Prisma.OrderItemFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null } findFirstOrThrow: { - args: Prisma.SalesInvoiceFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult } findMany: { - args: Prisma.SalesInvoiceFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] + args: Prisma.OrderItemFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] } create: { - args: Prisma.SalesInvoiceCreateArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemCreateArgs + result: runtime.Types.Utils.PayloadToResult } createMany: { - args: Prisma.SalesInvoiceCreateManyArgs + args: Prisma.OrderItemCreateManyArgs result: BatchPayload } delete: { - args: Prisma.SalesInvoiceDeleteArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemDeleteArgs + result: runtime.Types.Utils.PayloadToResult } update: { - args: Prisma.SalesInvoiceUpdateArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemUpdateArgs + result: runtime.Types.Utils.PayloadToResult } deleteMany: { - args: Prisma.SalesInvoiceDeleteManyArgs + args: Prisma.OrderItemDeleteManyArgs result: BatchPayload } updateMany: { - args: Prisma.SalesInvoiceUpdateManyArgs + args: Prisma.OrderItemUpdateManyArgs result: BatchPayload } upsert: { - args: Prisma.SalesInvoiceUpsertArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.OrderItemUpsertArgs + result: runtime.Types.Utils.PayloadToResult } aggregate: { - args: Prisma.SalesInvoiceAggregateArgs - result: runtime.Types.Utils.Optional + args: Prisma.OrderItemAggregateArgs + result: runtime.Types.Utils.Optional } groupBy: { - args: Prisma.SalesInvoiceGroupByArgs - result: runtime.Types.Utils.Optional[] + args: Prisma.OrderItemGroupByArgs + result: runtime.Types.Utils.Optional[] } count: { - args: Prisma.SalesInvoiceCountArgs - result: runtime.Types.Utils.Optional | number + args: Prisma.OrderItemCountArgs + result: runtime.Types.Utils.Optional | number } } } - SalesInvoiceItem: { - payload: Prisma.$SalesInvoiceItemPayload - fields: Prisma.SalesInvoiceItemFieldRefs + Customer: { + payload: Prisma.$CustomerPayload + fields: Prisma.CustomerFieldRefs operations: { findUnique: { - args: Prisma.SalesInvoiceItemFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null + args: Prisma.CustomerFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null } findUniqueOrThrow: { - args: Prisma.SalesInvoiceItemFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult } findFirst: { - args: Prisma.SalesInvoiceItemFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null + args: Prisma.CustomerFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null } findFirstOrThrow: { - args: Prisma.SalesInvoiceItemFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult } findMany: { - args: Prisma.SalesInvoiceItemFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] + args: Prisma.CustomerFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] } create: { - args: Prisma.SalesInvoiceItemCreateArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerCreateArgs + result: runtime.Types.Utils.PayloadToResult } createMany: { - args: Prisma.SalesInvoiceItemCreateManyArgs + args: Prisma.CustomerCreateManyArgs result: BatchPayload } delete: { - args: Prisma.SalesInvoiceItemDeleteArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerDeleteArgs + result: runtime.Types.Utils.PayloadToResult } update: { - args: Prisma.SalesInvoiceItemUpdateArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerUpdateArgs + result: runtime.Types.Utils.PayloadToResult } deleteMany: { - args: Prisma.SalesInvoiceItemDeleteManyArgs + args: Prisma.CustomerDeleteManyArgs result: BatchPayload } updateMany: { - args: Prisma.SalesInvoiceItemUpdateManyArgs + args: Prisma.CustomerUpdateManyArgs result: BatchPayload } upsert: { - args: Prisma.SalesInvoiceItemUpsertArgs - result: runtime.Types.Utils.PayloadToResult + args: Prisma.CustomerUpsertArgs + result: runtime.Types.Utils.PayloadToResult } aggregate: { - args: Prisma.SalesInvoiceItemAggregateArgs - result: runtime.Types.Utils.Optional + args: Prisma.CustomerAggregateArgs + result: runtime.Types.Utils.Optional } groupBy: { - args: Prisma.SalesInvoiceItemGroupByArgs - result: runtime.Types.Utils.Optional[] + args: Prisma.CustomerGroupByArgs + result: runtime.Types.Utils.Optional[] } count: { - args: Prisma.SalesInvoiceItemCountArgs - result: runtime.Types.Utils.Optional | number + args: Prisma.CustomerCountArgs + result: runtime.Types.Utils.Optional | number } } } @@ -2016,6 +2087,204 @@ export type TypeMap + fields: Prisma.SalesInvoiceFieldRefs + operations: { + findUnique: { + args: Prisma.SalesInvoiceFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.SalesInvoiceFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.SalesInvoiceFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.SalesInvoiceFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.SalesInvoiceFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.SalesInvoiceCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.SalesInvoiceCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.SalesInvoiceDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.SalesInvoiceUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.SalesInvoiceDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.SalesInvoiceUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.SalesInvoiceUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.SalesInvoiceAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.SalesInvoiceGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.SalesInvoiceCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + SalesInvoiceItem: { + payload: Prisma.$SalesInvoiceItemPayload + fields: Prisma.SalesInvoiceItemFieldRefs + operations: { + findUnique: { + args: Prisma.SalesInvoiceItemFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.SalesInvoiceItemFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.SalesInvoiceItemFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.SalesInvoiceItemFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.SalesInvoiceItemFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.SalesInvoiceItemCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.SalesInvoiceItemCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.SalesInvoiceItemDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.SalesInvoiceItemUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.SalesInvoiceItemDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.SalesInvoiceItemUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.SalesInvoiceItemUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.SalesInvoiceItemAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.SalesInvoiceItemGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.SalesInvoiceItemCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + SalesInvoicePayment: { + payload: Prisma.$SalesInvoicePaymentPayload + fields: Prisma.SalesInvoicePaymentFieldRefs + operations: { + findUnique: { + args: Prisma.SalesInvoicePaymentFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.SalesInvoicePaymentFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.SalesInvoicePaymentFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.SalesInvoicePaymentFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.SalesInvoicePaymentFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.SalesInvoicePaymentCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.SalesInvoicePaymentCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.SalesInvoicePaymentDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.SalesInvoicePaymentUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.SalesInvoicePaymentDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.SalesInvoicePaymentUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.SalesInvoicePaymentUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.SalesInvoicePaymentAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.SalesInvoicePaymentGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.SalesInvoicePaymentCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } StockMovement: { payload: Prisma.$StockMovementPayload fields: Prisma.StockMovementFieldRefs @@ -2214,6 +2483,72 @@ export type TypeMap + fields: Prisma.StockReservationFieldRefs + operations: { + findUnique: { + args: Prisma.StockReservationFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.StockReservationFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.StockReservationFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.StockReservationFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.StockReservationFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.StockReservationCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.StockReservationCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.StockReservationDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.StockReservationUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.StockReservationDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.StockReservationUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.StockReservationUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.StockReservationAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.StockReservationGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.StockReservationCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } Supplier: { payload: Prisma.$SupplierPayload fields: Prisma.SupplierFieldRefs @@ -2466,6 +2801,30 @@ export const BankAccountScalarFieldEnum = { export type BankAccountScalarFieldEnum = (typeof BankAccountScalarFieldEnum)[keyof typeof BankAccountScalarFieldEnum] +export const BankAccountTransactionScalarFieldEnum = { + id: 'id', + bankAccountId: 'bankAccountId', + type: 'type', + amount: 'amount', + balanceAfter: 'balanceAfter', + referenceId: 'referenceId', + referenceType: 'referenceType', + description: 'description', + createdAt: 'createdAt' +} as const + +export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum] + + +export const BankAccountBalanceScalarFieldEnum = { + bankAccountId: 'bankAccountId', + balance: 'balance', + updatedAt: 'updatedAt' +} as const + +export type BankAccountBalanceScalarFieldEnum = (typeof BankAccountBalanceScalarFieldEnum)[keyof typeof BankAccountBalanceScalarFieldEnum] + + export const InventoryScalarFieldEnum = { id: 'id', name: 'name', @@ -2537,6 +2896,34 @@ export const BankScalarFieldEnum = { export type BankScalarFieldEnum = (typeof BankScalarFieldEnum)[keyof typeof BankScalarFieldEnum] +export const OrderScalarFieldEnum = { + id: 'id', + orderNumber: 'orderNumber', + status: 'status', + totalAmount: 'totalAmount', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + deletedAt: 'deletedAt', + customerId: 'customerId' +} as const + +export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] + + +export const OrderItemScalarFieldEnum = { + id: 'id', + quantity: 'quantity', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', + createdAt: 'createdAt', + orderId: 'orderId', + productId: 'productId' +} as const + +export type OrderItemScalarFieldEnum = (typeof OrderItemScalarFieldEnum)[keyof typeof OrderItemScalarFieldEnum] + + export const CustomerScalarFieldEnum = { id: 'id', firstName: 'firstName', @@ -2556,49 +2943,6 @@ export const CustomerScalarFieldEnum = { export type CustomerScalarFieldEnum = (typeof CustomerScalarFieldEnum)[keyof typeof CustomerScalarFieldEnum] -export const OrderScalarFieldEnum = { - id: 'id', - orderNumber: 'orderNumber', - status: 'status', - paymentMethod: 'paymentMethod', - totalAmount: 'totalAmount', - description: 'description', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - deletedAt: 'deletedAt', - customerId: 'customerId' -} as const - -export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] - - -export const SalesInvoiceScalarFieldEnum = { - id: 'id', - code: 'code', - totalAmount: 'totalAmount', - description: 'description', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - customerId: 'customerId', - posAccountId: 'posAccountId' -} as const - -export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] - - -export const SalesInvoiceItemScalarFieldEnum = { - id: 'id', - count: 'count', - fee: 'fee', - total: 'total', - createdAt: 'createdAt', - invoiceId: 'invoiceId', - productId: 'productId' -} as const - -export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum] - - export const TriggerLogScalarFieldEnum = { id: 'id', message: 'message', @@ -2694,8 +3038,8 @@ export type PurchaseReceiptScalarFieldEnum = (typeof PurchaseReceiptScalarFieldE export const PurchaseReceiptItemScalarFieldEnum = { id: 'id', count: 'count', - fee: 'fee', - total: 'total', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', receiptId: 'receiptId', productId: 'productId', description: 'description', @@ -2722,11 +3066,50 @@ export const PurchaseReceiptPaymentsScalarFieldEnum = { export type PurchaseReceiptPaymentsScalarFieldEnum = (typeof PurchaseReceiptPaymentsScalarFieldEnum)[keyof typeof PurchaseReceiptPaymentsScalarFieldEnum] +export const SalesInvoiceScalarFieldEnum = { + id: 'id', + code: 'code', + totalAmount: 'totalAmount', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + customerId: 'customerId', + posAccountId: 'posAccountId' +} as const + +export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] + + +export const SalesInvoiceItemScalarFieldEnum = { + id: 'id', + count: 'count', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', + createdAt: 'createdAt', + invoiceId: 'invoiceId', + productId: 'productId' +} as const + +export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum] + + +export const SalesInvoicePaymentScalarFieldEnum = { + id: 'id', + invoiceId: 'invoiceId', + amount: 'amount', + paymentMethod: 'paymentMethod', + paidAt: 'paidAt', + createdAt: 'createdAt' +} as const + +export type SalesInvoicePaymentScalarFieldEnum = (typeof SalesInvoicePaymentScalarFieldEnum)[keyof typeof SalesInvoicePaymentScalarFieldEnum] + + export const StockMovementScalarFieldEnum = { id: 'id', type: 'type', quantity: 'quantity', - fee: 'fee', + unitPrice: 'unitPrice', totalCost: 'totalCost', referenceType: 'referenceType', referenceId: 'referenceId', @@ -2768,6 +3151,19 @@ export const StockAdjustmentScalarFieldEnum = { export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldEnum)[keyof typeof StockAdjustmentScalarFieldEnum] +export const StockReservationScalarFieldEnum = { + id: 'id', + quantity: 'quantity', + expiresAt: 'expiresAt', + createdAt: 'createdAt', + productId: 'productId', + inventoryId: 'inventoryId', + orderId: 'orderId' +} as const + +export type StockReservationScalarFieldEnum = (typeof StockReservationScalarFieldEnum)[keyof typeof StockReservationScalarFieldEnum] + + export const SupplierScalarFieldEnum = { id: 'id', firstName: 'firstName', @@ -2895,6 +3291,13 @@ export const BankAccountOrderByRelevanceFieldEnum = { export type BankAccountOrderByRelevanceFieldEnum = (typeof BankAccountOrderByRelevanceFieldEnum)[keyof typeof BankAccountOrderByRelevanceFieldEnum] +export const BankAccountTransactionOrderByRelevanceFieldEnum = { + description: 'description' +} as const + +export type BankAccountTransactionOrderByRelevanceFieldEnum = (typeof BankAccountTransactionOrderByRelevanceFieldEnum)[keyof typeof BankAccountTransactionOrderByRelevanceFieldEnum] + + export const InventoryOrderByRelevanceFieldEnum = { name: 'name', location: 'location' @@ -2928,6 +3331,14 @@ export const BankOrderByRelevanceFieldEnum = { export type BankOrderByRelevanceFieldEnum = (typeof BankOrderByRelevanceFieldEnum)[keyof typeof BankOrderByRelevanceFieldEnum] +export const OrderOrderByRelevanceFieldEnum = { + orderNumber: 'orderNumber', + description: 'description' +} as const + +export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum] + + export const CustomerOrderByRelevanceFieldEnum = { firstName: 'firstName', lastName: 'lastName', @@ -2942,22 +3353,6 @@ export const CustomerOrderByRelevanceFieldEnum = { export type CustomerOrderByRelevanceFieldEnum = (typeof CustomerOrderByRelevanceFieldEnum)[keyof typeof CustomerOrderByRelevanceFieldEnum] -export const OrderOrderByRelevanceFieldEnum = { - orderNumber: 'orderNumber', - description: 'description' -} as const - -export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum] - - -export const SalesInvoiceOrderByRelevanceFieldEnum = { - code: 'code', - description: 'description' -} as const - -export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] - - export const TriggerLogOrderByRelevanceFieldEnum = { message: 'message', name: 'name' @@ -3027,6 +3422,14 @@ export const PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = { export type PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = (typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum)[keyof typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum] +export const SalesInvoiceOrderByRelevanceFieldEnum = { + code: 'code', + description: 'description' +} as const + +export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] + + export const StockMovementOrderByRelevanceFieldEnum = { referenceId: 'referenceId' } as const @@ -3103,6 +3506,13 @@ export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, +/** + * Reference to a field of type 'BankAccountTransactionType' + */ +export type EnumBankAccountTransactionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BankAccountTransactionType'> + + + /** * Reference to a field of type 'Decimal' */ @@ -3110,6 +3520,13 @@ export type DecimalFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, +/** + * Reference to a field of type 'BankTransactionRefType' + */ +export type EnumBankTransactionRefTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BankTransactionRefType'> + + + /** * Reference to a field of type 'OrderStatus' */ @@ -3118,16 +3535,16 @@ export type EnumOrderStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$Pris /** - * Reference to a field of type 'PaymentMethodType' + * Reference to a field of type 'PurchaseReceiptStatus' */ -export type EnumPaymentMethodTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'PaymentMethodType'> +export type EnumPurchaseReceiptStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'PurchaseReceiptStatus'> /** - * Reference to a field of type 'PurchaseReceiptStatus' + * Reference to a field of type 'PaymentMethodType' */ -export type EnumPurchaseReceiptStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'PurchaseReceiptStatus'> +export type EnumPaymentMethodTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'PaymentMethodType'> @@ -3266,16 +3683,17 @@ export type GlobalOmitConfig = { refreshToken?: Prisma.RefreshTokenOmit bankBranch?: Prisma.BankBranchOmit bankAccount?: Prisma.BankAccountOmit + bankAccountTransaction?: Prisma.BankAccountTransactionOmit + bankAccountBalance?: Prisma.BankAccountBalanceOmit inventory?: Prisma.InventoryOmit inventoryBankAccount?: Prisma.InventoryBankAccountOmit posAccount?: Prisma.PosAccountOmit inventoryTransfer?: Prisma.InventoryTransferOmit inventoryTransferItem?: Prisma.InventoryTransferItemOmit bank?: Prisma.BankOmit - customer?: Prisma.CustomerOmit order?: Prisma.OrderOmit - salesInvoice?: Prisma.SalesInvoiceOmit - salesInvoiceItem?: Prisma.SalesInvoiceItemOmit + orderItem?: Prisma.OrderItemOmit + customer?: Prisma.CustomerOmit triggerLog?: Prisma.TriggerLogOmit productVariant?: Prisma.ProductVariantOmit product?: Prisma.ProductOmit @@ -3284,9 +3702,13 @@ export type GlobalOmitConfig = { purchaseReceipt?: Prisma.PurchaseReceiptOmit purchaseReceiptItem?: Prisma.PurchaseReceiptItemOmit purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOmit + salesInvoice?: Prisma.SalesInvoiceOmit + salesInvoiceItem?: Prisma.SalesInvoiceItemOmit + salesInvoicePayment?: Prisma.SalesInvoicePaymentOmit stockMovement?: Prisma.StockMovementOmit stockBalance?: Prisma.StockBalanceOmit stockAdjustment?: Prisma.StockAdjustmentOmit + stockReservation?: Prisma.StockReservationOmit supplier?: Prisma.SupplierOmit supplierLedger?: Prisma.SupplierLedgerOmit } diff --git a/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/generated/prisma/internal/prismaNamespaceBrowser.ts index 2fe93a0..15373d9 100644 --- a/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -57,16 +57,17 @@ export const ModelName = { RefreshToken: 'RefreshToken', BankBranch: 'BankBranch', BankAccount: 'BankAccount', + BankAccountTransaction: 'BankAccountTransaction', + BankAccountBalance: 'BankAccountBalance', Inventory: 'Inventory', InventoryBankAccount: 'InventoryBankAccount', PosAccount: 'PosAccount', InventoryTransfer: 'InventoryTransfer', InventoryTransferItem: 'InventoryTransferItem', Bank: 'Bank', - Customer: 'Customer', Order: 'Order', - SalesInvoice: 'SalesInvoice', - SalesInvoiceItem: 'SalesInvoiceItem', + OrderItem: 'OrderItem', + Customer: 'Customer', TriggerLog: 'TriggerLog', ProductVariant: 'ProductVariant', Product: 'Product', @@ -75,9 +76,13 @@ export const ModelName = { PurchaseReceipt: 'PurchaseReceipt', PurchaseReceiptItem: 'PurchaseReceiptItem', PurchaseReceiptPayments: 'PurchaseReceiptPayments', + SalesInvoice: 'SalesInvoice', + SalesInvoiceItem: 'SalesInvoiceItem', + SalesInvoicePayment: 'SalesInvoicePayment', StockMovement: 'StockMovement', StockBalance: 'StockBalance', StockAdjustment: 'StockAdjustment', + StockReservation: 'StockReservation', Supplier: 'Supplier', SupplierLedger: 'SupplierLedger' } as const @@ -179,6 +184,30 @@ export const BankAccountScalarFieldEnum = { export type BankAccountScalarFieldEnum = (typeof BankAccountScalarFieldEnum)[keyof typeof BankAccountScalarFieldEnum] +export const BankAccountTransactionScalarFieldEnum = { + id: 'id', + bankAccountId: 'bankAccountId', + type: 'type', + amount: 'amount', + balanceAfter: 'balanceAfter', + referenceId: 'referenceId', + referenceType: 'referenceType', + description: 'description', + createdAt: 'createdAt' +} as const + +export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum] + + +export const BankAccountBalanceScalarFieldEnum = { + bankAccountId: 'bankAccountId', + balance: 'balance', + updatedAt: 'updatedAt' +} as const + +export type BankAccountBalanceScalarFieldEnum = (typeof BankAccountBalanceScalarFieldEnum)[keyof typeof BankAccountBalanceScalarFieldEnum] + + export const InventoryScalarFieldEnum = { id: 'id', name: 'name', @@ -250,6 +279,34 @@ export const BankScalarFieldEnum = { export type BankScalarFieldEnum = (typeof BankScalarFieldEnum)[keyof typeof BankScalarFieldEnum] +export const OrderScalarFieldEnum = { + id: 'id', + orderNumber: 'orderNumber', + status: 'status', + totalAmount: 'totalAmount', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + deletedAt: 'deletedAt', + customerId: 'customerId' +} as const + +export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] + + +export const OrderItemScalarFieldEnum = { + id: 'id', + quantity: 'quantity', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', + createdAt: 'createdAt', + orderId: 'orderId', + productId: 'productId' +} as const + +export type OrderItemScalarFieldEnum = (typeof OrderItemScalarFieldEnum)[keyof typeof OrderItemScalarFieldEnum] + + export const CustomerScalarFieldEnum = { id: 'id', firstName: 'firstName', @@ -269,49 +326,6 @@ export const CustomerScalarFieldEnum = { export type CustomerScalarFieldEnum = (typeof CustomerScalarFieldEnum)[keyof typeof CustomerScalarFieldEnum] -export const OrderScalarFieldEnum = { - id: 'id', - orderNumber: 'orderNumber', - status: 'status', - paymentMethod: 'paymentMethod', - totalAmount: 'totalAmount', - description: 'description', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - deletedAt: 'deletedAt', - customerId: 'customerId' -} as const - -export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] - - -export const SalesInvoiceScalarFieldEnum = { - id: 'id', - code: 'code', - totalAmount: 'totalAmount', - description: 'description', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - customerId: 'customerId', - posAccountId: 'posAccountId' -} as const - -export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] - - -export const SalesInvoiceItemScalarFieldEnum = { - id: 'id', - count: 'count', - fee: 'fee', - total: 'total', - createdAt: 'createdAt', - invoiceId: 'invoiceId', - productId: 'productId' -} as const - -export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum] - - export const TriggerLogScalarFieldEnum = { id: 'id', message: 'message', @@ -407,8 +421,8 @@ export type PurchaseReceiptScalarFieldEnum = (typeof PurchaseReceiptScalarFieldE export const PurchaseReceiptItemScalarFieldEnum = { id: 'id', count: 'count', - fee: 'fee', - total: 'total', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', receiptId: 'receiptId', productId: 'productId', description: 'description', @@ -435,11 +449,50 @@ export const PurchaseReceiptPaymentsScalarFieldEnum = { export type PurchaseReceiptPaymentsScalarFieldEnum = (typeof PurchaseReceiptPaymentsScalarFieldEnum)[keyof typeof PurchaseReceiptPaymentsScalarFieldEnum] +export const SalesInvoiceScalarFieldEnum = { + id: 'id', + code: 'code', + totalAmount: 'totalAmount', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + customerId: 'customerId', + posAccountId: 'posAccountId' +} as const + +export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] + + +export const SalesInvoiceItemScalarFieldEnum = { + id: 'id', + count: 'count', + unitPrice: 'unitPrice', + totalAmount: 'totalAmount', + createdAt: 'createdAt', + invoiceId: 'invoiceId', + productId: 'productId' +} as const + +export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum] + + +export const SalesInvoicePaymentScalarFieldEnum = { + id: 'id', + invoiceId: 'invoiceId', + amount: 'amount', + paymentMethod: 'paymentMethod', + paidAt: 'paidAt', + createdAt: 'createdAt' +} as const + +export type SalesInvoicePaymentScalarFieldEnum = (typeof SalesInvoicePaymentScalarFieldEnum)[keyof typeof SalesInvoicePaymentScalarFieldEnum] + + export const StockMovementScalarFieldEnum = { id: 'id', type: 'type', quantity: 'quantity', - fee: 'fee', + unitPrice: 'unitPrice', totalCost: 'totalCost', referenceType: 'referenceType', referenceId: 'referenceId', @@ -481,6 +534,19 @@ export const StockAdjustmentScalarFieldEnum = { export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldEnum)[keyof typeof StockAdjustmentScalarFieldEnum] +export const StockReservationScalarFieldEnum = { + id: 'id', + quantity: 'quantity', + expiresAt: 'expiresAt', + createdAt: 'createdAt', + productId: 'productId', + inventoryId: 'inventoryId', + orderId: 'orderId' +} as const + +export type StockReservationScalarFieldEnum = (typeof StockReservationScalarFieldEnum)[keyof typeof StockReservationScalarFieldEnum] + + export const SupplierScalarFieldEnum = { id: 'id', firstName: 'firstName', @@ -608,6 +674,13 @@ export const BankAccountOrderByRelevanceFieldEnum = { export type BankAccountOrderByRelevanceFieldEnum = (typeof BankAccountOrderByRelevanceFieldEnum)[keyof typeof BankAccountOrderByRelevanceFieldEnum] +export const BankAccountTransactionOrderByRelevanceFieldEnum = { + description: 'description' +} as const + +export type BankAccountTransactionOrderByRelevanceFieldEnum = (typeof BankAccountTransactionOrderByRelevanceFieldEnum)[keyof typeof BankAccountTransactionOrderByRelevanceFieldEnum] + + export const InventoryOrderByRelevanceFieldEnum = { name: 'name', location: 'location' @@ -641,6 +714,14 @@ export const BankOrderByRelevanceFieldEnum = { export type BankOrderByRelevanceFieldEnum = (typeof BankOrderByRelevanceFieldEnum)[keyof typeof BankOrderByRelevanceFieldEnum] +export const OrderOrderByRelevanceFieldEnum = { + orderNumber: 'orderNumber', + description: 'description' +} as const + +export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum] + + export const CustomerOrderByRelevanceFieldEnum = { firstName: 'firstName', lastName: 'lastName', @@ -655,22 +736,6 @@ export const CustomerOrderByRelevanceFieldEnum = { export type CustomerOrderByRelevanceFieldEnum = (typeof CustomerOrderByRelevanceFieldEnum)[keyof typeof CustomerOrderByRelevanceFieldEnum] -export const OrderOrderByRelevanceFieldEnum = { - orderNumber: 'orderNumber', - description: 'description' -} as const - -export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum] - - -export const SalesInvoiceOrderByRelevanceFieldEnum = { - code: 'code', - description: 'description' -} as const - -export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] - - export const TriggerLogOrderByRelevanceFieldEnum = { message: 'message', name: 'name' @@ -740,6 +805,14 @@ export const PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = { export type PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = (typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum)[keyof typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum] +export const SalesInvoiceOrderByRelevanceFieldEnum = { + code: 'code', + description: 'description' +} as const + +export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] + + export const StockMovementOrderByRelevanceFieldEnum = { referenceId: 'referenceId' } as const diff --git a/src/generated/prisma/models.ts b/src/generated/prisma/models.ts index ba58fa6..18f627e 100644 --- a/src/generated/prisma/models.ts +++ b/src/generated/prisma/models.ts @@ -14,16 +14,17 @@ export type * from './models/OtpCode.js' export type * from './models/RefreshToken.js' export type * from './models/BankBranch.js' export type * from './models/BankAccount.js' +export type * from './models/BankAccountTransaction.js' +export type * from './models/BankAccountBalance.js' export type * from './models/Inventory.js' export type * from './models/InventoryBankAccount.js' export type * from './models/PosAccount.js' export type * from './models/InventoryTransfer.js' export type * from './models/InventoryTransferItem.js' export type * from './models/Bank.js' -export type * from './models/Customer.js' export type * from './models/Order.js' -export type * from './models/SalesInvoice.js' -export type * from './models/SalesInvoiceItem.js' +export type * from './models/OrderItem.js' +export type * from './models/Customer.js' export type * from './models/TriggerLog.js' export type * from './models/ProductVariant.js' export type * from './models/Product.js' @@ -32,9 +33,13 @@ export type * from './models/ProductCategory.js' export type * from './models/PurchaseReceipt.js' export type * from './models/PurchaseReceiptItem.js' export type * from './models/PurchaseReceiptPayments.js' +export type * from './models/SalesInvoice.js' +export type * from './models/SalesInvoiceItem.js' +export type * from './models/SalesInvoicePayment.js' export type * from './models/StockMovement.js' export type * from './models/StockBalance.js' export type * from './models/StockAdjustment.js' +export type * from './models/StockReservation.js' export type * from './models/Supplier.js' export type * from './models/SupplierLedger.js' export type * from './commonInputTypes.js' \ No newline at end of file diff --git a/src/generated/prisma/models/BankAccount.ts b/src/generated/prisma/models/BankAccount.ts index 02977a0..606fcc1 100644 --- a/src/generated/prisma/models/BankAccount.ts +++ b/src/generated/prisma/models/BankAccount.ts @@ -255,6 +255,8 @@ export type BankAccountWhereInput = { branch?: Prisma.XOR inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter + bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter + bankAccountBalances?: Prisma.BankAccountBalanceListRelationFilter } export type BankAccountOrderByWithRelationInput = { @@ -270,6 +272,8 @@ export type BankAccountOrderByWithRelationInput = { branch?: Prisma.BankBranchOrderByWithRelationInput inventoryBankAccounts?: Prisma.InventoryBankAccountOrderByRelationAggregateInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOrderByRelationAggregateInput + bankAccountTransactions?: Prisma.BankAccountTransactionOrderByRelationAggregateInput + bankAccountBalances?: Prisma.BankAccountBalanceOrderByRelationAggregateInput _relevance?: Prisma.BankAccountOrderByRelevanceInput } @@ -289,6 +293,8 @@ export type BankAccountWhereUniqueInput = Prisma.AtLeast<{ branch?: Prisma.XOR inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter + bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter + bankAccountBalances?: Prisma.BankAccountBalanceListRelationFilter }, "id" | "accountNumber" | "cardNumber" | "iban"> export type BankAccountOrderByWithAggregationInput = { @@ -334,6 +340,8 @@ export type BankAccountCreateInput = { branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput } export type BankAccountUncheckedCreateInput = { @@ -348,6 +356,8 @@ export type BankAccountUncheckedCreateInput = { deletedAt?: Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput } export type BankAccountUpdateInput = { @@ -361,6 +371,8 @@ export type BankAccountUpdateInput = { branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput } export type BankAccountUncheckedUpdateInput = { @@ -375,6 +387,8 @@ export type BankAccountUncheckedUpdateInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput } export type BankAccountCreateManyInput = { @@ -520,6 +534,34 @@ export type BankAccountUncheckedUpdateManyWithoutBranchNestedInput = { deleteMany?: Prisma.BankAccountScalarWhereInput | Prisma.BankAccountScalarWhereInput[] } +export type BankAccountCreateNestedOneWithoutBankAccountTransactionsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountTransactionsInput + connect?: Prisma.BankAccountWhereUniqueInput +} + +export type BankAccountUpdateOneRequiredWithoutBankAccountTransactionsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountTransactionsInput + upsert?: Prisma.BankAccountUpsertWithoutBankAccountTransactionsInput + connect?: Prisma.BankAccountWhereUniqueInput + update?: Prisma.XOR, Prisma.BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput> +} + +export type BankAccountCreateNestedOneWithoutBankAccountBalancesInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountBalancesInput + connect?: Prisma.BankAccountWhereUniqueInput +} + +export type BankAccountUpdateOneRequiredWithoutBankAccountBalancesNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountBalancesInput + upsert?: Prisma.BankAccountUpsertWithoutBankAccountBalancesInput + connect?: Prisma.BankAccountWhereUniqueInput + update?: Prisma.XOR, Prisma.BankAccountUncheckedUpdateWithoutBankAccountBalancesInput> +} + export type BankAccountCreateNestedOneWithoutInventoryBankAccountsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoryBankAccountsInput @@ -558,6 +600,8 @@ export type BankAccountCreateWithoutBranchInput = { deletedAt?: Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput } export type BankAccountUncheckedCreateWithoutBranchInput = { @@ -571,6 +615,8 @@ export type BankAccountUncheckedCreateWithoutBranchInput = { deletedAt?: Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput } export type BankAccountCreateOrConnectWithoutBranchInput = { @@ -614,6 +660,154 @@ export type BankAccountScalarWhereInput = { deletedAt?: Prisma.DateTimeNullableFilter<"BankAccount"> | Date | string | null } +export type BankAccountCreateWithoutBankAccountTransactionsInput = { + accountNumber?: string | null + cardNumber?: string | null + name: string + iban?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput + inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput +} + +export type BankAccountUncheckedCreateWithoutBankAccountTransactionsInput = { + id?: number + accountNumber?: string | null + cardNumber?: string | null + name: string + iban?: string | null + branchId: number + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput +} + +export type BankAccountCreateOrConnectWithoutBankAccountTransactionsInput = { + where: Prisma.BankAccountWhereUniqueInput + create: Prisma.XOR +} + +export type BankAccountUpsertWithoutBankAccountTransactionsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.BankAccountWhereInput +} + +export type BankAccountUpdateToOneWithWhereWithoutBankAccountTransactionsInput = { + where?: Prisma.BankAccountWhereInput + data: Prisma.XOR +} + +export type BankAccountUpdateWithoutBankAccountTransactionsInput = { + accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + name?: Prisma.StringFieldUpdateOperationsInput | string + iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput + inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput +} + +export type BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + name?: Prisma.StringFieldUpdateOperationsInput | string + iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + branchId?: Prisma.IntFieldUpdateOperationsInput | number + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput +} + +export type BankAccountCreateWithoutBankAccountBalancesInput = { + accountNumber?: string | null + cardNumber?: string | null + name: string + iban?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput + inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput +} + +export type BankAccountUncheckedCreateWithoutBankAccountBalancesInput = { + id?: number + accountNumber?: string | null + cardNumber?: string | null + name: string + iban?: string | null + branchId: number + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput +} + +export type BankAccountCreateOrConnectWithoutBankAccountBalancesInput = { + where: Prisma.BankAccountWhereUniqueInput + create: Prisma.XOR +} + +export type BankAccountUpsertWithoutBankAccountBalancesInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.BankAccountWhereInput +} + +export type BankAccountUpdateToOneWithWhereWithoutBankAccountBalancesInput = { + where?: Prisma.BankAccountWhereInput + data: Prisma.XOR +} + +export type BankAccountUpdateWithoutBankAccountBalancesInput = { + accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + name?: Prisma.StringFieldUpdateOperationsInput | string + iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput + inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput +} + +export type BankAccountUncheckedUpdateWithoutBankAccountBalancesInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + name?: Prisma.StringFieldUpdateOperationsInput | string + iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + branchId?: Prisma.IntFieldUpdateOperationsInput | number + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput +} + export type BankAccountCreateWithoutInventoryBankAccountsInput = { accountNumber?: string | null cardNumber?: string | null @@ -624,6 +818,8 @@ export type BankAccountCreateWithoutInventoryBankAccountsInput = { deletedAt?: Date | string | null branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput } export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = { @@ -637,6 +833,8 @@ export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = { updatedAt?: Date | string deletedAt?: Date | string | null purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput } export type BankAccountCreateOrConnectWithoutInventoryBankAccountsInput = { @@ -665,6 +863,8 @@ export type BankAccountUpdateWithoutInventoryBankAccountsInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput } export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = { @@ -678,6 +878,8 @@ export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput } export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = { @@ -690,6 +892,8 @@ export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = { deletedAt?: Date | string | null branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput } export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = { @@ -703,6 +907,8 @@ export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = { updatedAt?: Date | string deletedAt?: Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput } export type BankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput = { @@ -731,6 +937,8 @@ export type BankAccountUpdateWithoutPurchaseReceiptPaymentsInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput } export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = { @@ -744,6 +952,8 @@ export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput } export type BankAccountCreateManyBranchInput = { @@ -767,6 +977,8 @@ export type BankAccountUpdateWithoutBranchInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput } export type BankAccountUncheckedUpdateWithoutBranchInput = { @@ -780,6 +992,8 @@ export type BankAccountUncheckedUpdateWithoutBranchInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput + bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput } export type BankAccountUncheckedUpdateManyWithoutBranchInput = { @@ -801,11 +1015,15 @@ export type BankAccountUncheckedUpdateManyWithoutBranchInput = { export type BankAccountCountOutputType = { inventoryBankAccounts: number purchaseReceiptPayments: number + bankAccountTransactions: number + bankAccountBalances: number } export type BankAccountCountOutputTypeSelect = { inventoryBankAccounts?: boolean | BankAccountCountOutputTypeCountInventoryBankAccountsArgs purchaseReceiptPayments?: boolean | BankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs + bankAccountTransactions?: boolean | BankAccountCountOutputTypeCountBankAccountTransactionsArgs + bankAccountBalances?: boolean | BankAccountCountOutputTypeCountBankAccountBalancesArgs } /** @@ -832,6 +1050,20 @@ export type BankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs = { + where?: Prisma.BankAccountTransactionWhereInput +} + +/** + * BankAccountCountOutputType without action + */ +export type BankAccountCountOutputTypeCountBankAccountBalancesArgs = { + where?: Prisma.BankAccountBalanceWhereInput +} + export type BankAccountSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -846,6 +1078,8 @@ export type BankAccountSelect inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs + bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs + bankAccountBalances?: boolean | Prisma.BankAccount$bankAccountBalancesArgs _count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs }, ExtArgs["result"]["bankAccount"]> @@ -868,6 +1102,8 @@ export type BankAccountInclude inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs + bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs + bankAccountBalances?: boolean | Prisma.BankAccount$bankAccountBalancesArgs _count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs } @@ -877,6 +1113,8 @@ export type $BankAccountPayload inventoryBankAccounts: Prisma.$InventoryBankAccountPayload[] purchaseReceiptPayments: Prisma.$PurchaseReceiptPaymentsPayload[] + bankAccountTransactions: Prisma.$BankAccountTransactionPayload[] + bankAccountBalances: Prisma.$BankAccountBalancePayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1231,6 +1469,8 @@ export interface Prisma__BankAccountClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__BankBranchClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> inventoryBankAccounts = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> purchaseReceiptPayments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + bankAccountTransactions = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + bankAccountBalances = {}>(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. @@ -1659,6 +1899,54 @@ export type BankAccount$purchaseReceiptPaymentsArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + where?: Prisma.BankAccountTransactionWhereInput + orderBy?: Prisma.BankAccountTransactionOrderByWithRelationInput | Prisma.BankAccountTransactionOrderByWithRelationInput[] + cursor?: Prisma.BankAccountTransactionWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[] +} + +/** + * BankAccount.bankAccountBalances + */ +export type BankAccount$bankAccountBalancesArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + where?: Prisma.BankAccountBalanceWhereInput + orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[] + cursor?: Prisma.BankAccountBalanceWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.BankAccountBalanceScalarFieldEnum | Prisma.BankAccountBalanceScalarFieldEnum[] +} + /** * BankAccount without action */ diff --git a/src/generated/prisma/models/BankAccountBalance.ts b/src/generated/prisma/models/BankAccountBalance.ts new file mode 100644 index 0000000..c17f4d8 --- /dev/null +++ b/src/generated/prisma/models/BankAccountBalance.ts @@ -0,0 +1,1195 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `BankAccountBalance` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model BankAccountBalance + * + */ +export type BankAccountBalanceModel = runtime.Types.Result.DefaultSelection + +export type AggregateBankAccountBalance = { + _count: BankAccountBalanceCountAggregateOutputType | null + _avg: BankAccountBalanceAvgAggregateOutputType | null + _sum: BankAccountBalanceSumAggregateOutputType | null + _min: BankAccountBalanceMinAggregateOutputType | null + _max: BankAccountBalanceMaxAggregateOutputType | null +} + +export type BankAccountBalanceAvgAggregateOutputType = { + bankAccountId: number | null + balance: runtime.Decimal | null +} + +export type BankAccountBalanceSumAggregateOutputType = { + bankAccountId: number | null + balance: runtime.Decimal | null +} + +export type BankAccountBalanceMinAggregateOutputType = { + bankAccountId: number | null + balance: runtime.Decimal | null + updatedAt: Date | null +} + +export type BankAccountBalanceMaxAggregateOutputType = { + bankAccountId: number | null + balance: runtime.Decimal | null + updatedAt: Date | null +} + +export type BankAccountBalanceCountAggregateOutputType = { + bankAccountId: number + balance: number + updatedAt: number + _all: number +} + + +export type BankAccountBalanceAvgAggregateInputType = { + bankAccountId?: true + balance?: true +} + +export type BankAccountBalanceSumAggregateInputType = { + bankAccountId?: true + balance?: true +} + +export type BankAccountBalanceMinAggregateInputType = { + bankAccountId?: true + balance?: true + updatedAt?: true +} + +export type BankAccountBalanceMaxAggregateInputType = { + bankAccountId?: true + balance?: true + updatedAt?: true +} + +export type BankAccountBalanceCountAggregateInputType = { + bankAccountId?: true + balance?: true + updatedAt?: true + _all?: true +} + +export type BankAccountBalanceAggregateArgs = { + /** + * Filter which BankAccountBalance to aggregate. + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountBalances to fetch. + */ + orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.BankAccountBalanceWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountBalances from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountBalances. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned BankAccountBalances + **/ + _count?: true | BankAccountBalanceCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: BankAccountBalanceAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: BankAccountBalanceSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: BankAccountBalanceMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: BankAccountBalanceMaxAggregateInputType +} + +export type GetBankAccountBalanceAggregateType = { + [P in keyof T & keyof AggregateBankAccountBalance]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type BankAccountBalanceGroupByArgs = { + where?: Prisma.BankAccountBalanceWhereInput + orderBy?: Prisma.BankAccountBalanceOrderByWithAggregationInput | Prisma.BankAccountBalanceOrderByWithAggregationInput[] + by: Prisma.BankAccountBalanceScalarFieldEnum[] | Prisma.BankAccountBalanceScalarFieldEnum + having?: Prisma.BankAccountBalanceScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: BankAccountBalanceCountAggregateInputType | true + _avg?: BankAccountBalanceAvgAggregateInputType + _sum?: BankAccountBalanceSumAggregateInputType + _min?: BankAccountBalanceMinAggregateInputType + _max?: BankAccountBalanceMaxAggregateInputType +} + +export type BankAccountBalanceGroupByOutputType = { + bankAccountId: number + balance: runtime.Decimal + updatedAt: Date + _count: BankAccountBalanceCountAggregateOutputType | null + _avg: BankAccountBalanceAvgAggregateOutputType | null + _sum: BankAccountBalanceSumAggregateOutputType | null + _min: BankAccountBalanceMinAggregateOutputType | null + _max: BankAccountBalanceMaxAggregateOutputType | null +} + +type GetBankAccountBalanceGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof BankAccountBalanceGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type BankAccountBalanceWhereInput = { + AND?: Prisma.BankAccountBalanceWhereInput | Prisma.BankAccountBalanceWhereInput[] + OR?: Prisma.BankAccountBalanceWhereInput[] + NOT?: Prisma.BankAccountBalanceWhereInput | Prisma.BankAccountBalanceWhereInput[] + bankAccountId?: Prisma.IntFilter<"BankAccountBalance"> | number + balance?: Prisma.DecimalFilter<"BankAccountBalance"> | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFilter<"BankAccountBalance"> | Date | string + bankAccount?: Prisma.XOR +} + +export type BankAccountBalanceOrderByWithRelationInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + bankAccount?: Prisma.BankAccountOrderByWithRelationInput +} + +export type BankAccountBalanceWhereUniqueInput = Prisma.AtLeast<{ + bankAccountId?: number + AND?: Prisma.BankAccountBalanceWhereInput | Prisma.BankAccountBalanceWhereInput[] + OR?: Prisma.BankAccountBalanceWhereInput[] + NOT?: Prisma.BankAccountBalanceWhereInput | Prisma.BankAccountBalanceWhereInput[] + balance?: Prisma.DecimalFilter<"BankAccountBalance"> | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFilter<"BankAccountBalance"> | Date | string + bankAccount?: Prisma.XOR +}, "bankAccountId"> + +export type BankAccountBalanceOrderByWithAggregationInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + _count?: Prisma.BankAccountBalanceCountOrderByAggregateInput + _avg?: Prisma.BankAccountBalanceAvgOrderByAggregateInput + _max?: Prisma.BankAccountBalanceMaxOrderByAggregateInput + _min?: Prisma.BankAccountBalanceMinOrderByAggregateInput + _sum?: Prisma.BankAccountBalanceSumOrderByAggregateInput +} + +export type BankAccountBalanceScalarWhereWithAggregatesInput = { + AND?: Prisma.BankAccountBalanceScalarWhereWithAggregatesInput | Prisma.BankAccountBalanceScalarWhereWithAggregatesInput[] + OR?: Prisma.BankAccountBalanceScalarWhereWithAggregatesInput[] + NOT?: Prisma.BankAccountBalanceScalarWhereWithAggregatesInput | Prisma.BankAccountBalanceScalarWhereWithAggregatesInput[] + bankAccountId?: Prisma.IntWithAggregatesFilter<"BankAccountBalance"> | number + balance?: Prisma.DecimalWithAggregatesFilter<"BankAccountBalance"> | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"BankAccountBalance"> | Date | string +} + +export type BankAccountBalanceCreateInput = { + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string + bankAccount: Prisma.BankAccountCreateNestedOneWithoutBankAccountBalancesInput +} + +export type BankAccountBalanceUncheckedCreateInput = { + bankAccountId: number + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string +} + +export type BankAccountBalanceUpdateInput = { + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutBankAccountBalancesNestedInput +} + +export type BankAccountBalanceUncheckedUpdateInput = { + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountBalanceCreateManyInput = { + bankAccountId: number + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string +} + +export type BankAccountBalanceUpdateManyMutationInput = { + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountBalanceUncheckedUpdateManyInput = { + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountBalanceListRelationFilter = { + every?: Prisma.BankAccountBalanceWhereInput + some?: Prisma.BankAccountBalanceWhereInput + none?: Prisma.BankAccountBalanceWhereInput +} + +export type BankAccountBalanceOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type BankAccountBalanceCountOrderByAggregateInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type BankAccountBalanceAvgOrderByAggregateInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder +} + +export type BankAccountBalanceMaxOrderByAggregateInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type BankAccountBalanceMinOrderByAggregateInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type BankAccountBalanceSumOrderByAggregateInput = { + bankAccountId?: Prisma.SortOrder + balance?: Prisma.SortOrder +} + +export type BankAccountBalanceCreateNestedManyWithoutBankAccountInput = { + create?: Prisma.XOR | Prisma.BankAccountBalanceCreateWithoutBankAccountInput[] | Prisma.BankAccountBalanceUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput[] + createMany?: Prisma.BankAccountBalanceCreateManyBankAccountInputEnvelope + connect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] +} + +export type BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput = { + create?: Prisma.XOR | Prisma.BankAccountBalanceCreateWithoutBankAccountInput[] | Prisma.BankAccountBalanceUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput[] + createMany?: Prisma.BankAccountBalanceCreateManyBankAccountInputEnvelope + connect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] +} + +export type BankAccountBalanceUpdateManyWithoutBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.BankAccountBalanceCreateWithoutBankAccountInput[] | Prisma.BankAccountBalanceUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput[] + upsert?: Prisma.BankAccountBalanceUpsertWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountBalanceUpsertWithWhereUniqueWithoutBankAccountInput[] + createMany?: Prisma.BankAccountBalanceCreateManyBankAccountInputEnvelope + set?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + disconnect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + delete?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + connect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + update?: Prisma.BankAccountBalanceUpdateWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountBalanceUpdateWithWhereUniqueWithoutBankAccountInput[] + updateMany?: Prisma.BankAccountBalanceUpdateManyWithWhereWithoutBankAccountInput | Prisma.BankAccountBalanceUpdateManyWithWhereWithoutBankAccountInput[] + deleteMany?: Prisma.BankAccountBalanceScalarWhereInput | Prisma.BankAccountBalanceScalarWhereInput[] +} + +export type BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.BankAccountBalanceCreateWithoutBankAccountInput[] | Prisma.BankAccountBalanceUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountBalanceCreateOrConnectWithoutBankAccountInput[] + upsert?: Prisma.BankAccountBalanceUpsertWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountBalanceUpsertWithWhereUniqueWithoutBankAccountInput[] + createMany?: Prisma.BankAccountBalanceCreateManyBankAccountInputEnvelope + set?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + disconnect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + delete?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + connect?: Prisma.BankAccountBalanceWhereUniqueInput | Prisma.BankAccountBalanceWhereUniqueInput[] + update?: Prisma.BankAccountBalanceUpdateWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountBalanceUpdateWithWhereUniqueWithoutBankAccountInput[] + updateMany?: Prisma.BankAccountBalanceUpdateManyWithWhereWithoutBankAccountInput | Prisma.BankAccountBalanceUpdateManyWithWhereWithoutBankAccountInput[] + deleteMany?: Prisma.BankAccountBalanceScalarWhereInput | Prisma.BankAccountBalanceScalarWhereInput[] +} + +export type BankAccountBalanceCreateWithoutBankAccountInput = { + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string +} + +export type BankAccountBalanceUncheckedCreateWithoutBankAccountInput = { + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string +} + +export type BankAccountBalanceCreateOrConnectWithoutBankAccountInput = { + where: Prisma.BankAccountBalanceWhereUniqueInput + create: Prisma.XOR +} + +export type BankAccountBalanceCreateManyBankAccountInputEnvelope = { + data: Prisma.BankAccountBalanceCreateManyBankAccountInput | Prisma.BankAccountBalanceCreateManyBankAccountInput[] + skipDuplicates?: boolean +} + +export type BankAccountBalanceUpsertWithWhereUniqueWithoutBankAccountInput = { + where: Prisma.BankAccountBalanceWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type BankAccountBalanceUpdateWithWhereUniqueWithoutBankAccountInput = { + where: Prisma.BankAccountBalanceWhereUniqueInput + data: Prisma.XOR +} + +export type BankAccountBalanceUpdateManyWithWhereWithoutBankAccountInput = { + where: Prisma.BankAccountBalanceScalarWhereInput + data: Prisma.XOR +} + +export type BankAccountBalanceScalarWhereInput = { + AND?: Prisma.BankAccountBalanceScalarWhereInput | Prisma.BankAccountBalanceScalarWhereInput[] + OR?: Prisma.BankAccountBalanceScalarWhereInput[] + NOT?: Prisma.BankAccountBalanceScalarWhereInput | Prisma.BankAccountBalanceScalarWhereInput[] + bankAccountId?: Prisma.IntFilter<"BankAccountBalance"> | number + balance?: Prisma.DecimalFilter<"BankAccountBalance"> | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFilter<"BankAccountBalance"> | Date | string +} + +export type BankAccountBalanceCreateManyBankAccountInput = { + balance: runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Date | string +} + +export type BankAccountBalanceUpdateWithoutBankAccountInput = { + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountBalanceUncheckedUpdateWithoutBankAccountInput = { + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountBalanceUncheckedUpdateManyWithoutBankAccountInput = { + balance?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + + +export type BankAccountBalanceSelect = runtime.Types.Extensions.GetSelect<{ + bankAccountId?: boolean + balance?: boolean + updatedAt?: boolean + bankAccount?: boolean | Prisma.BankAccountDefaultArgs +}, ExtArgs["result"]["bankAccountBalance"]> + + + +export type BankAccountBalanceSelectScalar = { + bankAccountId?: boolean + balance?: boolean + updatedAt?: boolean +} + +export type BankAccountBalanceOmit = runtime.Types.Extensions.GetOmit<"bankAccountId" | "balance" | "updatedAt", ExtArgs["result"]["bankAccountBalance"]> +export type BankAccountBalanceInclude = { + bankAccount?: boolean | Prisma.BankAccountDefaultArgs +} + +export type $BankAccountBalancePayload = { + name: "BankAccountBalance" + objects: { + bankAccount: Prisma.$BankAccountPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + bankAccountId: number + balance: runtime.Decimal + updatedAt: Date + }, ExtArgs["result"]["bankAccountBalance"]> + composites: {} +} + +export type BankAccountBalanceGetPayload = runtime.Types.Result.GetResult + +export type BankAccountBalanceCountArgs = + Omit & { + select?: BankAccountBalanceCountAggregateInputType | true + } + +export interface BankAccountBalanceDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['BankAccountBalance'], meta: { name: 'BankAccountBalance' } } + /** + * Find zero or one BankAccountBalance that matches the filter. + * @param {BankAccountBalanceFindUniqueArgs} args - Arguments to find a BankAccountBalance + * @example + * // Get one BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one BankAccountBalance that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {BankAccountBalanceFindUniqueOrThrowArgs} args - Arguments to find a BankAccountBalance + * @example + * // Get one BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first BankAccountBalance that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceFindFirstArgs} args - Arguments to find a BankAccountBalance + * @example + * // Get one BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first BankAccountBalance that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceFindFirstOrThrowArgs} args - Arguments to find a BankAccountBalance + * @example + * // Get one BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more BankAccountBalances that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all BankAccountBalances + * const bankAccountBalances = await prisma.bankAccountBalance.findMany() + * + * // Get first 10 BankAccountBalances + * const bankAccountBalances = await prisma.bankAccountBalance.findMany({ take: 10 }) + * + * // Only select the `bankAccountId` + * const bankAccountBalanceWithBankAccountIdOnly = await prisma.bankAccountBalance.findMany({ select: { bankAccountId: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a BankAccountBalance. + * @param {BankAccountBalanceCreateArgs} args - Arguments to create a BankAccountBalance. + * @example + * // Create one BankAccountBalance + * const BankAccountBalance = await prisma.bankAccountBalance.create({ + * data: { + * // ... data to create a BankAccountBalance + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many BankAccountBalances. + * @param {BankAccountBalanceCreateManyArgs} args - Arguments to create many BankAccountBalances. + * @example + * // Create many BankAccountBalances + * const bankAccountBalance = await prisma.bankAccountBalance.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a BankAccountBalance. + * @param {BankAccountBalanceDeleteArgs} args - Arguments to delete one BankAccountBalance. + * @example + * // Delete one BankAccountBalance + * const BankAccountBalance = await prisma.bankAccountBalance.delete({ + * where: { + * // ... filter to delete one BankAccountBalance + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one BankAccountBalance. + * @param {BankAccountBalanceUpdateArgs} args - Arguments to update one BankAccountBalance. + * @example + * // Update one BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more BankAccountBalances. + * @param {BankAccountBalanceDeleteManyArgs} args - Arguments to filter BankAccountBalances to delete. + * @example + * // Delete a few BankAccountBalances + * const { count } = await prisma.bankAccountBalance.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more BankAccountBalances. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many BankAccountBalances + * const bankAccountBalance = await prisma.bankAccountBalance.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one BankAccountBalance. + * @param {BankAccountBalanceUpsertArgs} args - Arguments to update or create a BankAccountBalance. + * @example + * // Update or create a BankAccountBalance + * const bankAccountBalance = await prisma.bankAccountBalance.upsert({ + * create: { + * // ... data to create a BankAccountBalance + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the BankAccountBalance we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountBalanceClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of BankAccountBalances. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceCountArgs} args - Arguments to filter BankAccountBalances to count. + * @example + * // Count the number of BankAccountBalances + * const count = await prisma.bankAccountBalance.count({ + * where: { + * // ... the filter for the BankAccountBalances we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a BankAccountBalance. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by BankAccountBalance. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountBalanceGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends BankAccountBalanceGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: BankAccountBalanceGroupByArgs['orderBy'] } + : { orderBy?: BankAccountBalanceGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetBankAccountBalanceGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the BankAccountBalance model + */ +readonly fields: BankAccountBalanceFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for BankAccountBalance. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__BankAccountBalanceClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + bankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__BankAccountClient, 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. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the BankAccountBalance model + */ +export interface BankAccountBalanceFieldRefs { + readonly bankAccountId: Prisma.FieldRef<"BankAccountBalance", 'Int'> + readonly balance: Prisma.FieldRef<"BankAccountBalance", 'Decimal'> + readonly updatedAt: Prisma.FieldRef<"BankAccountBalance", 'DateTime'> +} + + +// Custom InputTypes +/** + * BankAccountBalance findUnique + */ +export type BankAccountBalanceFindUniqueArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter, which BankAccountBalance to fetch. + */ + where: Prisma.BankAccountBalanceWhereUniqueInput +} + +/** + * BankAccountBalance findUniqueOrThrow + */ +export type BankAccountBalanceFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter, which BankAccountBalance to fetch. + */ + where: Prisma.BankAccountBalanceWhereUniqueInput +} + +/** + * BankAccountBalance findFirst + */ +export type BankAccountBalanceFindFirstArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter, which BankAccountBalance to fetch. + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountBalances to fetch. + */ + orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for BankAccountBalances. + */ + cursor?: Prisma.BankAccountBalanceWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountBalances from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountBalances. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of BankAccountBalances. + */ + distinct?: Prisma.BankAccountBalanceScalarFieldEnum | Prisma.BankAccountBalanceScalarFieldEnum[] +} + +/** + * BankAccountBalance findFirstOrThrow + */ +export type BankAccountBalanceFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter, which BankAccountBalance to fetch. + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountBalances to fetch. + */ + orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for BankAccountBalances. + */ + cursor?: Prisma.BankAccountBalanceWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountBalances from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountBalances. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of BankAccountBalances. + */ + distinct?: Prisma.BankAccountBalanceScalarFieldEnum | Prisma.BankAccountBalanceScalarFieldEnum[] +} + +/** + * BankAccountBalance findMany + */ +export type BankAccountBalanceFindManyArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter, which BankAccountBalances to fetch. + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountBalances to fetch. + */ + orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing BankAccountBalances. + */ + cursor?: Prisma.BankAccountBalanceWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountBalances from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountBalances. + */ + skip?: number + distinct?: Prisma.BankAccountBalanceScalarFieldEnum | Prisma.BankAccountBalanceScalarFieldEnum[] +} + +/** + * BankAccountBalance create + */ +export type BankAccountBalanceCreateArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * The data needed to create a BankAccountBalance. + */ + data: Prisma.XOR +} + +/** + * BankAccountBalance createMany + */ +export type BankAccountBalanceCreateManyArgs = { + /** + * The data used to create many BankAccountBalances. + */ + data: Prisma.BankAccountBalanceCreateManyInput | Prisma.BankAccountBalanceCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * BankAccountBalance update + */ +export type BankAccountBalanceUpdateArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * The data needed to update a BankAccountBalance. + */ + data: Prisma.XOR + /** + * Choose, which BankAccountBalance to update. + */ + where: Prisma.BankAccountBalanceWhereUniqueInput +} + +/** + * BankAccountBalance updateMany + */ +export type BankAccountBalanceUpdateManyArgs = { + /** + * The data used to update BankAccountBalances. + */ + data: Prisma.XOR + /** + * Filter which BankAccountBalances to update + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * Limit how many BankAccountBalances to update. + */ + limit?: number +} + +/** + * BankAccountBalance upsert + */ +export type BankAccountBalanceUpsertArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * The filter to search for the BankAccountBalance to update in case it exists. + */ + where: Prisma.BankAccountBalanceWhereUniqueInput + /** + * In case the BankAccountBalance found by the `where` argument doesn't exist, create a new BankAccountBalance with this data. + */ + create: Prisma.XOR + /** + * In case the BankAccountBalance was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * BankAccountBalance delete + */ +export type BankAccountBalanceDeleteArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null + /** + * Filter which BankAccountBalance to delete. + */ + where: Prisma.BankAccountBalanceWhereUniqueInput +} + +/** + * BankAccountBalance deleteMany + */ +export type BankAccountBalanceDeleteManyArgs = { + /** + * Filter which BankAccountBalances to delete + */ + where?: Prisma.BankAccountBalanceWhereInput + /** + * Limit how many BankAccountBalances to delete. + */ + limit?: number +} + +/** + * BankAccountBalance without action + */ +export type BankAccountBalanceDefaultArgs = { + /** + * Select specific fields to fetch from the BankAccountBalance + */ + select?: Prisma.BankAccountBalanceSelect | null + /** + * Omit specific fields from the BankAccountBalance + */ + omit?: Prisma.BankAccountBalanceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountBalanceInclude | null +} diff --git a/src/generated/prisma/models/BankAccountTransaction.ts b/src/generated/prisma/models/BankAccountTransaction.ts new file mode 100644 index 0000000..bdc3137 --- /dev/null +++ b/src/generated/prisma/models/BankAccountTransaction.ts @@ -0,0 +1,1429 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `BankAccountTransaction` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model BankAccountTransaction + * + */ +export type BankAccountTransactionModel = runtime.Types.Result.DefaultSelection + +export type AggregateBankAccountTransaction = { + _count: BankAccountTransactionCountAggregateOutputType | null + _avg: BankAccountTransactionAvgAggregateOutputType | null + _sum: BankAccountTransactionSumAggregateOutputType | null + _min: BankAccountTransactionMinAggregateOutputType | null + _max: BankAccountTransactionMaxAggregateOutputType | null +} + +export type BankAccountTransactionAvgAggregateOutputType = { + id: number | null + bankAccountId: number | null + amount: runtime.Decimal | null + balanceAfter: runtime.Decimal | null + referenceId: number | null +} + +export type BankAccountTransactionSumAggregateOutputType = { + id: number | null + bankAccountId: number | null + amount: runtime.Decimal | null + balanceAfter: runtime.Decimal | null + referenceId: number | null +} + +export type BankAccountTransactionMinAggregateOutputType = { + id: number | null + bankAccountId: number | null + type: $Enums.BankAccountTransactionType | null + amount: runtime.Decimal | null + balanceAfter: runtime.Decimal | null + referenceId: number | null + referenceType: $Enums.BankTransactionRefType | null + description: string | null + createdAt: Date | null +} + +export type BankAccountTransactionMaxAggregateOutputType = { + id: number | null + bankAccountId: number | null + type: $Enums.BankAccountTransactionType | null + amount: runtime.Decimal | null + balanceAfter: runtime.Decimal | null + referenceId: number | null + referenceType: $Enums.BankTransactionRefType | null + description: string | null + createdAt: Date | null +} + +export type BankAccountTransactionCountAggregateOutputType = { + id: number + bankAccountId: number + type: number + amount: number + balanceAfter: number + referenceId: number + referenceType: number + description: number + createdAt: number + _all: number +} + + +export type BankAccountTransactionAvgAggregateInputType = { + id?: true + bankAccountId?: true + amount?: true + balanceAfter?: true + referenceId?: true +} + +export type BankAccountTransactionSumAggregateInputType = { + id?: true + bankAccountId?: true + amount?: true + balanceAfter?: true + referenceId?: true +} + +export type BankAccountTransactionMinAggregateInputType = { + id?: true + bankAccountId?: true + type?: true + amount?: true + balanceAfter?: true + referenceId?: true + referenceType?: true + description?: true + createdAt?: true +} + +export type BankAccountTransactionMaxAggregateInputType = { + id?: true + bankAccountId?: true + type?: true + amount?: true + balanceAfter?: true + referenceId?: true + referenceType?: true + description?: true + createdAt?: true +} + +export type BankAccountTransactionCountAggregateInputType = { + id?: true + bankAccountId?: true + type?: true + amount?: true + balanceAfter?: true + referenceId?: true + referenceType?: true + description?: true + createdAt?: true + _all?: true +} + +export type BankAccountTransactionAggregateArgs = { + /** + * Filter which BankAccountTransaction to aggregate. + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountTransactions to fetch. + */ + orderBy?: Prisma.BankAccountTransactionOrderByWithRelationInput | Prisma.BankAccountTransactionOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.BankAccountTransactionWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountTransactions from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountTransactions. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned BankAccountTransactions + **/ + _count?: true | BankAccountTransactionCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: BankAccountTransactionAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: BankAccountTransactionSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: BankAccountTransactionMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: BankAccountTransactionMaxAggregateInputType +} + +export type GetBankAccountTransactionAggregateType = { + [P in keyof T & keyof AggregateBankAccountTransaction]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type BankAccountTransactionGroupByArgs = { + where?: Prisma.BankAccountTransactionWhereInput + orderBy?: Prisma.BankAccountTransactionOrderByWithAggregationInput | Prisma.BankAccountTransactionOrderByWithAggregationInput[] + by: Prisma.BankAccountTransactionScalarFieldEnum[] | Prisma.BankAccountTransactionScalarFieldEnum + having?: Prisma.BankAccountTransactionScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: BankAccountTransactionCountAggregateInputType | true + _avg?: BankAccountTransactionAvgAggregateInputType + _sum?: BankAccountTransactionSumAggregateInputType + _min?: BankAccountTransactionMinAggregateInputType + _max?: BankAccountTransactionMaxAggregateInputType +} + +export type BankAccountTransactionGroupByOutputType = { + id: number + bankAccountId: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal + balanceAfter: runtime.Decimal + referenceId: number + referenceType: $Enums.BankTransactionRefType + description: string | null + createdAt: Date + _count: BankAccountTransactionCountAggregateOutputType | null + _avg: BankAccountTransactionAvgAggregateOutputType | null + _sum: BankAccountTransactionSumAggregateOutputType | null + _min: BankAccountTransactionMinAggregateOutputType | null + _max: BankAccountTransactionMaxAggregateOutputType | null +} + +type GetBankAccountTransactionGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof BankAccountTransactionGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type BankAccountTransactionWhereInput = { + AND?: Prisma.BankAccountTransactionWhereInput | Prisma.BankAccountTransactionWhereInput[] + OR?: Prisma.BankAccountTransactionWhereInput[] + NOT?: Prisma.BankAccountTransactionWhereInput | Prisma.BankAccountTransactionWhereInput[] + id?: Prisma.IntFilter<"BankAccountTransaction"> | number + bankAccountId?: Prisma.IntFilter<"BankAccountTransaction"> | number + type?: Prisma.EnumBankAccountTransactionTypeFilter<"BankAccountTransaction"> | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFilter<"BankAccountTransaction"> | number + referenceType?: Prisma.EnumBankTransactionRefTypeFilter<"BankAccountTransaction"> | $Enums.BankTransactionRefType + description?: Prisma.StringNullableFilter<"BankAccountTransaction"> | string | null + createdAt?: Prisma.DateTimeFilter<"BankAccountTransaction"> | Date | string + bankAccount?: Prisma.XOR +} + +export type BankAccountTransactionOrderByWithRelationInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + type?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder + referenceType?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + bankAccount?: Prisma.BankAccountOrderByWithRelationInput + _relevance?: Prisma.BankAccountTransactionOrderByRelevanceInput +} + +export type BankAccountTransactionWhereUniqueInput = Prisma.AtLeast<{ + id?: number + AND?: Prisma.BankAccountTransactionWhereInput | Prisma.BankAccountTransactionWhereInput[] + OR?: Prisma.BankAccountTransactionWhereInput[] + NOT?: Prisma.BankAccountTransactionWhereInput | Prisma.BankAccountTransactionWhereInput[] + bankAccountId?: Prisma.IntFilter<"BankAccountTransaction"> | number + type?: Prisma.EnumBankAccountTransactionTypeFilter<"BankAccountTransaction"> | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFilter<"BankAccountTransaction"> | number + referenceType?: Prisma.EnumBankTransactionRefTypeFilter<"BankAccountTransaction"> | $Enums.BankTransactionRefType + description?: Prisma.StringNullableFilter<"BankAccountTransaction"> | string | null + createdAt?: Prisma.DateTimeFilter<"BankAccountTransaction"> | Date | string + bankAccount?: Prisma.XOR +}, "id"> + +export type BankAccountTransactionOrderByWithAggregationInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + type?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder + referenceType?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + _count?: Prisma.BankAccountTransactionCountOrderByAggregateInput + _avg?: Prisma.BankAccountTransactionAvgOrderByAggregateInput + _max?: Prisma.BankAccountTransactionMaxOrderByAggregateInput + _min?: Prisma.BankAccountTransactionMinOrderByAggregateInput + _sum?: Prisma.BankAccountTransactionSumOrderByAggregateInput +} + +export type BankAccountTransactionScalarWhereWithAggregatesInput = { + AND?: Prisma.BankAccountTransactionScalarWhereWithAggregatesInput | Prisma.BankAccountTransactionScalarWhereWithAggregatesInput[] + OR?: Prisma.BankAccountTransactionScalarWhereWithAggregatesInput[] + NOT?: Prisma.BankAccountTransactionScalarWhereWithAggregatesInput | Prisma.BankAccountTransactionScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"BankAccountTransaction"> | number + bankAccountId?: Prisma.IntWithAggregatesFilter<"BankAccountTransaction"> | number + type?: Prisma.EnumBankAccountTransactionTypeWithAggregatesFilter<"BankAccountTransaction"> | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalWithAggregatesFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalWithAggregatesFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntWithAggregatesFilter<"BankAccountTransaction"> | number + referenceType?: Prisma.EnumBankTransactionRefTypeWithAggregatesFilter<"BankAccountTransaction"> | $Enums.BankTransactionRefType + description?: Prisma.StringNullableWithAggregatesFilter<"BankAccountTransaction"> | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"BankAccountTransaction"> | Date | string +} + +export type BankAccountTransactionCreateInput = { + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string + bankAccount: Prisma.BankAccountCreateNestedOneWithoutBankAccountTransactionsInput +} + +export type BankAccountTransactionUncheckedCreateInput = { + id?: number + bankAccountId: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string +} + +export type BankAccountTransactionUpdateInput = { + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutBankAccountTransactionsNestedInput +} + +export type BankAccountTransactionUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountTransactionCreateManyInput = { + id?: number + bankAccountId: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string +} + +export type BankAccountTransactionUpdateManyMutationInput = { + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountTransactionUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountTransactionListRelationFilter = { + every?: Prisma.BankAccountTransactionWhereInput + some?: Prisma.BankAccountTransactionWhereInput + none?: Prisma.BankAccountTransactionWhereInput +} + +export type BankAccountTransactionOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type BankAccountTransactionOrderByRelevanceInput = { + fields: Prisma.BankAccountTransactionOrderByRelevanceFieldEnum | Prisma.BankAccountTransactionOrderByRelevanceFieldEnum[] + sort: Prisma.SortOrder + search: string +} + +export type BankAccountTransactionCountOrderByAggregateInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + type?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder + referenceType?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type BankAccountTransactionAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder +} + +export type BankAccountTransactionMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + type?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder + referenceType?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type BankAccountTransactionMinOrderByAggregateInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + type?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder + referenceType?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type BankAccountTransactionSumOrderByAggregateInput = { + id?: Prisma.SortOrder + bankAccountId?: Prisma.SortOrder + amount?: Prisma.SortOrder + balanceAfter?: Prisma.SortOrder + referenceId?: Prisma.SortOrder +} + +export type BankAccountTransactionCreateNestedManyWithoutBankAccountInput = { + create?: Prisma.XOR | Prisma.BankAccountTransactionCreateWithoutBankAccountInput[] | Prisma.BankAccountTransactionUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput[] + createMany?: Prisma.BankAccountTransactionCreateManyBankAccountInputEnvelope + connect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] +} + +export type BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput = { + create?: Prisma.XOR | Prisma.BankAccountTransactionCreateWithoutBankAccountInput[] | Prisma.BankAccountTransactionUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput[] + createMany?: Prisma.BankAccountTransactionCreateManyBankAccountInputEnvelope + connect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] +} + +export type BankAccountTransactionUpdateManyWithoutBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.BankAccountTransactionCreateWithoutBankAccountInput[] | Prisma.BankAccountTransactionUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput[] + upsert?: Prisma.BankAccountTransactionUpsertWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountTransactionUpsertWithWhereUniqueWithoutBankAccountInput[] + createMany?: Prisma.BankAccountTransactionCreateManyBankAccountInputEnvelope + set?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + disconnect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + delete?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + connect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + update?: Prisma.BankAccountTransactionUpdateWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountTransactionUpdateWithWhereUniqueWithoutBankAccountInput[] + updateMany?: Prisma.BankAccountTransactionUpdateManyWithWhereWithoutBankAccountInput | Prisma.BankAccountTransactionUpdateManyWithWhereWithoutBankAccountInput[] + deleteMany?: Prisma.BankAccountTransactionScalarWhereInput | Prisma.BankAccountTransactionScalarWhereInput[] +} + +export type BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.BankAccountTransactionCreateWithoutBankAccountInput[] | Prisma.BankAccountTransactionUncheckedCreateWithoutBankAccountInput[] + connectOrCreate?: Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput | Prisma.BankAccountTransactionCreateOrConnectWithoutBankAccountInput[] + upsert?: Prisma.BankAccountTransactionUpsertWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountTransactionUpsertWithWhereUniqueWithoutBankAccountInput[] + createMany?: Prisma.BankAccountTransactionCreateManyBankAccountInputEnvelope + set?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + disconnect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + delete?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + connect?: Prisma.BankAccountTransactionWhereUniqueInput | Prisma.BankAccountTransactionWhereUniqueInput[] + update?: Prisma.BankAccountTransactionUpdateWithWhereUniqueWithoutBankAccountInput | Prisma.BankAccountTransactionUpdateWithWhereUniqueWithoutBankAccountInput[] + updateMany?: Prisma.BankAccountTransactionUpdateManyWithWhereWithoutBankAccountInput | Prisma.BankAccountTransactionUpdateManyWithWhereWithoutBankAccountInput[] + deleteMany?: Prisma.BankAccountTransactionScalarWhereInput | Prisma.BankAccountTransactionScalarWhereInput[] +} + +export type EnumBankAccountTransactionTypeFieldUpdateOperationsInput = { + set?: $Enums.BankAccountTransactionType +} + +export type DecimalFieldUpdateOperationsInput = { + set?: runtime.Decimal | runtime.DecimalJsLike | number | string + increment?: runtime.Decimal | runtime.DecimalJsLike | number | string + decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string + multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string + divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type EnumBankTransactionRefTypeFieldUpdateOperationsInput = { + set?: $Enums.BankTransactionRefType +} + +export type BankAccountTransactionCreateWithoutBankAccountInput = { + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string +} + +export type BankAccountTransactionUncheckedCreateWithoutBankAccountInput = { + id?: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string +} + +export type BankAccountTransactionCreateOrConnectWithoutBankAccountInput = { + where: Prisma.BankAccountTransactionWhereUniqueInput + create: Prisma.XOR +} + +export type BankAccountTransactionCreateManyBankAccountInputEnvelope = { + data: Prisma.BankAccountTransactionCreateManyBankAccountInput | Prisma.BankAccountTransactionCreateManyBankAccountInput[] + skipDuplicates?: boolean +} + +export type BankAccountTransactionUpsertWithWhereUniqueWithoutBankAccountInput = { + where: Prisma.BankAccountTransactionWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type BankAccountTransactionUpdateWithWhereUniqueWithoutBankAccountInput = { + where: Prisma.BankAccountTransactionWhereUniqueInput + data: Prisma.XOR +} + +export type BankAccountTransactionUpdateManyWithWhereWithoutBankAccountInput = { + where: Prisma.BankAccountTransactionScalarWhereInput + data: Prisma.XOR +} + +export type BankAccountTransactionScalarWhereInput = { + AND?: Prisma.BankAccountTransactionScalarWhereInput | Prisma.BankAccountTransactionScalarWhereInput[] + OR?: Prisma.BankAccountTransactionScalarWhereInput[] + NOT?: Prisma.BankAccountTransactionScalarWhereInput | Prisma.BankAccountTransactionScalarWhereInput[] + id?: Prisma.IntFilter<"BankAccountTransaction"> | number + bankAccountId?: Prisma.IntFilter<"BankAccountTransaction"> | number + type?: Prisma.EnumBankAccountTransactionTypeFilter<"BankAccountTransaction"> | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFilter<"BankAccountTransaction"> | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFilter<"BankAccountTransaction"> | number + referenceType?: Prisma.EnumBankTransactionRefTypeFilter<"BankAccountTransaction"> | $Enums.BankTransactionRefType + description?: Prisma.StringNullableFilter<"BankAccountTransaction"> | string | null + createdAt?: Prisma.DateTimeFilter<"BankAccountTransaction"> | Date | string +} + +export type BankAccountTransactionCreateManyBankAccountInput = { + id?: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter: runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId: number + referenceType: $Enums.BankTransactionRefType + description?: string | null + createdAt?: Date | string +} + +export type BankAccountTransactionUpdateWithoutBankAccountInput = { + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountTransactionUncheckedUpdateWithoutBankAccountInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type BankAccountTransactionUncheckedUpdateManyWithoutBankAccountInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + type?: Prisma.EnumBankAccountTransactionTypeFieldUpdateOperationsInput | $Enums.BankAccountTransactionType + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + balanceAfter?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + referenceId?: Prisma.IntFieldUpdateOperationsInput | number + referenceType?: Prisma.EnumBankTransactionRefTypeFieldUpdateOperationsInput | $Enums.BankTransactionRefType + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + + +export type BankAccountTransactionSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + bankAccountId?: boolean + type?: boolean + amount?: boolean + balanceAfter?: boolean + referenceId?: boolean + referenceType?: boolean + description?: boolean + createdAt?: boolean + bankAccount?: boolean | Prisma.BankAccountDefaultArgs +}, ExtArgs["result"]["bankAccountTransaction"]> + + + +export type BankAccountTransactionSelectScalar = { + id?: boolean + bankAccountId?: boolean + type?: boolean + amount?: boolean + balanceAfter?: boolean + referenceId?: boolean + referenceType?: boolean + description?: boolean + createdAt?: boolean +} + +export type BankAccountTransactionOmit = runtime.Types.Extensions.GetOmit<"id" | "bankAccountId" | "type" | "amount" | "balanceAfter" | "referenceId" | "referenceType" | "description" | "createdAt", ExtArgs["result"]["bankAccountTransaction"]> +export type BankAccountTransactionInclude = { + bankAccount?: boolean | Prisma.BankAccountDefaultArgs +} + +export type $BankAccountTransactionPayload = { + name: "BankAccountTransaction" + objects: { + bankAccount: Prisma.$BankAccountPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + bankAccountId: number + type: $Enums.BankAccountTransactionType + amount: runtime.Decimal + balanceAfter: runtime.Decimal + referenceId: number + referenceType: $Enums.BankTransactionRefType + description: string | null + createdAt: Date + }, ExtArgs["result"]["bankAccountTransaction"]> + composites: {} +} + +export type BankAccountTransactionGetPayload = runtime.Types.Result.GetResult + +export type BankAccountTransactionCountArgs = + Omit & { + select?: BankAccountTransactionCountAggregateInputType | true + } + +export interface BankAccountTransactionDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['BankAccountTransaction'], meta: { name: 'BankAccountTransaction' } } + /** + * Find zero or one BankAccountTransaction that matches the filter. + * @param {BankAccountTransactionFindUniqueArgs} args - Arguments to find a BankAccountTransaction + * @example + * // Get one BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one BankAccountTransaction that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {BankAccountTransactionFindUniqueOrThrowArgs} args - Arguments to find a BankAccountTransaction + * @example + * // Get one BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first BankAccountTransaction that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionFindFirstArgs} args - Arguments to find a BankAccountTransaction + * @example + * // Get one BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first BankAccountTransaction that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionFindFirstOrThrowArgs} args - Arguments to find a BankAccountTransaction + * @example + * // Get one BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more BankAccountTransactions that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all BankAccountTransactions + * const bankAccountTransactions = await prisma.bankAccountTransaction.findMany() + * + * // Get first 10 BankAccountTransactions + * const bankAccountTransactions = await prisma.bankAccountTransaction.findMany({ take: 10 }) + * + * // Only select the `id` + * const bankAccountTransactionWithIdOnly = await prisma.bankAccountTransaction.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a BankAccountTransaction. + * @param {BankAccountTransactionCreateArgs} args - Arguments to create a BankAccountTransaction. + * @example + * // Create one BankAccountTransaction + * const BankAccountTransaction = await prisma.bankAccountTransaction.create({ + * data: { + * // ... data to create a BankAccountTransaction + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many BankAccountTransactions. + * @param {BankAccountTransactionCreateManyArgs} args - Arguments to create many BankAccountTransactions. + * @example + * // Create many BankAccountTransactions + * const bankAccountTransaction = await prisma.bankAccountTransaction.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a BankAccountTransaction. + * @param {BankAccountTransactionDeleteArgs} args - Arguments to delete one BankAccountTransaction. + * @example + * // Delete one BankAccountTransaction + * const BankAccountTransaction = await prisma.bankAccountTransaction.delete({ + * where: { + * // ... filter to delete one BankAccountTransaction + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one BankAccountTransaction. + * @param {BankAccountTransactionUpdateArgs} args - Arguments to update one BankAccountTransaction. + * @example + * // Update one BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more BankAccountTransactions. + * @param {BankAccountTransactionDeleteManyArgs} args - Arguments to filter BankAccountTransactions to delete. + * @example + * // Delete a few BankAccountTransactions + * const { count } = await prisma.bankAccountTransaction.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more BankAccountTransactions. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many BankAccountTransactions + * const bankAccountTransaction = await prisma.bankAccountTransaction.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one BankAccountTransaction. + * @param {BankAccountTransactionUpsertArgs} args - Arguments to update or create a BankAccountTransaction. + * @example + * // Update or create a BankAccountTransaction + * const bankAccountTransaction = await prisma.bankAccountTransaction.upsert({ + * create: { + * // ... data to create a BankAccountTransaction + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the BankAccountTransaction we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__BankAccountTransactionClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of BankAccountTransactions. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionCountArgs} args - Arguments to filter BankAccountTransactions to count. + * @example + * // Count the number of BankAccountTransactions + * const count = await prisma.bankAccountTransaction.count({ + * where: { + * // ... the filter for the BankAccountTransactions we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a BankAccountTransaction. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by BankAccountTransaction. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {BankAccountTransactionGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends BankAccountTransactionGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: BankAccountTransactionGroupByArgs['orderBy'] } + : { orderBy?: BankAccountTransactionGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetBankAccountTransactionGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the BankAccountTransaction model + */ +readonly fields: BankAccountTransactionFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for BankAccountTransaction. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__BankAccountTransactionClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + bankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__BankAccountClient, 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. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the BankAccountTransaction model + */ +export interface BankAccountTransactionFieldRefs { + readonly id: Prisma.FieldRef<"BankAccountTransaction", 'Int'> + readonly bankAccountId: Prisma.FieldRef<"BankAccountTransaction", 'Int'> + readonly type: Prisma.FieldRef<"BankAccountTransaction", 'BankAccountTransactionType'> + readonly amount: Prisma.FieldRef<"BankAccountTransaction", 'Decimal'> + readonly balanceAfter: Prisma.FieldRef<"BankAccountTransaction", 'Decimal'> + readonly referenceId: Prisma.FieldRef<"BankAccountTransaction", 'Int'> + readonly referenceType: Prisma.FieldRef<"BankAccountTransaction", 'BankTransactionRefType'> + readonly description: Prisma.FieldRef<"BankAccountTransaction", 'String'> + readonly createdAt: Prisma.FieldRef<"BankAccountTransaction", 'DateTime'> +} + + +// Custom InputTypes +/** + * BankAccountTransaction findUnique + */ +export type BankAccountTransactionFindUniqueArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter, which BankAccountTransaction to fetch. + */ + where: Prisma.BankAccountTransactionWhereUniqueInput +} + +/** + * BankAccountTransaction findUniqueOrThrow + */ +export type BankAccountTransactionFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter, which BankAccountTransaction to fetch. + */ + where: Prisma.BankAccountTransactionWhereUniqueInput +} + +/** + * BankAccountTransaction findFirst + */ +export type BankAccountTransactionFindFirstArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter, which BankAccountTransaction to fetch. + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountTransactions to fetch. + */ + orderBy?: Prisma.BankAccountTransactionOrderByWithRelationInput | Prisma.BankAccountTransactionOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for BankAccountTransactions. + */ + cursor?: Prisma.BankAccountTransactionWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountTransactions from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountTransactions. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of BankAccountTransactions. + */ + distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[] +} + +/** + * BankAccountTransaction findFirstOrThrow + */ +export type BankAccountTransactionFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter, which BankAccountTransaction to fetch. + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountTransactions to fetch. + */ + orderBy?: Prisma.BankAccountTransactionOrderByWithRelationInput | Prisma.BankAccountTransactionOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for BankAccountTransactions. + */ + cursor?: Prisma.BankAccountTransactionWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountTransactions from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountTransactions. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of BankAccountTransactions. + */ + distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[] +} + +/** + * BankAccountTransaction findMany + */ +export type BankAccountTransactionFindManyArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter, which BankAccountTransactions to fetch. + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of BankAccountTransactions to fetch. + */ + orderBy?: Prisma.BankAccountTransactionOrderByWithRelationInput | Prisma.BankAccountTransactionOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing BankAccountTransactions. + */ + cursor?: Prisma.BankAccountTransactionWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` BankAccountTransactions from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` BankAccountTransactions. + */ + skip?: number + distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[] +} + +/** + * BankAccountTransaction create + */ +export type BankAccountTransactionCreateArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * The data needed to create a BankAccountTransaction. + */ + data: Prisma.XOR +} + +/** + * BankAccountTransaction createMany + */ +export type BankAccountTransactionCreateManyArgs = { + /** + * The data used to create many BankAccountTransactions. + */ + data: Prisma.BankAccountTransactionCreateManyInput | Prisma.BankAccountTransactionCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * BankAccountTransaction update + */ +export type BankAccountTransactionUpdateArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * The data needed to update a BankAccountTransaction. + */ + data: Prisma.XOR + /** + * Choose, which BankAccountTransaction to update. + */ + where: Prisma.BankAccountTransactionWhereUniqueInput +} + +/** + * BankAccountTransaction updateMany + */ +export type BankAccountTransactionUpdateManyArgs = { + /** + * The data used to update BankAccountTransactions. + */ + data: Prisma.XOR + /** + * Filter which BankAccountTransactions to update + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * Limit how many BankAccountTransactions to update. + */ + limit?: number +} + +/** + * BankAccountTransaction upsert + */ +export type BankAccountTransactionUpsertArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * The filter to search for the BankAccountTransaction to update in case it exists. + */ + where: Prisma.BankAccountTransactionWhereUniqueInput + /** + * In case the BankAccountTransaction found by the `where` argument doesn't exist, create a new BankAccountTransaction with this data. + */ + create: Prisma.XOR + /** + * In case the BankAccountTransaction was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * BankAccountTransaction delete + */ +export type BankAccountTransactionDeleteArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null + /** + * Filter which BankAccountTransaction to delete. + */ + where: Prisma.BankAccountTransactionWhereUniqueInput +} + +/** + * BankAccountTransaction deleteMany + */ +export type BankAccountTransactionDeleteManyArgs = { + /** + * Filter which BankAccountTransactions to delete + */ + where?: Prisma.BankAccountTransactionWhereInput + /** + * Limit how many BankAccountTransactions to delete. + */ + limit?: number +} + +/** + * BankAccountTransaction without action + */ +export type BankAccountTransactionDefaultArgs = { + /** + * Select specific fields to fetch from the BankAccountTransaction + */ + select?: Prisma.BankAccountTransactionSelect | null + /** + * Omit specific fields from the BankAccountTransaction + */ + omit?: Prisma.BankAccountTransactionOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.BankAccountTransactionInclude | null +} diff --git a/src/generated/prisma/models/Customer.ts b/src/generated/prisma/models/Customer.ts index b9cc610..e398623 100644 --- a/src/generated/prisma/models/Customer.ts +++ b/src/generated/prisma/models/Customer.ts @@ -488,6 +488,11 @@ export type CustomerUncheckedUpdateManyInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null } +export type CustomerNullableScalarRelationFilter = { + is?: Prisma.CustomerWhereInput | null + isNot?: Prisma.CustomerWhereInput | null +} + export type CustomerOrderByRelevanceInput = { fields: Prisma.CustomerOrderByRelevanceFieldEnum | Prisma.CustomerOrderByRelevanceFieldEnum[] sort: Prisma.SortOrder @@ -550,26 +555,18 @@ export type CustomerSumOrderByAggregateInput = { id?: Prisma.SortOrder } -export type CustomerScalarRelationFilter = { - is?: Prisma.CustomerWhereInput - isNot?: Prisma.CustomerWhereInput -} - -export type CustomerNullableScalarRelationFilter = { - is?: Prisma.CustomerWhereInput | null - isNot?: Prisma.CustomerWhereInput | null -} - export type CustomerCreateNestedOneWithoutOrdersInput = { create?: Prisma.XOR connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutOrdersInput connect?: Prisma.CustomerWhereUniqueInput } -export type CustomerUpdateOneRequiredWithoutOrdersNestedInput = { +export type CustomerUpdateOneWithoutOrdersNestedInput = { create?: Prisma.XOR connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutOrdersInput upsert?: Prisma.CustomerUpsertWithoutOrdersInput + disconnect?: Prisma.CustomerWhereInput | boolean + delete?: Prisma.CustomerWhereInput | boolean connect?: Prisma.CustomerWhereUniqueInput update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutOrdersInput> } diff --git a/src/generated/prisma/models/Inventory.ts b/src/generated/prisma/models/Inventory.ts index ffdf298..6693981 100644 --- a/src/generated/prisma/models/Inventory.ts +++ b/src/generated/prisma/models/Inventory.ts @@ -248,6 +248,7 @@ export type InventoryWhereInput = { counterStockMovements?: Prisma.StockMovementListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter + stockReservations?: Prisma.StockReservationListRelationFilter } export type InventoryOrderByWithRelationInput = { @@ -267,6 +268,7 @@ export type InventoryOrderByWithRelationInput = { counterStockMovements?: Prisma.StockMovementOrderByRelationAggregateInput stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput inventoryBankAccounts?: Prisma.InventoryBankAccountOrderByRelationAggregateInput + stockReservations?: Prisma.StockReservationOrderByRelationAggregateInput _relevance?: Prisma.InventoryOrderByRelevanceInput } @@ -290,6 +292,7 @@ export type InventoryWhereUniqueInput = Prisma.AtLeast<{ counterStockMovements?: Prisma.StockMovementListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter + stockReservations?: Prisma.StockReservationListRelationFilter }, "id"> export type InventoryOrderByWithAggregationInput = { @@ -338,6 +341,7 @@ export type InventoryCreateInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateInput = { @@ -357,6 +361,7 @@ export type InventoryUncheckedCreateInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryUpdateInput = { @@ -375,6 +380,7 @@ export type InventoryUpdateInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateInput = { @@ -394,6 +400,7 @@ export type InventoryUncheckedUpdateInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateManyInput = { @@ -599,6 +606,20 @@ export type InventoryUpdateOneRequiredWithoutStockAdjustmentsNestedInput = { update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutStockAdjustmentsInput> } +export type InventoryCreateNestedOneWithoutStockReservationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutStockReservationsInput + connect?: Prisma.InventoryWhereUniqueInput +} + +export type InventoryUpdateOneRequiredWithoutStockReservationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutStockReservationsInput + upsert?: Prisma.InventoryUpsertWithoutStockReservationsInput + connect?: Prisma.InventoryWhereUniqueInput + update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutStockReservationsInput> +} + export type InventoryCreateWithoutInventoryBankAccountsInput = { name: string location?: string | null @@ -614,6 +635,7 @@ export type InventoryCreateWithoutInventoryBankAccountsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutInventoryBankAccountsInput = { @@ -632,6 +654,7 @@ export type InventoryUncheckedCreateWithoutInventoryBankAccountsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutInventoryBankAccountsInput = { @@ -665,6 +688,7 @@ export type InventoryUpdateWithoutInventoryBankAccountsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutInventoryBankAccountsInput = { @@ -683,6 +707,7 @@ export type InventoryUncheckedUpdateWithoutInventoryBankAccountsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateWithoutInventoryTransfersFromInput = { @@ -700,6 +725,7 @@ export type InventoryCreateWithoutInventoryTransfersFromInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutInventoryTransfersFromInput = { @@ -718,6 +744,7 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersFromInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutInventoryTransfersFromInput = { @@ -740,6 +767,7 @@ export type InventoryCreateWithoutInventoryTransfersToInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutInventoryTransfersToInput = { @@ -758,6 +786,7 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersToInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutInventoryTransfersToInput = { @@ -791,6 +820,7 @@ export type InventoryUpdateWithoutInventoryTransfersFromInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutInventoryTransfersFromInput = { @@ -809,6 +839,7 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersFromInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryUpsertWithoutInventoryTransfersToInput = { @@ -837,6 +868,7 @@ export type InventoryUpdateWithoutInventoryTransfersToInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutInventoryTransfersToInput = { @@ -855,6 +887,7 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersToInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateWithoutPurchaseReceiptsInput = { @@ -872,6 +905,7 @@ export type InventoryCreateWithoutPurchaseReceiptsInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutPurchaseReceiptsInput = { @@ -890,6 +924,7 @@ export type InventoryUncheckedCreateWithoutPurchaseReceiptsInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutPurchaseReceiptsInput = { @@ -923,6 +958,7 @@ export type InventoryUpdateWithoutPurchaseReceiptsInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutPurchaseReceiptsInput = { @@ -941,6 +977,7 @@ export type InventoryUncheckedUpdateWithoutPurchaseReceiptsInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateWithoutCounterStockMovementsInput = { @@ -958,6 +995,7 @@ export type InventoryCreateWithoutCounterStockMovementsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutCounterStockMovementsInput = { @@ -976,6 +1014,7 @@ export type InventoryUncheckedCreateWithoutCounterStockMovementsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutCounterStockMovementsInput = { @@ -998,6 +1037,7 @@ export type InventoryCreateWithoutStockMovementsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutStockMovementsInput = { @@ -1016,6 +1056,7 @@ export type InventoryUncheckedCreateWithoutStockMovementsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutStockMovementsInput = { @@ -1049,6 +1090,7 @@ export type InventoryUpdateWithoutCounterStockMovementsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutCounterStockMovementsInput = { @@ -1067,6 +1109,7 @@ export type InventoryUncheckedUpdateWithoutCounterStockMovementsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryUpsertWithoutStockMovementsInput = { @@ -1095,6 +1138,7 @@ export type InventoryUpdateWithoutStockMovementsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutStockMovementsInput = { @@ -1113,6 +1157,7 @@ export type InventoryUncheckedUpdateWithoutStockMovementsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateWithoutStockBalancesInput = { @@ -1130,6 +1175,7 @@ export type InventoryCreateWithoutStockBalancesInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutStockBalancesInput = { @@ -1148,6 +1194,7 @@ export type InventoryUncheckedCreateWithoutStockBalancesInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutStockBalancesInput = { @@ -1181,6 +1228,7 @@ export type InventoryUpdateWithoutStockBalancesInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutStockBalancesInput = { @@ -1199,6 +1247,7 @@ export type InventoryUncheckedUpdateWithoutStockBalancesInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput } export type InventoryCreateWithoutStockAdjustmentsInput = { @@ -1216,6 +1265,7 @@ export type InventoryCreateWithoutStockAdjustmentsInput = { counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutInventoryInput } export type InventoryUncheckedCreateWithoutStockAdjustmentsInput = { @@ -1234,6 +1284,7 @@ export type InventoryUncheckedCreateWithoutStockAdjustmentsInput = { counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutInventoryInput } export type InventoryCreateOrConnectWithoutStockAdjustmentsInput = { @@ -1267,6 +1318,7 @@ export type InventoryUpdateWithoutStockAdjustmentsInput = { counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutInventoryNestedInput } export type InventoryUncheckedUpdateWithoutStockAdjustmentsInput = { @@ -1285,6 +1337,97 @@ export type InventoryUncheckedUpdateWithoutStockAdjustmentsInput = { counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutInventoryNestedInput +} + +export type InventoryCreateWithoutStockReservationsInput = { + name: string + location?: string | null + isActive?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + isPointOfSale?: boolean + inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput + inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput + purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput + stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput + stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput + inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutInventoryInput +} + +export type InventoryUncheckedCreateWithoutStockReservationsInput = { + id?: number + name: string + location?: string | null + isActive?: boolean + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + isPointOfSale?: boolean + inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput + inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput + purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput + stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput + counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutInventoryInput +} + +export type InventoryCreateOrConnectWithoutStockReservationsInput = { + where: Prisma.InventoryWhereUniqueInput + create: Prisma.XOR +} + +export type InventoryUpsertWithoutStockReservationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.InventoryWhereInput +} + +export type InventoryUpdateToOneWithWhereWithoutStockReservationsInput = { + where?: Prisma.InventoryWhereInput + data: Prisma.XOR +} + +export type InventoryUpdateWithoutStockReservationsInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean + inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput + inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput + purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput + stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput + stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput + inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutInventoryNestedInput +} + +export type InventoryUncheckedUpdateWithoutStockReservationsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + location?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean + inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput + inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput + purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput + stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput + counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput + inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput } @@ -1301,6 +1444,7 @@ export type InventoryCountOutputType = { counterStockMovements: number stockMovements: number inventoryBankAccounts: number + stockReservations: number } export type InventoryCountOutputTypeSelect = { @@ -1312,6 +1456,7 @@ export type InventoryCountOutputTypeSelect = { + where?: Prisma.StockReservationWhereInput +} + export type InventorySelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -1398,6 +1550,7 @@ export type InventorySelect stockMovements?: boolean | Prisma.Inventory$stockMovementsArgs inventoryBankAccounts?: boolean | Prisma.Inventory$inventoryBankAccountsArgs + stockReservations?: boolean | Prisma.Inventory$stockReservationsArgs _count?: boolean | Prisma.InventoryCountOutputTypeDefaultArgs }, ExtArgs["result"]["inventory"]> @@ -1424,6 +1577,7 @@ export type InventoryInclude stockMovements?: boolean | Prisma.Inventory$stockMovementsArgs inventoryBankAccounts?: boolean | Prisma.Inventory$inventoryBankAccountsArgs + stockReservations?: boolean | Prisma.Inventory$stockReservationsArgs _count?: boolean | Prisma.InventoryCountOutputTypeDefaultArgs } @@ -1438,6 +1592,7 @@ export type $InventoryPayload[] stockMovements: Prisma.$StockMovementPayload[] inventoryBankAccounts: Prisma.$InventoryBankAccountPayload[] + stockReservations: Prisma.$StockReservationPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1796,6 +1951,7 @@ export interface Prisma__InventoryClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> inventoryBankAccounts = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + stockReservations = {}>(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. @@ -2367,6 +2523,30 @@ export type Inventory$inventoryBankAccountsArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + where?: Prisma.StockReservationWhereInput + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + cursor?: Prisma.StockReservationWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[] +} + /** * Inventory without action */ diff --git a/src/generated/prisma/models/InventoryTransferItem.ts b/src/generated/prisma/models/InventoryTransferItem.ts index 3809292..fca3d58 100644 --- a/src/generated/prisma/models/InventoryTransferItem.ts +++ b/src/generated/prisma/models/InventoryTransferItem.ts @@ -398,14 +398,6 @@ export type InventoryTransferItemUncheckedUpdateManyWithoutTransferNestedInput = deleteMany?: Prisma.InventoryTransferItemScalarWhereInput | Prisma.InventoryTransferItemScalarWhereInput[] } -export type DecimalFieldUpdateOperationsInput = { - set?: runtime.Decimal | runtime.DecimalJsLike | number | string - increment?: runtime.Decimal | runtime.DecimalJsLike | number | string - decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string - multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string - divide?: runtime.Decimal | runtime.DecimalJsLike | number | string -} - export type InventoryTransferItemCreateNestedManyWithoutProductInput = { create?: Prisma.XOR | Prisma.InventoryTransferItemCreateWithoutProductInput[] | Prisma.InventoryTransferItemUncheckedCreateWithoutProductInput[] connectOrCreate?: Prisma.InventoryTransferItemCreateOrConnectWithoutProductInput | Prisma.InventoryTransferItemCreateOrConnectWithoutProductInput[] diff --git a/src/generated/prisma/models/Order.ts b/src/generated/prisma/models/Order.ts index 74d4d1a..55783e7 100644 --- a/src/generated/prisma/models/Order.ts +++ b/src/generated/prisma/models/Order.ts @@ -42,7 +42,6 @@ export type OrderMinAggregateOutputType = { id: number | null orderNumber: string | null status: $Enums.OrderStatus | null - paymentMethod: $Enums.PaymentMethodType | null totalAmount: runtime.Decimal | null description: string | null createdAt: Date | null @@ -55,7 +54,6 @@ export type OrderMaxAggregateOutputType = { id: number | null orderNumber: string | null status: $Enums.OrderStatus | null - paymentMethod: $Enums.PaymentMethodType | null totalAmount: runtime.Decimal | null description: string | null createdAt: Date | null @@ -68,7 +66,6 @@ export type OrderCountAggregateOutputType = { id: number orderNumber: number status: number - paymentMethod: number totalAmount: number description: number createdAt: number @@ -95,7 +92,6 @@ export type OrderMinAggregateInputType = { id?: true orderNumber?: true status?: true - paymentMethod?: true totalAmount?: true description?: true createdAt?: true @@ -108,7 +104,6 @@ export type OrderMaxAggregateInputType = { id?: true orderNumber?: true status?: true - paymentMethod?: true totalAmount?: true description?: true createdAt?: true @@ -121,7 +116,6 @@ export type OrderCountAggregateInputType = { id?: true orderNumber?: true status?: true - paymentMethod?: true totalAmount?: true description?: true createdAt?: true @@ -221,13 +215,12 @@ export type OrderGroupByOutputType = { id: number orderNumber: string status: $Enums.OrderStatus - paymentMethod: $Enums.PaymentMethodType totalAmount: runtime.Decimal description: string | null createdAt: Date updatedAt: Date deletedAt: Date | null - customerId: number + customerId: number | null _count: OrderCountAggregateOutputType | null _avg: OrderAvgAggregateOutputType | null _sum: OrderSumAggregateOutputType | null @@ -257,28 +250,28 @@ export type OrderWhereInput = { id?: Prisma.IntFilter<"Order"> | number orderNumber?: Prisma.StringFilter<"Order"> | string status?: Prisma.EnumOrderStatusFilter<"Order"> | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"Order"> | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.StringNullableFilter<"Order"> | string | null createdAt?: Prisma.DateTimeFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null - customerId?: Prisma.IntFilter<"Order"> | number - customer?: Prisma.XOR + customerId?: Prisma.IntNullableFilter<"Order"> | number | null + customer?: Prisma.XOR | null + orderItems?: Prisma.OrderItemListRelationFilter } export type OrderOrderByWithRelationInput = { id?: Prisma.SortOrder orderNumber?: Prisma.SortOrder status?: Prisma.SortOrder - paymentMethod?: Prisma.SortOrder totalAmount?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - customerId?: Prisma.SortOrder + customerId?: Prisma.SortOrderInput | Prisma.SortOrder customer?: Prisma.CustomerOrderByWithRelationInput + orderItems?: Prisma.OrderItemOrderByRelationAggregateInput _relevance?: Prisma.OrderOrderByRelevanceInput } @@ -289,27 +282,26 @@ export type OrderWhereUniqueInput = Prisma.AtLeast<{ OR?: Prisma.OrderWhereInput[] NOT?: Prisma.OrderWhereInput | Prisma.OrderWhereInput[] status?: Prisma.EnumOrderStatusFilter<"Order"> | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"Order"> | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.StringNullableFilter<"Order"> | string | null createdAt?: Prisma.DateTimeFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null - customerId?: Prisma.IntFilter<"Order"> | number - customer?: Prisma.XOR + customerId?: Prisma.IntNullableFilter<"Order"> | number | null + customer?: Prisma.XOR | null + orderItems?: Prisma.OrderItemListRelationFilter }, "id" | "orderNumber"> export type OrderOrderByWithAggregationInput = { id?: Prisma.SortOrder orderNumber?: Prisma.SortOrder status?: Prisma.SortOrder - paymentMethod?: Prisma.SortOrder totalAmount?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - customerId?: Prisma.SortOrder + customerId?: Prisma.SortOrderInput | Prisma.SortOrder _count?: Prisma.OrderCountOrderByAggregateInput _avg?: Prisma.OrderAvgOrderByAggregateInput _max?: Prisma.OrderMaxOrderByAggregateInput @@ -324,82 +316,79 @@ export type OrderScalarWhereWithAggregatesInput = { id?: Prisma.IntWithAggregatesFilter<"Order"> | number orderNumber?: Prisma.StringWithAggregatesFilter<"Order"> | string status?: Prisma.EnumOrderStatusWithAggregatesFilter<"Order"> | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeWithAggregatesFilter<"Order"> | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalWithAggregatesFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.StringNullableWithAggregatesFilter<"Order"> | string | null createdAt?: Prisma.DateTimeWithAggregatesFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Order"> | Date | string deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Order"> | Date | string | null - customerId?: Prisma.IntWithAggregatesFilter<"Order"> | number + customerId?: Prisma.IntNullableWithAggregatesFilter<"Order"> | number | null } export type OrderCreateInput = { orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null - customer: Prisma.CustomerCreateNestedOneWithoutOrdersInput + customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput } export type OrderUncheckedCreateInput = { id?: number orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null - customerId: number + customerId?: number | null + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput } export type OrderUpdateInput = { orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - customer?: Prisma.CustomerUpdateOneRequiredWithoutOrdersNestedInput + customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput } export type OrderUncheckedUpdateInput = { id?: Prisma.IntFieldUpdateOperationsInput | number orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - customerId?: Prisma.IntFieldUpdateOperationsInput | number + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput } export type OrderCreateManyInput = { id?: number orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null - customerId: number + customerId?: number | null } export type OrderUpdateManyMutationInput = { orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -411,23 +400,12 @@ export type OrderUncheckedUpdateManyInput = { id?: Prisma.IntFieldUpdateOperationsInput | number orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - customerId?: Prisma.IntFieldUpdateOperationsInput | number -} - -export type OrderListRelationFilter = { - every?: Prisma.OrderWhereInput - some?: Prisma.OrderWhereInput - none?: Prisma.OrderWhereInput -} - -export type OrderOrderByRelationAggregateInput = { - _count?: Prisma.SortOrder + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type OrderOrderByRelevanceInput = { @@ -440,7 +418,6 @@ export type OrderCountOrderByAggregateInput = { id?: Prisma.SortOrder orderNumber?: Prisma.SortOrder status?: Prisma.SortOrder - paymentMethod?: Prisma.SortOrder totalAmount?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder @@ -459,7 +436,6 @@ export type OrderMaxOrderByAggregateInput = { id?: Prisma.SortOrder orderNumber?: Prisma.SortOrder status?: Prisma.SortOrder - paymentMethod?: Prisma.SortOrder totalAmount?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder @@ -472,7 +448,6 @@ export type OrderMinOrderByAggregateInput = { id?: Prisma.SortOrder orderNumber?: Prisma.SortOrder status?: Prisma.SortOrder - paymentMethod?: Prisma.SortOrder totalAmount?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder @@ -487,6 +462,47 @@ export type OrderSumOrderByAggregateInput = { customerId?: Prisma.SortOrder } +export type OrderScalarRelationFilter = { + is?: Prisma.OrderWhereInput + isNot?: Prisma.OrderWhereInput +} + +export type OrderListRelationFilter = { + every?: Prisma.OrderWhereInput + some?: Prisma.OrderWhereInput + none?: Prisma.OrderWhereInput +} + +export type OrderOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type EnumOrderStatusFieldUpdateOperationsInput = { + set?: $Enums.OrderStatus +} + +export type NullableIntFieldUpdateOperationsInput = { + set?: number | null + increment?: number + decrement?: number + multiply?: number + divide?: number +} + +export type OrderCreateNestedOneWithoutOrderItemsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.OrderCreateOrConnectWithoutOrderItemsInput + connect?: Prisma.OrderWhereUniqueInput +} + +export type OrderUpdateOneRequiredWithoutOrderItemsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.OrderCreateOrConnectWithoutOrderItemsInput + upsert?: Prisma.OrderUpsertWithoutOrderItemsInput + connect?: Prisma.OrderWhereUniqueInput + update?: Prisma.XOR, Prisma.OrderUncheckedUpdateWithoutOrderItemsInput> +} + export type OrderCreateNestedManyWithoutCustomerInput = { create?: Prisma.XOR | Prisma.OrderCreateWithoutCustomerInput[] | Prisma.OrderUncheckedCreateWithoutCustomerInput[] connectOrCreate?: Prisma.OrderCreateOrConnectWithoutCustomerInput | Prisma.OrderCreateOrConnectWithoutCustomerInput[] @@ -529,35 +545,89 @@ export type OrderUncheckedUpdateManyWithoutCustomerNestedInput = { deleteMany?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[] } -export type EnumOrderStatusFieldUpdateOperationsInput = { - set?: $Enums.OrderStatus -} - -export type EnumPaymentMethodTypeFieldUpdateOperationsInput = { - set?: $Enums.PaymentMethodType -} - -export type OrderCreateWithoutCustomerInput = { +export type OrderCreateWithoutOrderItemsInput = { orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null + customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput +} + +export type OrderUncheckedCreateWithoutOrderItemsInput = { + id?: number + orderNumber: string + status?: $Enums.OrderStatus + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + customerId?: number | null +} + +export type OrderCreateOrConnectWithoutOrderItemsInput = { + where: Prisma.OrderWhereUniqueInput + create: Prisma.XOR +} + +export type OrderUpsertWithoutOrderItemsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.OrderWhereInput +} + +export type OrderUpdateToOneWithWhereWithoutOrderItemsInput = { + where?: Prisma.OrderWhereInput + data: Prisma.XOR +} + +export type OrderUpdateWithoutOrderItemsInput = { + orderNumber?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput +} + +export type OrderUncheckedUpdateWithoutOrderItemsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + orderNumber?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type OrderCreateWithoutCustomerInput = { + orderNumber: string + status?: $Enums.OrderStatus + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput } export type OrderUncheckedCreateWithoutCustomerInput = { id?: number orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput } export type OrderCreateOrConnectWithoutCustomerInput = { @@ -593,20 +663,18 @@ export type OrderScalarWhereInput = { id?: Prisma.IntFilter<"Order"> | number orderNumber?: Prisma.StringFilter<"Order"> | string status?: Prisma.EnumOrderStatusFilter<"Order"> | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"Order"> | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.StringNullableFilter<"Order"> | string | null createdAt?: Prisma.DateTimeFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null - customerId?: Prisma.IntFilter<"Order"> | number + customerId?: Prisma.IntNullableFilter<"Order"> | number | null } export type OrderCreateManyCustomerInput = { id?: number orderNumber: string status?: $Enums.OrderStatus - paymentMethod?: $Enums.PaymentMethodType totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string @@ -617,31 +685,30 @@ export type OrderCreateManyCustomerInput = { export type OrderUpdateWithoutCustomerInput = { orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput } export type OrderUncheckedUpdateWithoutCustomerInput = { id?: Prisma.IntFieldUpdateOperationsInput | number orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput } export type OrderUncheckedUpdateManyWithoutCustomerInput = { id?: Prisma.IntFieldUpdateOperationsInput | number orderNumber?: Prisma.StringFieldUpdateOperationsInput | string status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus - paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -650,19 +717,49 @@ export type OrderUncheckedUpdateManyWithoutCustomerInput = { } +/** + * Count Type OrderCountOutputType + */ + +export type OrderCountOutputType = { + orderItems: number +} + +export type OrderCountOutputTypeSelect = { + orderItems?: boolean | OrderCountOutputTypeCountOrderItemsArgs +} + +/** + * OrderCountOutputType without action + */ +export type OrderCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the OrderCountOutputType + */ + select?: Prisma.OrderCountOutputTypeSelect | null +} + +/** + * OrderCountOutputType without action + */ +export type OrderCountOutputTypeCountOrderItemsArgs = { + where?: Prisma.OrderItemWhereInput +} + export type OrderSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean orderNumber?: boolean status?: boolean - paymentMethod?: boolean totalAmount?: boolean description?: boolean createdAt?: boolean updatedAt?: boolean deletedAt?: boolean customerId?: boolean - customer?: boolean | Prisma.CustomerDefaultArgs + customer?: boolean | Prisma.Order$customerArgs + orderItems?: boolean | Prisma.Order$orderItemsArgs + _count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs }, ExtArgs["result"]["order"]> @@ -671,7 +768,6 @@ export type OrderSelectScalar = { id?: boolean orderNumber?: boolean status?: boolean - paymentMethod?: boolean totalAmount?: boolean description?: boolean createdAt?: boolean @@ -680,27 +776,29 @@ export type OrderSelectScalar = { customerId?: boolean } -export type OrderOmit = runtime.Types.Extensions.GetOmit<"id" | "orderNumber" | "status" | "paymentMethod" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "deletedAt" | "customerId", ExtArgs["result"]["order"]> +export type OrderOmit = runtime.Types.Extensions.GetOmit<"id" | "orderNumber" | "status" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "deletedAt" | "customerId", ExtArgs["result"]["order"]> export type OrderInclude = { - customer?: boolean | Prisma.CustomerDefaultArgs + customer?: boolean | Prisma.Order$customerArgs + orderItems?: boolean | Prisma.Order$orderItemsArgs + _count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs } export type $OrderPayload = { name: "Order" objects: { - customer: Prisma.$CustomerPayload + customer: Prisma.$CustomerPayload | null + orderItems: Prisma.$OrderItemPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number orderNumber: string status: $Enums.OrderStatus - paymentMethod: $Enums.PaymentMethodType totalAmount: runtime.Decimal description: string | null createdAt: Date updatedAt: Date deletedAt: Date | null - customerId: number + customerId: number | null }, ExtArgs["result"]["order"]> composites: {} } @@ -1041,7 +1139,8 @@ readonly fields: OrderFieldRefs; */ export interface Prisma__OrderClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + orderItems = {}>(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. @@ -1074,7 +1173,6 @@ export interface OrderFieldRefs { readonly id: Prisma.FieldRef<"Order", 'Int'> readonly orderNumber: Prisma.FieldRef<"Order", 'String'> readonly status: Prisma.FieldRef<"Order", 'OrderStatus'> - readonly paymentMethod: Prisma.FieldRef<"Order", 'PaymentMethodType'> readonly totalAmount: Prisma.FieldRef<"Order", 'Decimal'> readonly description: Prisma.FieldRef<"Order", 'String'> readonly createdAt: Prisma.FieldRef<"Order", 'DateTime'> @@ -1423,6 +1521,49 @@ export type OrderDeleteManyArgs = { + /** + * 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 +} + +/** + * Order.orderItems + */ +export type Order$orderItemsArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + where?: Prisma.OrderItemWhereInput + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + cursor?: Prisma.OrderItemWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] +} + /** * Order without action */ diff --git a/src/generated/prisma/models/OrderItem.ts b/src/generated/prisma/models/OrderItem.ts new file mode 100644 index 0000000..dc0bafd --- /dev/null +++ b/src/generated/prisma/models/OrderItem.ts @@ -0,0 +1,1472 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `OrderItem` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model OrderItem + * + */ +export type OrderItemModel = runtime.Types.Result.DefaultSelection + +export type AggregateOrderItem = { + _count: OrderItemCountAggregateOutputType | null + _avg: OrderItemAvgAggregateOutputType | null + _sum: OrderItemSumAggregateOutputType | null + _min: OrderItemMinAggregateOutputType | null + _max: OrderItemMaxAggregateOutputType | null +} + +export type OrderItemAvgAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null + orderId: number | null + productId: number | null +} + +export type OrderItemSumAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null + orderId: number | null + productId: number | null +} + +export type OrderItemMinAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null + createdAt: Date | null + orderId: number | null + productId: number | null +} + +export type OrderItemMaxAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null + createdAt: Date | null + orderId: number | null + productId: number | null +} + +export type OrderItemCountAggregateOutputType = { + id: number + quantity: number + unitPrice: number + totalAmount: number + createdAt: number + orderId: number + productId: number + _all: number +} + + +export type OrderItemAvgAggregateInputType = { + id?: true + quantity?: true + unitPrice?: true + totalAmount?: true + orderId?: true + productId?: true +} + +export type OrderItemSumAggregateInputType = { + id?: true + quantity?: true + unitPrice?: true + totalAmount?: true + orderId?: true + productId?: true +} + +export type OrderItemMinAggregateInputType = { + id?: true + quantity?: true + unitPrice?: true + totalAmount?: true + createdAt?: true + orderId?: true + productId?: true +} + +export type OrderItemMaxAggregateInputType = { + id?: true + quantity?: true + unitPrice?: true + totalAmount?: true + createdAt?: true + orderId?: true + productId?: true +} + +export type OrderItemCountAggregateInputType = { + id?: true + quantity?: true + unitPrice?: true + totalAmount?: true + createdAt?: true + orderId?: true + productId?: true + _all?: true +} + +export type OrderItemAggregateArgs = { + /** + * Filter which OrderItem to aggregate. + */ + where?: Prisma.OrderItemWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrderItems to fetch. + */ + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.OrderItemWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrderItems from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` OrderItems. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned OrderItems + **/ + _count?: true | OrderItemCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: OrderItemAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: OrderItemSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: OrderItemMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: OrderItemMaxAggregateInputType +} + +export type GetOrderItemAggregateType = { + [P in keyof T & keyof AggregateOrderItem]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type OrderItemGroupByArgs = { + where?: Prisma.OrderItemWhereInput + orderBy?: Prisma.OrderItemOrderByWithAggregationInput | Prisma.OrderItemOrderByWithAggregationInput[] + by: Prisma.OrderItemScalarFieldEnum[] | Prisma.OrderItemScalarFieldEnum + having?: Prisma.OrderItemScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: OrderItemCountAggregateInputType | true + _avg?: OrderItemAvgAggregateInputType + _sum?: OrderItemSumAggregateInputType + _min?: OrderItemMinAggregateInputType + _max?: OrderItemMaxAggregateInputType +} + +export type OrderItemGroupByOutputType = { + id: number + quantity: runtime.Decimal + unitPrice: runtime.Decimal + totalAmount: runtime.Decimal + createdAt: Date + orderId: number + productId: number + _count: OrderItemCountAggregateOutputType | null + _avg: OrderItemAvgAggregateOutputType | null + _sum: OrderItemSumAggregateOutputType | null + _min: OrderItemMinAggregateOutputType | null + _max: OrderItemMaxAggregateOutputType | null +} + +type GetOrderItemGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof OrderItemGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type OrderItemWhereInput = { + AND?: Prisma.OrderItemWhereInput | Prisma.OrderItemWhereInput[] + OR?: Prisma.OrderItemWhereInput[] + NOT?: Prisma.OrderItemWhereInput | Prisma.OrderItemWhereInput[] + id?: Prisma.IntFilter<"OrderItem"> | number + quantity?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFilter<"OrderItem"> | Date | string + orderId?: Prisma.IntFilter<"OrderItem"> | number + productId?: Prisma.IntFilter<"OrderItem"> | number + order?: Prisma.XOR + product?: Prisma.XOR +} + +export type OrderItemOrderByWithRelationInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder + order?: Prisma.OrderOrderByWithRelationInput + product?: Prisma.ProductOrderByWithRelationInput +} + +export type OrderItemWhereUniqueInput = Prisma.AtLeast<{ + id?: number + AND?: Prisma.OrderItemWhereInput | Prisma.OrderItemWhereInput[] + OR?: Prisma.OrderItemWhereInput[] + NOT?: Prisma.OrderItemWhereInput | Prisma.OrderItemWhereInput[] + quantity?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFilter<"OrderItem"> | Date | string + orderId?: Prisma.IntFilter<"OrderItem"> | number + productId?: Prisma.IntFilter<"OrderItem"> | number + order?: Prisma.XOR + product?: Prisma.XOR +}, "id"> + +export type OrderItemOrderByWithAggregationInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder + _count?: Prisma.OrderItemCountOrderByAggregateInput + _avg?: Prisma.OrderItemAvgOrderByAggregateInput + _max?: Prisma.OrderItemMaxOrderByAggregateInput + _min?: Prisma.OrderItemMinOrderByAggregateInput + _sum?: Prisma.OrderItemSumOrderByAggregateInput +} + +export type OrderItemScalarWhereWithAggregatesInput = { + AND?: Prisma.OrderItemScalarWhereWithAggregatesInput | Prisma.OrderItemScalarWhereWithAggregatesInput[] + OR?: Prisma.OrderItemScalarWhereWithAggregatesInput[] + NOT?: Prisma.OrderItemScalarWhereWithAggregatesInput | Prisma.OrderItemScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"OrderItem"> | number + quantity?: Prisma.DecimalWithAggregatesFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalWithAggregatesFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalWithAggregatesFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeWithAggregatesFilter<"OrderItem"> | Date | string + orderId?: Prisma.IntWithAggregatesFilter<"OrderItem"> | number + productId?: Prisma.IntWithAggregatesFilter<"OrderItem"> | number +} + +export type OrderItemCreateInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + order: Prisma.OrderCreateNestedOneWithoutOrderItemsInput + product: Prisma.ProductCreateNestedOneWithoutOrderItemsInput +} + +export type OrderItemUncheckedCreateInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + orderId: number + productId: number +} + +export type OrderItemUpdateInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + order?: Prisma.OrderUpdateOneRequiredWithoutOrderItemsNestedInput + product?: Prisma.ProductUpdateOneRequiredWithoutOrderItemsNestedInput +} + +export type OrderItemUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type OrderItemCreateManyInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + orderId: number + productId: number +} + +export type OrderItemUpdateManyMutationInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrderItemUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type OrderItemListRelationFilter = { + every?: Prisma.OrderItemWhereInput + some?: Prisma.OrderItemWhereInput + none?: Prisma.OrderItemWhereInput +} + +export type OrderItemOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type OrderItemCountOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type OrderItemAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type OrderItemMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type OrderItemMinOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type OrderItemSumOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder + orderId?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type OrderItemCreateNestedManyWithoutOrderInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutOrderInput[] | Prisma.OrderItemUncheckedCreateWithoutOrderInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutOrderInput | Prisma.OrderItemCreateOrConnectWithoutOrderInput[] + createMany?: Prisma.OrderItemCreateManyOrderInputEnvelope + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] +} + +export type OrderItemUncheckedCreateNestedManyWithoutOrderInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutOrderInput[] | Prisma.OrderItemUncheckedCreateWithoutOrderInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutOrderInput | Prisma.OrderItemCreateOrConnectWithoutOrderInput[] + createMany?: Prisma.OrderItemCreateManyOrderInputEnvelope + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] +} + +export type OrderItemUpdateManyWithoutOrderNestedInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutOrderInput[] | Prisma.OrderItemUncheckedCreateWithoutOrderInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutOrderInput | Prisma.OrderItemCreateOrConnectWithoutOrderInput[] + upsert?: Prisma.OrderItemUpsertWithWhereUniqueWithoutOrderInput | Prisma.OrderItemUpsertWithWhereUniqueWithoutOrderInput[] + createMany?: Prisma.OrderItemCreateManyOrderInputEnvelope + set?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + disconnect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + delete?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + update?: Prisma.OrderItemUpdateWithWhereUniqueWithoutOrderInput | Prisma.OrderItemUpdateWithWhereUniqueWithoutOrderInput[] + updateMany?: Prisma.OrderItemUpdateManyWithWhereWithoutOrderInput | Prisma.OrderItemUpdateManyWithWhereWithoutOrderInput[] + deleteMany?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] +} + +export type OrderItemUncheckedUpdateManyWithoutOrderNestedInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutOrderInput[] | Prisma.OrderItemUncheckedCreateWithoutOrderInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutOrderInput | Prisma.OrderItemCreateOrConnectWithoutOrderInput[] + upsert?: Prisma.OrderItemUpsertWithWhereUniqueWithoutOrderInput | Prisma.OrderItemUpsertWithWhereUniqueWithoutOrderInput[] + createMany?: Prisma.OrderItemCreateManyOrderInputEnvelope + set?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + disconnect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + delete?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + update?: Prisma.OrderItemUpdateWithWhereUniqueWithoutOrderInput | Prisma.OrderItemUpdateWithWhereUniqueWithoutOrderInput[] + updateMany?: Prisma.OrderItemUpdateManyWithWhereWithoutOrderInput | Prisma.OrderItemUpdateManyWithWhereWithoutOrderInput[] + deleteMany?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] +} + +export type OrderItemCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutProductInput[] | Prisma.OrderItemUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutProductInput | Prisma.OrderItemCreateOrConnectWithoutProductInput[] + createMany?: Prisma.OrderItemCreateManyProductInputEnvelope + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] +} + +export type OrderItemUncheckedCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutProductInput[] | Prisma.OrderItemUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutProductInput | Prisma.OrderItemCreateOrConnectWithoutProductInput[] + createMany?: Prisma.OrderItemCreateManyProductInputEnvelope + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] +} + +export type OrderItemUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutProductInput[] | Prisma.OrderItemUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutProductInput | Prisma.OrderItemCreateOrConnectWithoutProductInput[] + upsert?: Prisma.OrderItemUpsertWithWhereUniqueWithoutProductInput | Prisma.OrderItemUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.OrderItemCreateManyProductInputEnvelope + set?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + disconnect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + delete?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + update?: Prisma.OrderItemUpdateWithWhereUniqueWithoutProductInput | Prisma.OrderItemUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.OrderItemUpdateManyWithWhereWithoutProductInput | Prisma.OrderItemUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] +} + +export type OrderItemUncheckedUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.OrderItemCreateWithoutProductInput[] | Prisma.OrderItemUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.OrderItemCreateOrConnectWithoutProductInput | Prisma.OrderItemCreateOrConnectWithoutProductInput[] + upsert?: Prisma.OrderItemUpsertWithWhereUniqueWithoutProductInput | Prisma.OrderItemUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.OrderItemCreateManyProductInputEnvelope + set?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + disconnect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + delete?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + connect?: Prisma.OrderItemWhereUniqueInput | Prisma.OrderItemWhereUniqueInput[] + update?: Prisma.OrderItemUpdateWithWhereUniqueWithoutProductInput | Prisma.OrderItemUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.OrderItemUpdateManyWithWhereWithoutProductInput | Prisma.OrderItemUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] +} + +export type OrderItemCreateWithoutOrderInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + product: Prisma.ProductCreateNestedOneWithoutOrderItemsInput +} + +export type OrderItemUncheckedCreateWithoutOrderInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + productId: number +} + +export type OrderItemCreateOrConnectWithoutOrderInput = { + where: Prisma.OrderItemWhereUniqueInput + create: Prisma.XOR +} + +export type OrderItemCreateManyOrderInputEnvelope = { + data: Prisma.OrderItemCreateManyOrderInput | Prisma.OrderItemCreateManyOrderInput[] + skipDuplicates?: boolean +} + +export type OrderItemUpsertWithWhereUniqueWithoutOrderInput = { + where: Prisma.OrderItemWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type OrderItemUpdateWithWhereUniqueWithoutOrderInput = { + where: Prisma.OrderItemWhereUniqueInput + data: Prisma.XOR +} + +export type OrderItemUpdateManyWithWhereWithoutOrderInput = { + where: Prisma.OrderItemScalarWhereInput + data: Prisma.XOR +} + +export type OrderItemScalarWhereInput = { + AND?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] + OR?: Prisma.OrderItemScalarWhereInput[] + NOT?: Prisma.OrderItemScalarWhereInput | Prisma.OrderItemScalarWhereInput[] + id?: Prisma.IntFilter<"OrderItem"> | number + quantity?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"OrderItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFilter<"OrderItem"> | Date | string + orderId?: Prisma.IntFilter<"OrderItem"> | number + productId?: Prisma.IntFilter<"OrderItem"> | number +} + +export type OrderItemCreateWithoutProductInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + order: Prisma.OrderCreateNestedOneWithoutOrderItemsInput +} + +export type OrderItemUncheckedCreateWithoutProductInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + orderId: number +} + +export type OrderItemCreateOrConnectWithoutProductInput = { + where: Prisma.OrderItemWhereUniqueInput + create: Prisma.XOR +} + +export type OrderItemCreateManyProductInputEnvelope = { + data: Prisma.OrderItemCreateManyProductInput | Prisma.OrderItemCreateManyProductInput[] + skipDuplicates?: boolean +} + +export type OrderItemUpsertWithWhereUniqueWithoutProductInput = { + where: Prisma.OrderItemWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type OrderItemUpdateWithWhereUniqueWithoutProductInput = { + where: Prisma.OrderItemWhereUniqueInput + data: Prisma.XOR +} + +export type OrderItemUpdateManyWithWhereWithoutProductInput = { + where: Prisma.OrderItemScalarWhereInput + data: Prisma.XOR +} + +export type OrderItemCreateManyOrderInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + productId: number +} + +export type OrderItemUpdateWithoutOrderInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + product?: Prisma.ProductUpdateOneRequiredWithoutOrderItemsNestedInput +} + +export type OrderItemUncheckedUpdateWithoutOrderInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type OrderItemUncheckedUpdateManyWithoutOrderInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type OrderItemCreateManyProductInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + orderId: number +} + +export type OrderItemUpdateWithoutProductInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + order?: Prisma.OrderUpdateOneRequiredWithoutOrderItemsNestedInput +} + +export type OrderItemUncheckedUpdateWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type OrderItemUncheckedUpdateManyWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + + + +export type OrderItemSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + quantity?: boolean + unitPrice?: boolean + totalAmount?: boolean + createdAt?: boolean + orderId?: boolean + productId?: boolean + order?: boolean | Prisma.OrderDefaultArgs + product?: boolean | Prisma.ProductDefaultArgs +}, ExtArgs["result"]["orderItem"]> + + + +export type OrderItemSelectScalar = { + id?: boolean + quantity?: boolean + unitPrice?: boolean + totalAmount?: boolean + createdAt?: boolean + orderId?: boolean + productId?: boolean +} + +export type OrderItemOmit = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "unitPrice" | "totalAmount" | "createdAt" | "orderId" | "productId", ExtArgs["result"]["orderItem"]> +export type OrderItemInclude = { + order?: boolean | Prisma.OrderDefaultArgs + product?: boolean | Prisma.ProductDefaultArgs +} + +export type $OrderItemPayload = { + name: "OrderItem" + objects: { + order: Prisma.$OrderPayload + product: Prisma.$ProductPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + quantity: runtime.Decimal + unitPrice: runtime.Decimal + totalAmount: runtime.Decimal + createdAt: Date + orderId: number + productId: number + }, ExtArgs["result"]["orderItem"]> + composites: {} +} + +export type OrderItemGetPayload = runtime.Types.Result.GetResult + +export type OrderItemCountArgs = + Omit & { + select?: OrderItemCountAggregateInputType | true + } + +export interface OrderItemDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['OrderItem'], meta: { name: 'OrderItem' } } + /** + * Find zero or one OrderItem that matches the filter. + * @param {OrderItemFindUniqueArgs} args - Arguments to find a OrderItem + * @example + * // Get one OrderItem + * const orderItem = await prisma.orderItem.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one OrderItem that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {OrderItemFindUniqueOrThrowArgs} args - Arguments to find a OrderItem + * @example + * // Get one OrderItem + * const orderItem = await prisma.orderItem.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrderItem that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemFindFirstArgs} args - Arguments to find a OrderItem + * @example + * // Get one OrderItem + * const orderItem = await prisma.orderItem.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrderItem that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemFindFirstOrThrowArgs} args - Arguments to find a OrderItem + * @example + * // Get one OrderItem + * const orderItem = await prisma.orderItem.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more OrderItems that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all OrderItems + * const orderItems = await prisma.orderItem.findMany() + * + * // Get first 10 OrderItems + * const orderItems = await prisma.orderItem.findMany({ take: 10 }) + * + * // Only select the `id` + * const orderItemWithIdOnly = await prisma.orderItem.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a OrderItem. + * @param {OrderItemCreateArgs} args - Arguments to create a OrderItem. + * @example + * // Create one OrderItem + * const OrderItem = await prisma.orderItem.create({ + * data: { + * // ... data to create a OrderItem + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many OrderItems. + * @param {OrderItemCreateManyArgs} args - Arguments to create many OrderItems. + * @example + * // Create many OrderItems + * const orderItem = await prisma.orderItem.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a OrderItem. + * @param {OrderItemDeleteArgs} args - Arguments to delete one OrderItem. + * @example + * // Delete one OrderItem + * const OrderItem = await prisma.orderItem.delete({ + * where: { + * // ... filter to delete one OrderItem + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one OrderItem. + * @param {OrderItemUpdateArgs} args - Arguments to update one OrderItem. + * @example + * // Update one OrderItem + * const orderItem = await prisma.orderItem.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more OrderItems. + * @param {OrderItemDeleteManyArgs} args - Arguments to filter OrderItems to delete. + * @example + * // Delete a few OrderItems + * const { count } = await prisma.orderItem.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more OrderItems. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many OrderItems + * const orderItem = await prisma.orderItem.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one OrderItem. + * @param {OrderItemUpsertArgs} args - Arguments to update or create a OrderItem. + * @example + * // Update or create a OrderItem + * const orderItem = await prisma.orderItem.upsert({ + * create: { + * // ... data to create a OrderItem + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the OrderItem we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__OrderItemClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of OrderItems. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemCountArgs} args - Arguments to filter OrderItems to count. + * @example + * // Count the number of OrderItems + * const count = await prisma.orderItem.count({ + * where: { + * // ... the filter for the OrderItems we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a OrderItem. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by OrderItem. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrderItemGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends OrderItemGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: OrderItemGroupByArgs['orderBy'] } + : { orderBy?: OrderItemGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetOrderItemGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the OrderItem model + */ +readonly fields: OrderItemFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for OrderItem. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__OrderItemClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + order = {}>(args?: Prisma.Subset>): Prisma.Prisma__OrderClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + product = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductClient, 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. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the OrderItem model + */ +export interface OrderItemFieldRefs { + readonly id: Prisma.FieldRef<"OrderItem", 'Int'> + readonly quantity: Prisma.FieldRef<"OrderItem", 'Decimal'> + readonly unitPrice: Prisma.FieldRef<"OrderItem", 'Decimal'> + readonly totalAmount: Prisma.FieldRef<"OrderItem", 'Decimal'> + readonly createdAt: Prisma.FieldRef<"OrderItem", 'DateTime'> + readonly orderId: Prisma.FieldRef<"OrderItem", 'Int'> + readonly productId: Prisma.FieldRef<"OrderItem", 'Int'> +} + + +// Custom InputTypes +/** + * OrderItem findUnique + */ +export type OrderItemFindUniqueArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter, which OrderItem to fetch. + */ + where: Prisma.OrderItemWhereUniqueInput +} + +/** + * OrderItem findUniqueOrThrow + */ +export type OrderItemFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter, which OrderItem to fetch. + */ + where: Prisma.OrderItemWhereUniqueInput +} + +/** + * OrderItem findFirst + */ +export type OrderItemFindFirstArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter, which OrderItem to fetch. + */ + where?: Prisma.OrderItemWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrderItems to fetch. + */ + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrderItems. + */ + cursor?: Prisma.OrderItemWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrderItems from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` OrderItems. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrderItems. + */ + distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] +} + +/** + * OrderItem findFirstOrThrow + */ +export type OrderItemFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter, which OrderItem to fetch. + */ + where?: Prisma.OrderItemWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrderItems to fetch. + */ + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrderItems. + */ + cursor?: Prisma.OrderItemWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrderItems from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` OrderItems. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrderItems. + */ + distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] +} + +/** + * OrderItem findMany + */ +export type OrderItemFindManyArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter, which OrderItems to fetch. + */ + where?: Prisma.OrderItemWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrderItems to fetch. + */ + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing OrderItems. + */ + cursor?: Prisma.OrderItemWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrderItems from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` OrderItems. + */ + skip?: number + distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] +} + +/** + * OrderItem create + */ +export type OrderItemCreateArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * The data needed to create a OrderItem. + */ + data: Prisma.XOR +} + +/** + * OrderItem createMany + */ +export type OrderItemCreateManyArgs = { + /** + * The data used to create many OrderItems. + */ + data: Prisma.OrderItemCreateManyInput | Prisma.OrderItemCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * OrderItem update + */ +export type OrderItemUpdateArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * The data needed to update a OrderItem. + */ + data: Prisma.XOR + /** + * Choose, which OrderItem to update. + */ + where: Prisma.OrderItemWhereUniqueInput +} + +/** + * OrderItem updateMany + */ +export type OrderItemUpdateManyArgs = { + /** + * The data used to update OrderItems. + */ + data: Prisma.XOR + /** + * Filter which OrderItems to update + */ + where?: Prisma.OrderItemWhereInput + /** + * Limit how many OrderItems to update. + */ + limit?: number +} + +/** + * OrderItem upsert + */ +export type OrderItemUpsertArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * The filter to search for the OrderItem to update in case it exists. + */ + where: Prisma.OrderItemWhereUniqueInput + /** + * In case the OrderItem found by the `where` argument doesn't exist, create a new OrderItem with this data. + */ + create: Prisma.XOR + /** + * In case the OrderItem was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * OrderItem delete + */ +export type OrderItemDeleteArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + /** + * Filter which OrderItem to delete. + */ + where: Prisma.OrderItemWhereUniqueInput +} + +/** + * OrderItem deleteMany + */ +export type OrderItemDeleteManyArgs = { + /** + * Filter which OrderItems to delete + */ + where?: Prisma.OrderItemWhereInput + /** + * Limit how many OrderItems to delete. + */ + limit?: number +} + +/** + * OrderItem without action + */ +export type OrderItemDefaultArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null +} diff --git a/src/generated/prisma/models/Product.ts b/src/generated/prisma/models/Product.ts index 52b537b..2fc6c19 100644 --- a/src/generated/prisma/models/Product.ts +++ b/src/generated/prisma/models/Product.ts @@ -297,6 +297,8 @@ export type ProductWhereInput = { stockBalances?: Prisma.StockBalanceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter + stockReservations?: Prisma.StockReservationListRelationFilter + orderItems?: Prisma.OrderItemListRelationFilter } export type ProductOrderByWithRelationInput = { @@ -321,6 +323,8 @@ export type ProductOrderByWithRelationInput = { stockBalances?: Prisma.StockBalanceOrderByRelationAggregateInput stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput salesInvoiceItems?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput + stockReservations?: Prisma.StockReservationOrderByRelationAggregateInput + orderItems?: Prisma.OrderItemOrderByRelationAggregateInput _relevance?: Prisma.ProductOrderByRelevanceInput } @@ -349,6 +353,8 @@ export type ProductWhereUniqueInput = Prisma.AtLeast<{ stockBalances?: Prisma.StockBalanceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter + stockReservations?: Prisma.StockReservationListRelationFilter + orderItems?: Prisma.OrderItemListRelationFilter }, "id" | "sku" | "barcode"> export type ProductOrderByWithAggregationInput = { @@ -408,6 +414,8 @@ export type ProductCreateInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateInput = { @@ -430,6 +438,8 @@ export type ProductUncheckedCreateInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductUpdateInput = { @@ -451,6 +461,8 @@ export type ProductUpdateInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateInput = { @@ -473,6 +485,8 @@ export type ProductUncheckedUpdateInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateManyInput = { @@ -613,18 +627,18 @@ export type ProductUpdateOneRequiredWithoutInventoryTransferItemsNestedInput = { update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutInventoryTransferItemsInput> } -export type ProductCreateNestedOneWithoutSalesInvoiceItemsInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutSalesInvoiceItemsInput +export type ProductCreateNestedOneWithoutOrderItemsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutOrderItemsInput connect?: Prisma.ProductWhereUniqueInput } -export type ProductUpdateOneRequiredWithoutSalesInvoiceItemsNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutSalesInvoiceItemsInput - upsert?: Prisma.ProductUpsertWithoutSalesInvoiceItemsInput +export type ProductUpdateOneRequiredWithoutOrderItemsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutOrderItemsInput + upsert?: Prisma.ProductUpsertWithoutOrderItemsInput connect?: Prisma.ProductWhereUniqueInput - update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutSalesInvoiceItemsInput> + update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutOrderItemsInput> } export type ProductCreateNestedOneWithoutVariantsInput = { @@ -739,6 +753,20 @@ export type ProductUpdateOneRequiredWithoutPurchaseReceiptItemsNestedInput = { update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutPurchaseReceiptItemsInput> } +export type ProductCreateNestedOneWithoutSalesInvoiceItemsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutSalesInvoiceItemsInput + connect?: Prisma.ProductWhereUniqueInput +} + +export type ProductUpdateOneRequiredWithoutSalesInvoiceItemsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutSalesInvoiceItemsInput + upsert?: Prisma.ProductUpsertWithoutSalesInvoiceItemsInput + connect?: Prisma.ProductWhereUniqueInput + update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutSalesInvoiceItemsInput> +} + export type ProductCreateNestedOneWithoutStockMovementsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.ProductCreateOrConnectWithoutStockMovementsInput @@ -781,6 +809,20 @@ export type ProductUpdateOneRequiredWithoutStockAdjustmentsNestedInput = { update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutStockAdjustmentsInput> } +export type ProductCreateNestedOneWithoutStockReservationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutStockReservationsInput + connect?: Prisma.ProductWhereUniqueInput +} + +export type ProductUpdateOneRequiredWithoutStockReservationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutStockReservationsInput + upsert?: Prisma.ProductUpsertWithoutStockReservationsInput + connect?: Prisma.ProductWhereUniqueInput + update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutStockReservationsInput> +} + export type ProductCreateWithoutInventoryTransferItemsInput = { name: string description?: string | null @@ -799,6 +841,8 @@ export type ProductCreateWithoutInventoryTransferItemsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutInventoryTransferItemsInput = { @@ -820,6 +864,8 @@ export type ProductUncheckedCreateWithoutInventoryTransferItemsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutInventoryTransferItemsInput = { @@ -856,6 +902,8 @@ export type ProductUpdateWithoutInventoryTransferItemsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutInventoryTransferItemsInput = { @@ -877,9 +925,11 @@ export type ProductUncheckedUpdateWithoutInventoryTransferItemsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } -export type ProductCreateWithoutSalesInvoiceItemsInput = { +export type ProductCreateWithoutOrderItemsInput = { name: string description?: string | null sku?: string | null @@ -897,9 +947,11 @@ export type ProductCreateWithoutSalesInvoiceItemsInput = { stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput } -export type ProductUncheckedCreateWithoutSalesInvoiceItemsInput = { +export type ProductUncheckedCreateWithoutOrderItemsInput = { id?: number name: string description?: string | null @@ -918,25 +970,27 @@ export type ProductUncheckedCreateWithoutSalesInvoiceItemsInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput } -export type ProductCreateOrConnectWithoutSalesInvoiceItemsInput = { +export type ProductCreateOrConnectWithoutOrderItemsInput = { where: Prisma.ProductWhereUniqueInput - create: Prisma.XOR + create: Prisma.XOR } -export type ProductUpsertWithoutSalesInvoiceItemsInput = { - update: Prisma.XOR - create: Prisma.XOR +export type ProductUpsertWithoutOrderItemsInput = { + update: Prisma.XOR + create: Prisma.XOR where?: Prisma.ProductWhereInput } -export type ProductUpdateToOneWithWhereWithoutSalesInvoiceItemsInput = { +export type ProductUpdateToOneWithWhereWithoutOrderItemsInput = { where?: Prisma.ProductWhereInput - data: Prisma.XOR + data: Prisma.XOR } -export type ProductUpdateWithoutSalesInvoiceItemsInput = { +export type ProductUpdateWithoutOrderItemsInput = { name?: Prisma.StringFieldUpdateOperationsInput | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -954,9 +1008,11 @@ export type ProductUpdateWithoutSalesInvoiceItemsInput = { stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput } -export type ProductUncheckedUpdateWithoutSalesInvoiceItemsInput = { +export type ProductUncheckedUpdateWithoutOrderItemsInput = { id?: Prisma.IntFieldUpdateOperationsInput | number name?: Prisma.StringFieldUpdateOperationsInput | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -975,6 +1031,8 @@ export type ProductUncheckedUpdateWithoutSalesInvoiceItemsInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutVariantsInput = { @@ -995,6 +1053,8 @@ export type ProductCreateWithoutVariantsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutVariantsInput = { @@ -1016,6 +1076,8 @@ export type ProductUncheckedCreateWithoutVariantsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutVariantsInput = { @@ -1052,6 +1114,8 @@ export type ProductUpdateWithoutVariantsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutVariantsInput = { @@ -1073,6 +1137,8 @@ export type ProductUncheckedUpdateWithoutVariantsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutBrandInput = { @@ -1093,6 +1159,8 @@ export type ProductCreateWithoutBrandInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutBrandInput = { @@ -1114,6 +1182,8 @@ export type ProductUncheckedCreateWithoutBrandInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutBrandInput = { @@ -1178,6 +1248,8 @@ export type ProductCreateWithoutCategoryInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutCategoryInput = { @@ -1199,6 +1271,8 @@ export type ProductUncheckedCreateWithoutCategoryInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutCategoryInput = { @@ -1245,6 +1319,8 @@ export type ProductCreateWithoutPurchaseReceiptItemsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutPurchaseReceiptItemsInput = { @@ -1266,6 +1342,8 @@ export type ProductUncheckedCreateWithoutPurchaseReceiptItemsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutPurchaseReceiptItemsInput = { @@ -1302,6 +1380,8 @@ export type ProductUpdateWithoutPurchaseReceiptItemsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutPurchaseReceiptItemsInput = { @@ -1323,6 +1403,114 @@ export type ProductUncheckedUpdateWithoutPurchaseReceiptItemsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput +} + +export type ProductCreateWithoutSalesInvoiceItemsInput = { + name: string + description?: string | null + sku?: string | null + barcode?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemCreateNestedManyWithoutProductInput + variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput + brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput + category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput + stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput + stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput +} + +export type ProductUncheckedCreateWithoutSalesInvoiceItemsInput = { + id?: number + name: string + description?: string | null + sku?: string | null + barcode?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + brandId?: number | null + categoryId?: number | null + salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUncheckedCreateNestedManyWithoutProductInput + variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedCreateNestedManyWithoutProductInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput + stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput +} + +export type ProductCreateOrConnectWithoutSalesInvoiceItemsInput = { + where: Prisma.ProductWhereUniqueInput + create: Prisma.XOR +} + +export type ProductUpsertWithoutSalesInvoiceItemsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProductWhereInput +} + +export type ProductUpdateToOneWithWhereWithoutSalesInvoiceItemsInput = { + where?: Prisma.ProductWhereInput + data: Prisma.XOR +} + +export type ProductUpdateWithoutSalesInvoiceItemsInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUpdateManyWithoutProductNestedInput + variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput + brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput + category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput + stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput + stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput +} + +export type ProductUncheckedUpdateWithoutSalesInvoiceItemsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUncheckedUpdateManyWithoutProductNestedInput + variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedUpdateManyWithoutProductNestedInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput + stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockMovementsInput = { @@ -1343,6 +1531,8 @@ export type ProductCreateWithoutStockMovementsInput = { stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockMovementsInput = { @@ -1364,6 +1554,8 @@ export type ProductUncheckedCreateWithoutStockMovementsInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockMovementsInput = { @@ -1400,6 +1592,8 @@ export type ProductUpdateWithoutStockMovementsInput = { stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockMovementsInput = { @@ -1421,6 +1615,8 @@ export type ProductUncheckedUpdateWithoutStockMovementsInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockBalancesInput = { @@ -1441,6 +1637,8 @@ export type ProductCreateWithoutStockBalancesInput = { stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockBalancesInput = { @@ -1462,6 +1660,8 @@ export type ProductUncheckedCreateWithoutStockBalancesInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockBalancesInput = { @@ -1498,6 +1698,8 @@ export type ProductUpdateWithoutStockBalancesInput = { stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockBalancesInput = { @@ -1519,6 +1721,8 @@ export type ProductUncheckedUpdateWithoutStockBalancesInput = { stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockAdjustmentsInput = { @@ -1539,6 +1743,8 @@ export type ProductCreateWithoutStockAdjustmentsInput = { stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockAdjustmentsInput = { @@ -1560,6 +1766,8 @@ export type ProductUncheckedCreateWithoutStockAdjustmentsInput = { stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockAdjustmentsInput = { @@ -1596,6 +1804,8 @@ export type ProductUpdateWithoutStockAdjustmentsInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockAdjustmentsInput = { @@ -1617,6 +1827,114 @@ export type ProductUncheckedUpdateWithoutStockAdjustmentsInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput +} + +export type ProductCreateWithoutStockReservationsInput = { + name: string + description?: string | null + sku?: string | null + barcode?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemCreateNestedManyWithoutProductInput + variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput + brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput + category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput + stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput + stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput + stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemCreateNestedManyWithoutProductInput +} + +export type ProductUncheckedCreateWithoutStockReservationsInput = { + id?: number + name: string + description?: string | null + sku?: string | null + barcode?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + brandId?: number | null + categoryId?: number | null + salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUncheckedCreateNestedManyWithoutProductInput + variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedCreateNestedManyWithoutProductInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput + stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput + stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput + orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutProductInput +} + +export type ProductCreateOrConnectWithoutStockReservationsInput = { + where: Prisma.ProductWhereUniqueInput + create: Prisma.XOR +} + +export type ProductUpsertWithoutStockReservationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProductWhereInput +} + +export type ProductUpdateToOneWithWhereWithoutStockReservationsInput = { + where?: Prisma.ProductWhereInput + data: Prisma.XOR +} + +export type ProductUpdateWithoutStockReservationsInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUpdateManyWithoutProductNestedInput + variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput + brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput + category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput + stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput + stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput + stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput +} + +export type ProductUncheckedUpdateWithoutStockReservationsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + inventoryTransferItems?: Prisma.InventoryTransferItemUncheckedUpdateManyWithoutProductNestedInput + variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput + purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedUpdateManyWithoutProductNestedInput + stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput + stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput + stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateManyBrandInput = { @@ -1651,6 +1969,8 @@ export type ProductUpdateWithoutBrandInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutBrandInput = { @@ -1672,6 +1992,8 @@ export type ProductUncheckedUpdateWithoutBrandInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateManyWithoutBrandInput = { @@ -1720,6 +2042,8 @@ export type ProductUpdateWithoutCategoryInput = { stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutCategoryInput = { @@ -1741,6 +2065,8 @@ export type ProductUncheckedUpdateWithoutCategoryInput = { stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput + stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutProductNestedInput + orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateManyWithoutCategoryInput = { @@ -1770,6 +2096,8 @@ export type ProductCountOutputType = { stockBalances: number stockMovements: number salesInvoiceItems: number + stockReservations: number + orderItems: number } export type ProductCountOutputTypeSelect = { @@ -1780,6 +2108,8 @@ export type ProductCountOutputTypeSelect = { + where?: Prisma.StockReservationWhereInput +} + +/** + * ProductCountOutputType without action + */ +export type ProductCountOutputTypeCountOrderItemsArgs = { + where?: Prisma.OrderItemWhereInput +} + export type ProductSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -1864,6 +2208,8 @@ export type ProductSelect stockMovements?: boolean | Prisma.Product$stockMovementsArgs salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs + stockReservations?: boolean | Prisma.Product$stockReservationsArgs + orderItems?: boolean | Prisma.Product$orderItemsArgs _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs }, ExtArgs["result"]["product"]> @@ -1895,6 +2241,8 @@ export type ProductInclude stockMovements?: boolean | Prisma.Product$stockMovementsArgs salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs + stockReservations?: boolean | Prisma.Product$stockReservationsArgs + orderItems?: boolean | Prisma.Product$orderItemsArgs _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs } @@ -1910,6 +2258,8 @@ export type $ProductPayload[] stockMovements: Prisma.$StockMovementPayload[] salesInvoiceItems: Prisma.$SalesInvoiceItemPayload[] + stockReservations: Prisma.$StockReservationPayload[] + orderItems: Prisma.$OrderItemPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -2273,6 +2623,8 @@ export interface Prisma__ProductClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> salesInvoiceItems = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + stockReservations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + orderItems = {}>(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. @@ -2862,6 +3214,54 @@ export type Product$salesInvoiceItemsArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + where?: Prisma.StockReservationWhereInput + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + cursor?: Prisma.StockReservationWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[] +} + +/** + * Product.orderItems + */ +export type Product$orderItemsArgs = { + /** + * Select specific fields to fetch from the OrderItem + */ + select?: Prisma.OrderItemSelect | null + /** + * Omit specific fields from the OrderItem + */ + omit?: Prisma.OrderItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.OrderItemInclude | null + where?: Prisma.OrderItemWhereInput + orderBy?: Prisma.OrderItemOrderByWithRelationInput | Prisma.OrderItemOrderByWithRelationInput[] + cursor?: Prisma.OrderItemWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] +} + /** * Product without action */ diff --git a/src/generated/prisma/models/PurchaseReceiptItem.ts b/src/generated/prisma/models/PurchaseReceiptItem.ts index 5a3a316..6185643 100644 --- a/src/generated/prisma/models/PurchaseReceiptItem.ts +++ b/src/generated/prisma/models/PurchaseReceiptItem.ts @@ -29,8 +29,8 @@ export type AggregatePurchaseReceiptItem = { export type PurchaseReceiptItemAvgAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null receiptId: number | null productId: number | null } @@ -38,8 +38,8 @@ export type PurchaseReceiptItemAvgAggregateOutputType = { export type PurchaseReceiptItemSumAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null receiptId: number | null productId: number | null } @@ -47,8 +47,8 @@ export type PurchaseReceiptItemSumAggregateOutputType = { export type PurchaseReceiptItemMinAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null receiptId: number | null productId: number | null description: string | null @@ -58,8 +58,8 @@ export type PurchaseReceiptItemMinAggregateOutputType = { export type PurchaseReceiptItemMaxAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null receiptId: number | null productId: number | null description: string | null @@ -69,8 +69,8 @@ export type PurchaseReceiptItemMaxAggregateOutputType = { export type PurchaseReceiptItemCountAggregateOutputType = { id: number count: number - fee: number - total: number + unitPrice: number + totalAmount: number receiptId: number productId: number description: number @@ -82,8 +82,8 @@ export type PurchaseReceiptItemCountAggregateOutputType = { export type PurchaseReceiptItemAvgAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true receiptId?: true productId?: true } @@ -91,8 +91,8 @@ export type PurchaseReceiptItemAvgAggregateInputType = { export type PurchaseReceiptItemSumAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true receiptId?: true productId?: true } @@ -100,8 +100,8 @@ export type PurchaseReceiptItemSumAggregateInputType = { export type PurchaseReceiptItemMinAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true receiptId?: true productId?: true description?: true @@ -111,8 +111,8 @@ export type PurchaseReceiptItemMinAggregateInputType = { export type PurchaseReceiptItemMaxAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true receiptId?: true productId?: true description?: true @@ -122,8 +122,8 @@ export type PurchaseReceiptItemMaxAggregateInputType = { export type PurchaseReceiptItemCountAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true receiptId?: true productId?: true description?: true @@ -220,8 +220,8 @@ export type PurchaseReceiptItemGroupByArgs | number count?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number productId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number description?: Prisma.StringNullableFilter<"PurchaseReceiptItem"> | string | null @@ -267,8 +267,8 @@ export type PurchaseReceiptItemWhereInput = { export type PurchaseReceiptItemOrderByWithRelationInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder @@ -284,8 +284,8 @@ export type PurchaseReceiptItemWhereUniqueInput = Prisma.AtLeast<{ OR?: Prisma.PurchaseReceiptItemWhereInput[] NOT?: Prisma.PurchaseReceiptItemWhereInput | Prisma.PurchaseReceiptItemWhereInput[] count?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number productId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number description?: Prisma.StringNullableFilter<"PurchaseReceiptItem"> | string | null @@ -297,8 +297,8 @@ export type PurchaseReceiptItemWhereUniqueInput = Prisma.AtLeast<{ export type PurchaseReceiptItemOrderByWithAggregationInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder @@ -316,8 +316,8 @@ export type PurchaseReceiptItemScalarWhereWithAggregatesInput = { NOT?: Prisma.PurchaseReceiptItemScalarWhereWithAggregatesInput | Prisma.PurchaseReceiptItemScalarWhereWithAggregatesInput[] id?: Prisma.IntWithAggregatesFilter<"PurchaseReceiptItem"> | number count?: Prisma.DecimalWithAggregatesFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalWithAggregatesFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalWithAggregatesFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalWithAggregatesFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalWithAggregatesFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntWithAggregatesFilter<"PurchaseReceiptItem"> | number productId?: Prisma.IntWithAggregatesFilter<"PurchaseReceiptItem"> | number description?: Prisma.StringNullableWithAggregatesFilter<"PurchaseReceiptItem"> | string | null @@ -326,8 +326,8 @@ export type PurchaseReceiptItemScalarWhereWithAggregatesInput = { export type PurchaseReceiptItemCreateInput = { count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string product: Prisma.ProductCreateNestedOneWithoutPurchaseReceiptItemsInput @@ -337,8 +337,8 @@ export type PurchaseReceiptItemCreateInput = { export type PurchaseReceiptItemUncheckedCreateInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string receiptId: number productId: number description?: string | null @@ -347,8 +347,8 @@ export type PurchaseReceiptItemUncheckedCreateInput = { export type PurchaseReceiptItemUpdateInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string product?: Prisma.ProductUpdateOneRequiredWithoutPurchaseReceiptItemsNestedInput @@ -358,8 +358,8 @@ export type PurchaseReceiptItemUpdateInput = { export type PurchaseReceiptItemUncheckedUpdateInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -369,8 +369,8 @@ export type PurchaseReceiptItemUncheckedUpdateInput = { export type PurchaseReceiptItemCreateManyInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string receiptId: number productId: number description?: string | null @@ -379,8 +379,8 @@ export type PurchaseReceiptItemCreateManyInput = { export type PurchaseReceiptItemUpdateManyMutationInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string } @@ -388,8 +388,8 @@ export type PurchaseReceiptItemUpdateManyMutationInput = { export type PurchaseReceiptItemUncheckedUpdateManyInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -415,8 +415,8 @@ export type PurchaseReceiptItemOrderByRelevanceInput = { export type PurchaseReceiptItemCountOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder description?: Prisma.SortOrder @@ -426,8 +426,8 @@ export type PurchaseReceiptItemCountOrderByAggregateInput = { export type PurchaseReceiptItemAvgOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder } @@ -435,8 +435,8 @@ export type PurchaseReceiptItemAvgOrderByAggregateInput = { export type PurchaseReceiptItemMaxOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder description?: Prisma.SortOrder @@ -446,8 +446,8 @@ export type PurchaseReceiptItemMaxOrderByAggregateInput = { export type PurchaseReceiptItemMinOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder description?: Prisma.SortOrder @@ -457,8 +457,8 @@ export type PurchaseReceiptItemMinOrderByAggregateInput = { export type PurchaseReceiptItemSumOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder receiptId?: Prisma.SortOrder productId?: Prisma.SortOrder } @@ -549,8 +549,8 @@ export type PurchaseReceiptItemUncheckedUpdateManyWithoutReceiptNestedInput = { export type PurchaseReceiptItemCreateWithoutProductInput = { count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string receipt: Prisma.PurchaseReceiptCreateNestedOneWithoutItemsInput @@ -559,8 +559,8 @@ export type PurchaseReceiptItemCreateWithoutProductInput = { export type PurchaseReceiptItemUncheckedCreateWithoutProductInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string receiptId: number description?: string | null createdAt?: Date | string @@ -598,8 +598,8 @@ export type PurchaseReceiptItemScalarWhereInput = { NOT?: Prisma.PurchaseReceiptItemScalarWhereInput | Prisma.PurchaseReceiptItemScalarWhereInput[] id?: Prisma.IntFilter<"PurchaseReceiptItem"> | number count?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"PurchaseReceiptItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number productId?: Prisma.IntFilter<"PurchaseReceiptItem"> | number description?: Prisma.StringNullableFilter<"PurchaseReceiptItem"> | string | null @@ -608,8 +608,8 @@ export type PurchaseReceiptItemScalarWhereInput = { export type PurchaseReceiptItemCreateWithoutReceiptInput = { count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string product: Prisma.ProductCreateNestedOneWithoutPurchaseReceiptItemsInput @@ -618,8 +618,8 @@ export type PurchaseReceiptItemCreateWithoutReceiptInput = { export type PurchaseReceiptItemUncheckedCreateWithoutReceiptInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string productId: number description?: string | null createdAt?: Date | string @@ -654,8 +654,8 @@ export type PurchaseReceiptItemUpdateManyWithWhereWithoutReceiptInput = { export type PurchaseReceiptItemCreateManyProductInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string receiptId: number description?: string | null createdAt?: Date | string @@ -663,8 +663,8 @@ export type PurchaseReceiptItemCreateManyProductInput = { export type PurchaseReceiptItemUpdateWithoutProductInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string receipt?: Prisma.PurchaseReceiptUpdateOneRequiredWithoutItemsNestedInput @@ -673,8 +673,8 @@ export type PurchaseReceiptItemUpdateWithoutProductInput = { export type PurchaseReceiptItemUncheckedUpdateWithoutProductInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -683,8 +683,8 @@ export type PurchaseReceiptItemUncheckedUpdateWithoutProductInput = { export type PurchaseReceiptItemUncheckedUpdateManyWithoutProductInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string receiptId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -693,8 +693,8 @@ export type PurchaseReceiptItemUncheckedUpdateManyWithoutProductInput = { export type PurchaseReceiptItemCreateManyReceiptInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string productId: number description?: string | null createdAt?: Date | string @@ -702,8 +702,8 @@ export type PurchaseReceiptItemCreateManyReceiptInput = { export type PurchaseReceiptItemUpdateWithoutReceiptInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string product?: Prisma.ProductUpdateOneRequiredWithoutPurchaseReceiptItemsNestedInput @@ -712,8 +712,8 @@ export type PurchaseReceiptItemUpdateWithoutReceiptInput = { export type PurchaseReceiptItemUncheckedUpdateWithoutReceiptInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string productId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -722,8 +722,8 @@ export type PurchaseReceiptItemUncheckedUpdateWithoutReceiptInput = { export type PurchaseReceiptItemUncheckedUpdateManyWithoutReceiptInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string productId?: Prisma.IntFieldUpdateOperationsInput | number description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string @@ -734,8 +734,8 @@ export type PurchaseReceiptItemUncheckedUpdateManyWithoutReceiptInput = { export type PurchaseReceiptItemSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean count?: boolean - fee?: boolean - total?: boolean + unitPrice?: boolean + totalAmount?: boolean receiptId?: boolean productId?: boolean description?: boolean @@ -749,15 +749,15 @@ export type PurchaseReceiptItemSelect = runtime.Types.Extensions.GetOmit<"id" | "count" | "fee" | "total" | "receiptId" | "productId" | "description" | "createdAt", ExtArgs["result"]["purchaseReceiptItem"]> +export type PurchaseReceiptItemOmit = runtime.Types.Extensions.GetOmit<"id" | "count" | "unitPrice" | "totalAmount" | "receiptId" | "productId" | "description" | "createdAt", ExtArgs["result"]["purchaseReceiptItem"]> export type PurchaseReceiptItemInclude = { product?: boolean | Prisma.ProductDefaultArgs receipt?: boolean | Prisma.PurchaseReceiptDefaultArgs @@ -772,8 +772,8 @@ export type $PurchaseReceiptItemPayload readonly count: Prisma.FieldRef<"PurchaseReceiptItem", 'Decimal'> - readonly fee: Prisma.FieldRef<"PurchaseReceiptItem", 'Decimal'> - readonly total: Prisma.FieldRef<"PurchaseReceiptItem", 'Decimal'> + readonly unitPrice: Prisma.FieldRef<"PurchaseReceiptItem", 'Decimal'> + readonly totalAmount: Prisma.FieldRef<"PurchaseReceiptItem", 'Decimal'> readonly receiptId: Prisma.FieldRef<"PurchaseReceiptItem", 'Int'> readonly productId: Prisma.FieldRef<"PurchaseReceiptItem", 'Int'> readonly description: Prisma.FieldRef<"PurchaseReceiptItem", 'String'> diff --git a/src/generated/prisma/models/PurchaseReceiptPayments.ts b/src/generated/prisma/models/PurchaseReceiptPayments.ts index cf0b347..58f6323 100644 --- a/src/generated/prisma/models/PurchaseReceiptPayments.ts +++ b/src/generated/prisma/models/PurchaseReceiptPayments.ts @@ -654,6 +654,10 @@ export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutReceiptNestedInput deleteMany?: Prisma.PurchaseReceiptPaymentsScalarWhereInput | Prisma.PurchaseReceiptPaymentsScalarWhereInput[] } +export type EnumPaymentMethodTypeFieldUpdateOperationsInput = { + set?: $Enums.PaymentMethodType +} + export type EnumPaymentTypeFieldUpdateOperationsInput = { set?: $Enums.PaymentType } diff --git a/src/generated/prisma/models/SalesInvoice.ts b/src/generated/prisma/models/SalesInvoice.ts index b7366ce..43912de 100644 --- a/src/generated/prisma/models/SalesInvoice.ts +++ b/src/generated/prisma/models/SalesInvoice.ts @@ -252,9 +252,10 @@ export type SalesInvoiceWhereInput = { updatedAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableFilter<"SalesInvoice"> | number | null posAccountId?: Prisma.IntFilter<"SalesInvoice"> | number - items?: Prisma.SalesInvoiceItemListRelationFilter customer?: Prisma.XOR | null posAccount?: Prisma.XOR + items?: Prisma.SalesInvoiceItemListRelationFilter + salesInvoicePayments?: Prisma.SalesInvoicePaymentListRelationFilter } export type SalesInvoiceOrderByWithRelationInput = { @@ -266,9 +267,10 @@ export type SalesInvoiceOrderByWithRelationInput = { updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrderInput | Prisma.SortOrder posAccountId?: Prisma.SortOrder - items?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput customer?: Prisma.CustomerOrderByWithRelationInput posAccount?: Prisma.PosAccountOrderByWithRelationInput + items?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentOrderByRelationAggregateInput _relevance?: Prisma.SalesInvoiceOrderByRelevanceInput } @@ -284,9 +286,10 @@ export type SalesInvoiceWhereUniqueInput = Prisma.AtLeast<{ updatedAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableFilter<"SalesInvoice"> | number | null posAccountId?: Prisma.IntFilter<"SalesInvoice"> | number - items?: Prisma.SalesInvoiceItemListRelationFilter customer?: Prisma.XOR | null posAccount?: Prisma.XOR + items?: Prisma.SalesInvoiceItemListRelationFilter + salesInvoicePayments?: Prisma.SalesInvoicePaymentListRelationFilter }, "id" | "code"> export type SalesInvoiceOrderByWithAggregationInput = { @@ -325,9 +328,10 @@ export type SalesInvoiceCreateInput = { description?: string | null createdAt?: Date | string updatedAt?: Date | string - items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput + items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateInput = { @@ -340,6 +344,7 @@ export type SalesInvoiceUncheckedCreateInput = { customerId?: number | null posAccountId: number items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUpdateInput = { @@ -348,9 +353,10 @@ export type SalesInvoiceUpdateInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput + items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateInput = { @@ -363,6 +369,7 @@ export type SalesInvoiceUncheckedUpdateInput = { customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null posAccountId?: Prisma.IntFieldUpdateOperationsInput | number items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceCreateManyInput = { @@ -547,14 +554,6 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput = { deleteMany?: Prisma.SalesInvoiceScalarWhereInput | Prisma.SalesInvoiceScalarWhereInput[] } -export type NullableIntFieldUpdateOperationsInput = { - set?: number | null - increment?: number - decrement?: number - multiply?: number - divide?: number -} - export type SalesInvoiceCreateNestedOneWithoutItemsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutItemsInput @@ -569,14 +568,29 @@ export type SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput = { update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutItemsInput> } +export type SalesInvoiceCreateNestedOneWithoutSalesInvoicePaymentsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutSalesInvoicePaymentsInput + connect?: Prisma.SalesInvoiceWhereUniqueInput +} + +export type SalesInvoiceUpdateOneRequiredWithoutSalesInvoicePaymentsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutSalesInvoicePaymentsInput + upsert?: Prisma.SalesInvoiceUpsertWithoutSalesInvoicePaymentsInput + connect?: Prisma.SalesInvoiceWhereUniqueInput + update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutSalesInvoicePaymentsInput> +} + export type SalesInvoiceCreateWithoutPosAccountInput = { code: string totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null createdAt?: Date | string updatedAt?: Date | string - items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput + items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateWithoutPosAccountInput = { @@ -588,6 +602,7 @@ export type SalesInvoiceUncheckedCreateWithoutPosAccountInput = { updatedAt?: Date | string customerId?: number | null items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceCreateOrConnectWithoutPosAccountInput = { @@ -636,8 +651,9 @@ export type SalesInvoiceCreateWithoutCustomerInput = { description?: string | null createdAt?: Date | string updatedAt?: Date | string - items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput + items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateWithoutCustomerInput = { @@ -649,6 +665,7 @@ export type SalesInvoiceUncheckedCreateWithoutCustomerInput = { updatedAt?: Date | string posAccountId: number items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceCreateOrConnectWithoutCustomerInput = { @@ -685,6 +702,7 @@ export type SalesInvoiceCreateWithoutItemsInput = { updatedAt?: Date | string customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateWithoutItemsInput = { @@ -696,6 +714,7 @@ export type SalesInvoiceUncheckedCreateWithoutItemsInput = { updatedAt?: Date | string customerId?: number | null posAccountId: number + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceCreateOrConnectWithoutItemsInput = { @@ -722,6 +741,7 @@ export type SalesInvoiceUpdateWithoutItemsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateWithoutItemsInput = { @@ -733,6 +753,69 @@ export type SalesInvoiceUncheckedUpdateWithoutItemsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null posAccountId?: Prisma.IntFieldUpdateOperationsInput | number + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput +} + +export type SalesInvoiceCreateWithoutSalesInvoicePaymentsInput = { + code: string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput + posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput + items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput +} + +export type SalesInvoiceUncheckedCreateWithoutSalesInvoicePaymentsInput = { + id?: number + code: string + totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + customerId?: number | null + posAccountId: number + items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput +} + +export type SalesInvoiceCreateOrConnectWithoutSalesInvoicePaymentsInput = { + where: Prisma.SalesInvoiceWhereUniqueInput + create: Prisma.XOR +} + +export type SalesInvoiceUpsertWithoutSalesInvoicePaymentsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.SalesInvoiceWhereInput +} + +export type SalesInvoiceUpdateToOneWithWhereWithoutSalesInvoicePaymentsInput = { + where?: Prisma.SalesInvoiceWhereInput + data: Prisma.XOR +} + +export type SalesInvoiceUpdateWithoutSalesInvoicePaymentsInput = { + code?: Prisma.StringFieldUpdateOperationsInput | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput + posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput + items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput +} + +export type SalesInvoiceUncheckedUpdateWithoutSalesInvoicePaymentsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + code?: Prisma.StringFieldUpdateOperationsInput | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number + items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceCreateManyPosAccountInput = { @@ -751,8 +834,9 @@ export type SalesInvoiceUpdateWithoutPosAccountInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput + items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateWithoutPosAccountInput = { @@ -764,6 +848,7 @@ export type SalesInvoiceUncheckedUpdateWithoutPosAccountInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateManyWithoutPosAccountInput = { @@ -792,8 +877,9 @@ export type SalesInvoiceUpdateWithoutCustomerInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput + items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateWithoutCustomerInput = { @@ -805,6 +891,7 @@ export type SalesInvoiceUncheckedUpdateWithoutCustomerInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string posAccountId?: Prisma.IntFieldUpdateOperationsInput | number items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput + salesInvoicePayments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateManyWithoutCustomerInput = { @@ -824,10 +911,12 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerInput = { export type SalesInvoiceCountOutputType = { items: number + salesInvoicePayments: number } export type SalesInvoiceCountOutputTypeSelect = { items?: boolean | SalesInvoiceCountOutputTypeCountItemsArgs + salesInvoicePayments?: boolean | SalesInvoiceCountOutputTypeCountSalesInvoicePaymentsArgs } /** @@ -847,6 +936,13 @@ export type SalesInvoiceCountOutputTypeCountItemsArgs = { + where?: Prisma.SalesInvoicePaymentWhereInput +} + export type SalesInvoiceSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -857,9 +953,10 @@ export type SalesInvoiceSelect customer?: boolean | Prisma.SalesInvoice$customerArgs posAccount?: boolean | Prisma.PosAccountDefaultArgs + items?: boolean | Prisma.SalesInvoice$itemsArgs + salesInvoicePayments?: boolean | Prisma.SalesInvoice$salesInvoicePaymentsArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs }, ExtArgs["result"]["salesInvoice"]> @@ -878,18 +975,20 @@ export type SalesInvoiceSelectScalar = { export type SalesInvoiceOmit = runtime.Types.Extensions.GetOmit<"id" | "code" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "customerId" | "posAccountId", ExtArgs["result"]["salesInvoice"]> export type SalesInvoiceInclude = { - items?: boolean | Prisma.SalesInvoice$itemsArgs customer?: boolean | Prisma.SalesInvoice$customerArgs posAccount?: boolean | Prisma.PosAccountDefaultArgs + items?: boolean | Prisma.SalesInvoice$itemsArgs + salesInvoicePayments?: boolean | Prisma.SalesInvoice$salesInvoicePaymentsArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs } export type $SalesInvoicePayload = { name: "SalesInvoice" objects: { - items: Prisma.$SalesInvoiceItemPayload[] customer: Prisma.$CustomerPayload | null posAccount: Prisma.$PosAccountPayload + items: Prisma.$SalesInvoiceItemPayload[] + salesInvoicePayments: Prisma.$SalesInvoicePaymentPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1240,9 +1339,10 @@ readonly fields: SalesInvoiceFieldRefs; */ export interface Prisma__SalesInvoiceClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - items = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> posAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__PosAccountClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + items = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + salesInvoicePayments = {}>(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. @@ -1622,6 +1722,25 @@ export type SalesInvoiceDeleteManyArgs = { + /** + * 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 +} + /** * SalesInvoice.items */ @@ -1647,22 +1766,27 @@ export type SalesInvoice$itemsArgs = { +export type SalesInvoice$salesInvoicePaymentsArgs = { /** - * Select specific fields to fetch from the Customer + * Select specific fields to fetch from the SalesInvoicePayment */ - select?: Prisma.CustomerSelect | null + select?: Prisma.SalesInvoicePaymentSelect | null /** - * Omit specific fields from the Customer + * Omit specific fields from the SalesInvoicePayment */ - omit?: Prisma.CustomerOmit | null + omit?: Prisma.SalesInvoicePaymentOmit | null /** * Choose, which related nodes to fetch as well */ - include?: Prisma.CustomerInclude | null - where?: Prisma.CustomerWhereInput + include?: Prisma.SalesInvoicePaymentInclude | null + where?: Prisma.SalesInvoicePaymentWhereInput + orderBy?: Prisma.SalesInvoicePaymentOrderByWithRelationInput | Prisma.SalesInvoicePaymentOrderByWithRelationInput[] + cursor?: Prisma.SalesInvoicePaymentWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.SalesInvoicePaymentScalarFieldEnum | Prisma.SalesInvoicePaymentScalarFieldEnum[] } /** diff --git a/src/generated/prisma/models/SalesInvoiceItem.ts b/src/generated/prisma/models/SalesInvoiceItem.ts index 1cbe42a..61a14e5 100644 --- a/src/generated/prisma/models/SalesInvoiceItem.ts +++ b/src/generated/prisma/models/SalesInvoiceItem.ts @@ -29,8 +29,8 @@ export type AggregateSalesInvoiceItem = { export type SalesInvoiceItemAvgAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null invoiceId: number | null productId: number | null } @@ -38,8 +38,8 @@ export type SalesInvoiceItemAvgAggregateOutputType = { export type SalesInvoiceItemSumAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null invoiceId: number | null productId: number | null } @@ -47,8 +47,8 @@ export type SalesInvoiceItemSumAggregateOutputType = { export type SalesInvoiceItemMinAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null createdAt: Date | null invoiceId: number | null productId: number | null @@ -57,8 +57,8 @@ export type SalesInvoiceItemMinAggregateOutputType = { export type SalesInvoiceItemMaxAggregateOutputType = { id: number | null count: runtime.Decimal | null - fee: runtime.Decimal | null - total: runtime.Decimal | null + unitPrice: runtime.Decimal | null + totalAmount: runtime.Decimal | null createdAt: Date | null invoiceId: number | null productId: number | null @@ -67,8 +67,8 @@ export type SalesInvoiceItemMaxAggregateOutputType = { export type SalesInvoiceItemCountAggregateOutputType = { id: number count: number - fee: number - total: number + unitPrice: number + totalAmount: number createdAt: number invoiceId: number productId: number @@ -79,8 +79,8 @@ export type SalesInvoiceItemCountAggregateOutputType = { export type SalesInvoiceItemAvgAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true invoiceId?: true productId?: true } @@ -88,8 +88,8 @@ export type SalesInvoiceItemAvgAggregateInputType = { export type SalesInvoiceItemSumAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true invoiceId?: true productId?: true } @@ -97,8 +97,8 @@ export type SalesInvoiceItemSumAggregateInputType = { export type SalesInvoiceItemMinAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true createdAt?: true invoiceId?: true productId?: true @@ -107,8 +107,8 @@ export type SalesInvoiceItemMinAggregateInputType = { export type SalesInvoiceItemMaxAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true createdAt?: true invoiceId?: true productId?: true @@ -117,8 +117,8 @@ export type SalesInvoiceItemMaxAggregateInputType = { export type SalesInvoiceItemCountAggregateInputType = { id?: true count?: true - fee?: true - total?: true + unitPrice?: true + totalAmount?: true createdAt?: true invoiceId?: true productId?: true @@ -214,8 +214,8 @@ export type SalesInvoiceItemGroupByArgs | number count?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string invoiceId?: Prisma.IntFilter<"SalesInvoiceItem"> | number productId?: Prisma.IntFilter<"SalesInvoiceItem"> | number @@ -259,8 +259,8 @@ export type SalesInvoiceItemWhereInput = { export type SalesInvoiceItemOrderByWithRelationInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder createdAt?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder @@ -274,8 +274,8 @@ export type SalesInvoiceItemWhereUniqueInput = Prisma.AtLeast<{ OR?: Prisma.SalesInvoiceItemWhereInput[] NOT?: Prisma.SalesInvoiceItemWhereInput | Prisma.SalesInvoiceItemWhereInput[] count?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string invoiceId?: Prisma.IntFilter<"SalesInvoiceItem"> | number productId?: Prisma.IntFilter<"SalesInvoiceItem"> | number @@ -286,8 +286,8 @@ export type SalesInvoiceItemWhereUniqueInput = Prisma.AtLeast<{ export type SalesInvoiceItemOrderByWithAggregationInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder createdAt?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder @@ -304,8 +304,8 @@ export type SalesInvoiceItemScalarWhereWithAggregatesInput = { NOT?: Prisma.SalesInvoiceItemScalarWhereWithAggregatesInput | Prisma.SalesInvoiceItemScalarWhereWithAggregatesInput[] id?: Prisma.IntWithAggregatesFilter<"SalesInvoiceItem"> | number count?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoiceItem"> | Date | string invoiceId?: Prisma.IntWithAggregatesFilter<"SalesInvoiceItem"> | number productId?: Prisma.IntWithAggregatesFilter<"SalesInvoiceItem"> | number @@ -313,8 +313,8 @@ export type SalesInvoiceItemScalarWhereWithAggregatesInput = { export type SalesInvoiceItemCreateInput = { count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoice: Prisma.SalesInvoiceCreateNestedOneWithoutItemsInput product: Prisma.ProductCreateNestedOneWithoutSalesInvoiceItemsInput @@ -323,8 +323,8 @@ export type SalesInvoiceItemCreateInput = { export type SalesInvoiceItemUncheckedCreateInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoiceId: number productId: number @@ -332,8 +332,8 @@ export type SalesInvoiceItemUncheckedCreateInput = { export type SalesInvoiceItemUpdateInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutSalesInvoiceItemsNestedInput @@ -342,8 +342,8 @@ export type SalesInvoiceItemUpdateInput = { export type SalesInvoiceItemUncheckedUpdateInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoiceId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number @@ -352,8 +352,8 @@ export type SalesInvoiceItemUncheckedUpdateInput = { export type SalesInvoiceItemCreateManyInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoiceId: number productId: number @@ -361,16 +361,16 @@ export type SalesInvoiceItemCreateManyInput = { export type SalesInvoiceItemUpdateManyMutationInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string } export type SalesInvoiceItemUncheckedUpdateManyInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoiceId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number @@ -389,8 +389,8 @@ export type SalesInvoiceItemOrderByRelationAggregateInput = { export type SalesInvoiceItemCountOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder createdAt?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder @@ -399,8 +399,8 @@ export type SalesInvoiceItemCountOrderByAggregateInput = { export type SalesInvoiceItemAvgOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder } @@ -408,8 +408,8 @@ export type SalesInvoiceItemAvgOrderByAggregateInput = { export type SalesInvoiceItemMaxOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder createdAt?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder @@ -418,8 +418,8 @@ export type SalesInvoiceItemMaxOrderByAggregateInput = { export type SalesInvoiceItemMinOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder createdAt?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder @@ -428,54 +428,12 @@ export type SalesInvoiceItemMinOrderByAggregateInput = { export type SalesInvoiceItemSumOrderByAggregateInput = { id?: Prisma.SortOrder count?: Prisma.SortOrder - fee?: Prisma.SortOrder - total?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder + totalAmount?: Prisma.SortOrder invoiceId?: Prisma.SortOrder productId?: Prisma.SortOrder } -export type SalesInvoiceItemCreateNestedManyWithoutInvoiceInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] - connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] - createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope - connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] -} - -export type SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] - connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] - createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope - connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] -} - -export type SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] - connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] - upsert?: Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput[] - createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope - set?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - disconnect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - delete?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - update?: Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput[] - updateMany?: Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput[] - deleteMany?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] -} - -export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] - connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] - upsert?: Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput[] - createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope - set?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - disconnect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - delete?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] - update?: Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput[] - updateMany?: Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput[] - deleteMany?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] -} - export type SalesInvoiceItemCreateNestedManyWithoutProductInput = { create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutProductInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutProductInput[] connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutProductInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutProductInput[] @@ -518,66 +476,52 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput = { deleteMany?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] } -export type SalesInvoiceItemCreateWithoutInvoiceInput = { - count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Date | string - product: Prisma.ProductCreateNestedOneWithoutSalesInvoiceItemsInput +export type SalesInvoiceItemCreateNestedManyWithoutInvoiceInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope + connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] } -export type SalesInvoiceItemUncheckedCreateWithoutInvoiceInput = { - id?: number - count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Date | string - productId: number +export type SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope + connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] } -export type SalesInvoiceItemCreateOrConnectWithoutInvoiceInput = { - where: Prisma.SalesInvoiceItemWhereUniqueInput - create: Prisma.XOR +export type SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] + upsert?: Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope + set?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + disconnect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + delete?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + update?: Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput[] + updateMany?: Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput[] + deleteMany?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] } -export type SalesInvoiceItemCreateManyInvoiceInputEnvelope = { - data: Prisma.SalesInvoiceItemCreateManyInvoiceInput | Prisma.SalesInvoiceItemCreateManyInvoiceInput[] - skipDuplicates?: boolean -} - -export type SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput = { - where: Prisma.SalesInvoiceItemWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput = { - where: Prisma.SalesInvoiceItemWhereUniqueInput - data: Prisma.XOR -} - -export type SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput = { - where: Prisma.SalesInvoiceItemScalarWhereInput - data: Prisma.XOR -} - -export type SalesInvoiceItemScalarWhereInput = { - AND?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] - OR?: Prisma.SalesInvoiceItemScalarWhereInput[] - NOT?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] - id?: Prisma.IntFilter<"SalesInvoiceItem"> | number - count?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string - invoiceId?: Prisma.IntFilter<"SalesInvoiceItem"> | number - productId?: Prisma.IntFilter<"SalesInvoiceItem"> | number +export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutInvoiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutInvoiceInput[] + upsert?: Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoiceItemCreateManyInvoiceInputEnvelope + set?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + disconnect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + delete?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + connect?: Prisma.SalesInvoiceItemWhereUniqueInput | Prisma.SalesInvoiceItemWhereUniqueInput[] + update?: Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput[] + updateMany?: Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput[] + deleteMany?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] } export type SalesInvoiceItemCreateWithoutProductInput = { count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoice: Prisma.SalesInvoiceCreateNestedOneWithoutItemsInput } @@ -585,8 +529,8 @@ export type SalesInvoiceItemCreateWithoutProductInput = { export type SalesInvoiceItemUncheckedCreateWithoutProductInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoiceId: number } @@ -617,54 +561,75 @@ export type SalesInvoiceItemUpdateManyWithWhereWithoutProductInput = { data: Prisma.XOR } -export type SalesInvoiceItemCreateManyInvoiceInput = { +export type SalesInvoiceItemScalarWhereInput = { + AND?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] + OR?: Prisma.SalesInvoiceItemScalarWhereInput[] + NOT?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[] + id?: Prisma.IntFilter<"SalesInvoiceItem"> | number + count?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string + invoiceId?: Prisma.IntFilter<"SalesInvoiceItem"> | number + productId?: Prisma.IntFilter<"SalesInvoiceItem"> | number +} + +export type SalesInvoiceItemCreateWithoutInvoiceInput = { + count: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + product: Prisma.ProductCreateNestedOneWithoutSalesInvoiceItemsInput +} + +export type SalesInvoiceItemUncheckedCreateWithoutInvoiceInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string productId: number } -export type SalesInvoiceItemUpdateWithoutInvoiceInput = { - count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - product?: Prisma.ProductUpdateOneRequiredWithoutSalesInvoiceItemsNestedInput +export type SalesInvoiceItemCreateOrConnectWithoutInvoiceInput = { + where: Prisma.SalesInvoiceItemWhereUniqueInput + create: Prisma.XOR } -export type SalesInvoiceItemUncheckedUpdateWithoutInvoiceInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - productId?: Prisma.IntFieldUpdateOperationsInput | number +export type SalesInvoiceItemCreateManyInvoiceInputEnvelope = { + data: Prisma.SalesInvoiceItemCreateManyInvoiceInput | Prisma.SalesInvoiceItemCreateManyInvoiceInput[] + skipDuplicates?: boolean } -export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - productId?: Prisma.IntFieldUpdateOperationsInput | number +export type SalesInvoiceItemUpsertWithWhereUniqueWithoutInvoiceInput = { + where: Prisma.SalesInvoiceItemWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type SalesInvoiceItemUpdateWithWhereUniqueWithoutInvoiceInput = { + where: Prisma.SalesInvoiceItemWhereUniqueInput + data: Prisma.XOR +} + +export type SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput = { + where: Prisma.SalesInvoiceItemScalarWhereInput + data: Prisma.XOR } export type SalesInvoiceItemCreateManyProductInput = { id?: number count: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string - total: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Date | string invoiceId: number } export type SalesInvoiceItemUpdateWithoutProductInput = { count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput } @@ -672,8 +637,8 @@ export type SalesInvoiceItemUpdateWithoutProductInput = { export type SalesInvoiceItemUncheckedUpdateWithoutProductInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoiceId?: Prisma.IntFieldUpdateOperationsInput | number } @@ -681,19 +646,54 @@ export type SalesInvoiceItemUncheckedUpdateWithoutProductInput = { export type SalesInvoiceItemUncheckedUpdateManyWithoutProductInput = { id?: Prisma.IntFieldUpdateOperationsInput | number count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string invoiceId?: Prisma.IntFieldUpdateOperationsInput | number } +export type SalesInvoiceItemCreateManyInvoiceInput = { + id?: number + count: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Date | string + productId: number +} + +export type SalesInvoiceItemUpdateWithoutInvoiceInput = { + count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + product?: Prisma.ProductUpdateOneRequiredWithoutSalesInvoiceItemsNestedInput +} + +export type SalesInvoiceItemUncheckedUpdateWithoutInvoiceInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + count?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + export type SalesInvoiceItemSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean count?: boolean - fee?: boolean - total?: boolean + unitPrice?: boolean + totalAmount?: boolean createdAt?: boolean invoiceId?: boolean productId?: boolean @@ -706,14 +706,14 @@ export type SalesInvoiceItemSelect = runtime.Types.Extensions.GetOmit<"id" | "count" | "fee" | "total" | "createdAt" | "invoiceId" | "productId", ExtArgs["result"]["salesInvoiceItem"]> +export type SalesInvoiceItemOmit = runtime.Types.Extensions.GetOmit<"id" | "count" | "unitPrice" | "totalAmount" | "createdAt" | "invoiceId" | "productId", ExtArgs["result"]["salesInvoiceItem"]> export type SalesInvoiceItemInclude = { invoice?: boolean | Prisma.SalesInvoiceDefaultArgs product?: boolean | Prisma.ProductDefaultArgs @@ -728,8 +728,8 @@ export type $SalesInvoiceItemPayload readonly count: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> - readonly fee: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> - readonly total: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> + readonly unitPrice: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> + readonly totalAmount: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> readonly createdAt: Prisma.FieldRef<"SalesInvoiceItem", 'DateTime'> readonly invoiceId: Prisma.FieldRef<"SalesInvoiceItem", 'Int'> readonly productId: Prisma.FieldRef<"SalesInvoiceItem", 'Int'> diff --git a/src/generated/prisma/models/SalesInvoicePayment.ts b/src/generated/prisma/models/SalesInvoicePayment.ts new file mode 100644 index 0000000..72d10b7 --- /dev/null +++ b/src/generated/prisma/models/SalesInvoicePayment.ts @@ -0,0 +1,1295 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `SalesInvoicePayment` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model SalesInvoicePayment + * + */ +export type SalesInvoicePaymentModel = runtime.Types.Result.DefaultSelection + +export type AggregateSalesInvoicePayment = { + _count: SalesInvoicePaymentCountAggregateOutputType | null + _avg: SalesInvoicePaymentAvgAggregateOutputType | null + _sum: SalesInvoicePaymentSumAggregateOutputType | null + _min: SalesInvoicePaymentMinAggregateOutputType | null + _max: SalesInvoicePaymentMaxAggregateOutputType | null +} + +export type SalesInvoicePaymentAvgAggregateOutputType = { + id: number | null + invoiceId: number | null + amount: runtime.Decimal | null +} + +export type SalesInvoicePaymentSumAggregateOutputType = { + id: number | null + invoiceId: number | null + amount: runtime.Decimal | null +} + +export type SalesInvoicePaymentMinAggregateOutputType = { + id: number | null + invoiceId: number | null + amount: runtime.Decimal | null + paymentMethod: $Enums.PaymentMethodType | null + paidAt: Date | null + createdAt: Date | null +} + +export type SalesInvoicePaymentMaxAggregateOutputType = { + id: number | null + invoiceId: number | null + amount: runtime.Decimal | null + paymentMethod: $Enums.PaymentMethodType | null + paidAt: Date | null + createdAt: Date | null +} + +export type SalesInvoicePaymentCountAggregateOutputType = { + id: number + invoiceId: number + amount: number + paymentMethod: number + paidAt: number + createdAt: number + _all: number +} + + +export type SalesInvoicePaymentAvgAggregateInputType = { + id?: true + invoiceId?: true + amount?: true +} + +export type SalesInvoicePaymentSumAggregateInputType = { + id?: true + invoiceId?: true + amount?: true +} + +export type SalesInvoicePaymentMinAggregateInputType = { + id?: true + invoiceId?: true + amount?: true + paymentMethod?: true + paidAt?: true + createdAt?: true +} + +export type SalesInvoicePaymentMaxAggregateInputType = { + id?: true + invoiceId?: true + amount?: true + paymentMethod?: true + paidAt?: true + createdAt?: true +} + +export type SalesInvoicePaymentCountAggregateInputType = { + id?: true + invoiceId?: true + amount?: true + paymentMethod?: true + paidAt?: true + createdAt?: true + _all?: true +} + +export type SalesInvoicePaymentAggregateArgs = { + /** + * Filter which SalesInvoicePayment to aggregate. + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SalesInvoicePayments to fetch. + */ + orderBy?: Prisma.SalesInvoicePaymentOrderByWithRelationInput | Prisma.SalesInvoicePaymentOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.SalesInvoicePaymentWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SalesInvoicePayments from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SalesInvoicePayments. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned SalesInvoicePayments + **/ + _count?: true | SalesInvoicePaymentCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: SalesInvoicePaymentAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: SalesInvoicePaymentSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: SalesInvoicePaymentMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: SalesInvoicePaymentMaxAggregateInputType +} + +export type GetSalesInvoicePaymentAggregateType = { + [P in keyof T & keyof AggregateSalesInvoicePayment]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type SalesInvoicePaymentGroupByArgs = { + where?: Prisma.SalesInvoicePaymentWhereInput + orderBy?: Prisma.SalesInvoicePaymentOrderByWithAggregationInput | Prisma.SalesInvoicePaymentOrderByWithAggregationInput[] + by: Prisma.SalesInvoicePaymentScalarFieldEnum[] | Prisma.SalesInvoicePaymentScalarFieldEnum + having?: Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: SalesInvoicePaymentCountAggregateInputType | true + _avg?: SalesInvoicePaymentAvgAggregateInputType + _sum?: SalesInvoicePaymentSumAggregateInputType + _min?: SalesInvoicePaymentMinAggregateInputType + _max?: SalesInvoicePaymentMaxAggregateInputType +} + +export type SalesInvoicePaymentGroupByOutputType = { + id: number + invoiceId: number + amount: runtime.Decimal + paymentMethod: $Enums.PaymentMethodType + paidAt: Date + createdAt: Date + _count: SalesInvoicePaymentCountAggregateOutputType | null + _avg: SalesInvoicePaymentAvgAggregateOutputType | null + _sum: SalesInvoicePaymentSumAggregateOutputType | null + _min: SalesInvoicePaymentMinAggregateOutputType | null + _max: SalesInvoicePaymentMaxAggregateOutputType | null +} + +type GetSalesInvoicePaymentGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof SalesInvoicePaymentGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type SalesInvoicePaymentWhereInput = { + AND?: Prisma.SalesInvoicePaymentWhereInput | Prisma.SalesInvoicePaymentWhereInput[] + OR?: Prisma.SalesInvoicePaymentWhereInput[] + NOT?: Prisma.SalesInvoicePaymentWhereInput | Prisma.SalesInvoicePaymentWhereInput[] + id?: Prisma.IntFilter<"SalesInvoicePayment"> | number + invoiceId?: Prisma.IntFilter<"SalesInvoicePayment"> | number + amount?: Prisma.DecimalFilter<"SalesInvoicePayment"> | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"SalesInvoicePayment"> | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string + createdAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string + invoice?: Prisma.XOR +} + +export type SalesInvoicePaymentOrderByWithRelationInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder + paymentMethod?: Prisma.SortOrder + paidAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + invoice?: Prisma.SalesInvoiceOrderByWithRelationInput +} + +export type SalesInvoicePaymentWhereUniqueInput = Prisma.AtLeast<{ + id?: number + AND?: Prisma.SalesInvoicePaymentWhereInput | Prisma.SalesInvoicePaymentWhereInput[] + OR?: Prisma.SalesInvoicePaymentWhereInput[] + NOT?: Prisma.SalesInvoicePaymentWhereInput | Prisma.SalesInvoicePaymentWhereInput[] + invoiceId?: Prisma.IntFilter<"SalesInvoicePayment"> | number + amount?: Prisma.DecimalFilter<"SalesInvoicePayment"> | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"SalesInvoicePayment"> | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string + createdAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string + invoice?: Prisma.XOR +}, "id"> + +export type SalesInvoicePaymentOrderByWithAggregationInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder + paymentMethod?: Prisma.SortOrder + paidAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + _count?: Prisma.SalesInvoicePaymentCountOrderByAggregateInput + _avg?: Prisma.SalesInvoicePaymentAvgOrderByAggregateInput + _max?: Prisma.SalesInvoicePaymentMaxOrderByAggregateInput + _min?: Prisma.SalesInvoicePaymentMinOrderByAggregateInput + _sum?: Prisma.SalesInvoicePaymentSumOrderByAggregateInput +} + +export type SalesInvoicePaymentScalarWhereWithAggregatesInput = { + AND?: Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput | Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput[] + OR?: Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput[] + NOT?: Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput | Prisma.SalesInvoicePaymentScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"SalesInvoicePayment"> | number + invoiceId?: Prisma.IntWithAggregatesFilter<"SalesInvoicePayment"> | number + amount?: Prisma.DecimalWithAggregatesFilter<"SalesInvoicePayment"> | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeWithAggregatesFilter<"SalesInvoicePayment"> | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoicePayment"> | Date | string + createdAt?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoicePayment"> | Date | string +} + +export type SalesInvoicePaymentCreateInput = { + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string + invoice: Prisma.SalesInvoiceCreateNestedOneWithoutSalesInvoicePaymentsInput +} + +export type SalesInvoicePaymentUncheckedCreateInput = { + id?: number + invoiceId: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string +} + +export type SalesInvoicePaymentUpdateInput = { + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutSalesInvoicePaymentsNestedInput +} + +export type SalesInvoicePaymentUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + invoiceId?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SalesInvoicePaymentCreateManyInput = { + id?: number + invoiceId: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string +} + +export type SalesInvoicePaymentUpdateManyMutationInput = { + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SalesInvoicePaymentUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + invoiceId?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SalesInvoicePaymentListRelationFilter = { + every?: Prisma.SalesInvoicePaymentWhereInput + some?: Prisma.SalesInvoicePaymentWhereInput + none?: Prisma.SalesInvoicePaymentWhereInput +} + +export type SalesInvoicePaymentOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type SalesInvoicePaymentCountOrderByAggregateInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder + paymentMethod?: Prisma.SortOrder + paidAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type SalesInvoicePaymentAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder +} + +export type SalesInvoicePaymentMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder + paymentMethod?: Prisma.SortOrder + paidAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type SalesInvoicePaymentMinOrderByAggregateInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder + paymentMethod?: Prisma.SortOrder + paidAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type SalesInvoicePaymentSumOrderByAggregateInput = { + id?: Prisma.SortOrder + invoiceId?: Prisma.SortOrder + amount?: Prisma.SortOrder +} + +export type SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput = { + create?: Prisma.XOR | Prisma.SalesInvoicePaymentCreateWithoutInvoiceInput[] | Prisma.SalesInvoicePaymentUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoicePaymentCreateManyInvoiceInputEnvelope + connect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] +} + +export type SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput = { + create?: Prisma.XOR | Prisma.SalesInvoicePaymentCreateWithoutInvoiceInput[] | Prisma.SalesInvoicePaymentUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoicePaymentCreateManyInvoiceInputEnvelope + connect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] +} + +export type SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoicePaymentCreateWithoutInvoiceInput[] | Prisma.SalesInvoicePaymentUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput[] + upsert?: Prisma.SalesInvoicePaymentUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpsertWithWhereUniqueWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoicePaymentCreateManyInvoiceInputEnvelope + set?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + disconnect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + delete?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + connect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + update?: Prisma.SalesInvoicePaymentUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpdateWithWhereUniqueWithoutInvoiceInput[] + updateMany?: Prisma.SalesInvoicePaymentUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpdateManyWithWhereWithoutInvoiceInput[] + deleteMany?: Prisma.SalesInvoicePaymentScalarWhereInput | Prisma.SalesInvoicePaymentScalarWhereInput[] +} + +export type SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoicePaymentCreateWithoutInvoiceInput[] | Prisma.SalesInvoicePaymentUncheckedCreateWithoutInvoiceInput[] + connectOrCreate?: Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput | Prisma.SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput[] + upsert?: Prisma.SalesInvoicePaymentUpsertWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpsertWithWhereUniqueWithoutInvoiceInput[] + createMany?: Prisma.SalesInvoicePaymentCreateManyInvoiceInputEnvelope + set?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + disconnect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + delete?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + connect?: Prisma.SalesInvoicePaymentWhereUniqueInput | Prisma.SalesInvoicePaymentWhereUniqueInput[] + update?: Prisma.SalesInvoicePaymentUpdateWithWhereUniqueWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpdateWithWhereUniqueWithoutInvoiceInput[] + updateMany?: Prisma.SalesInvoicePaymentUpdateManyWithWhereWithoutInvoiceInput | Prisma.SalesInvoicePaymentUpdateManyWithWhereWithoutInvoiceInput[] + deleteMany?: Prisma.SalesInvoicePaymentScalarWhereInput | Prisma.SalesInvoicePaymentScalarWhereInput[] +} + +export type SalesInvoicePaymentCreateWithoutInvoiceInput = { + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string +} + +export type SalesInvoicePaymentUncheckedCreateWithoutInvoiceInput = { + id?: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string +} + +export type SalesInvoicePaymentCreateOrConnectWithoutInvoiceInput = { + where: Prisma.SalesInvoicePaymentWhereUniqueInput + create: Prisma.XOR +} + +export type SalesInvoicePaymentCreateManyInvoiceInputEnvelope = { + data: Prisma.SalesInvoicePaymentCreateManyInvoiceInput | Prisma.SalesInvoicePaymentCreateManyInvoiceInput[] + skipDuplicates?: boolean +} + +export type SalesInvoicePaymentUpsertWithWhereUniqueWithoutInvoiceInput = { + where: Prisma.SalesInvoicePaymentWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type SalesInvoicePaymentUpdateWithWhereUniqueWithoutInvoiceInput = { + where: Prisma.SalesInvoicePaymentWhereUniqueInput + data: Prisma.XOR +} + +export type SalesInvoicePaymentUpdateManyWithWhereWithoutInvoiceInput = { + where: Prisma.SalesInvoicePaymentScalarWhereInput + data: Prisma.XOR +} + +export type SalesInvoicePaymentScalarWhereInput = { + AND?: Prisma.SalesInvoicePaymentScalarWhereInput | Prisma.SalesInvoicePaymentScalarWhereInput[] + OR?: Prisma.SalesInvoicePaymentScalarWhereInput[] + NOT?: Prisma.SalesInvoicePaymentScalarWhereInput | Prisma.SalesInvoicePaymentScalarWhereInput[] + id?: Prisma.IntFilter<"SalesInvoicePayment"> | number + invoiceId?: Prisma.IntFilter<"SalesInvoicePayment"> | number + amount?: Prisma.DecimalFilter<"SalesInvoicePayment"> | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFilter<"SalesInvoicePayment"> | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string + createdAt?: Prisma.DateTimeFilter<"SalesInvoicePayment"> | Date | string +} + +export type SalesInvoicePaymentCreateManyInvoiceInput = { + id?: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + paidAt: Date | string + createdAt?: Date | string +} + +export type SalesInvoicePaymentUpdateWithoutInvoiceInput = { + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SalesInvoicePaymentUncheckedUpdateWithoutInvoiceInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + paidAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + + +export type SalesInvoicePaymentSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + invoiceId?: boolean + amount?: boolean + paymentMethod?: boolean + paidAt?: boolean + createdAt?: boolean + invoice?: boolean | Prisma.SalesInvoiceDefaultArgs +}, ExtArgs["result"]["salesInvoicePayment"]> + + + +export type SalesInvoicePaymentSelectScalar = { + id?: boolean + invoiceId?: boolean + amount?: boolean + paymentMethod?: boolean + paidAt?: boolean + createdAt?: boolean +} + +export type SalesInvoicePaymentOmit = runtime.Types.Extensions.GetOmit<"id" | "invoiceId" | "amount" | "paymentMethod" | "paidAt" | "createdAt", ExtArgs["result"]["salesInvoicePayment"]> +export type SalesInvoicePaymentInclude = { + invoice?: boolean | Prisma.SalesInvoiceDefaultArgs +} + +export type $SalesInvoicePaymentPayload = { + name: "SalesInvoicePayment" + objects: { + invoice: Prisma.$SalesInvoicePayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + invoiceId: number + amount: runtime.Decimal + paymentMethod: $Enums.PaymentMethodType + paidAt: Date + createdAt: Date + }, ExtArgs["result"]["salesInvoicePayment"]> + composites: {} +} + +export type SalesInvoicePaymentGetPayload = runtime.Types.Result.GetResult + +export type SalesInvoicePaymentCountArgs = + Omit & { + select?: SalesInvoicePaymentCountAggregateInputType | true + } + +export interface SalesInvoicePaymentDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['SalesInvoicePayment'], meta: { name: 'SalesInvoicePayment' } } + /** + * Find zero or one SalesInvoicePayment that matches the filter. + * @param {SalesInvoicePaymentFindUniqueArgs} args - Arguments to find a SalesInvoicePayment + * @example + * // Get one SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one SalesInvoicePayment that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {SalesInvoicePaymentFindUniqueOrThrowArgs} args - Arguments to find a SalesInvoicePayment + * @example + * // Get one SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first SalesInvoicePayment that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentFindFirstArgs} args - Arguments to find a SalesInvoicePayment + * @example + * // Get one SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first SalesInvoicePayment that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentFindFirstOrThrowArgs} args - Arguments to find a SalesInvoicePayment + * @example + * // Get one SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more SalesInvoicePayments that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all SalesInvoicePayments + * const salesInvoicePayments = await prisma.salesInvoicePayment.findMany() + * + * // Get first 10 SalesInvoicePayments + * const salesInvoicePayments = await prisma.salesInvoicePayment.findMany({ take: 10 }) + * + * // Only select the `id` + * const salesInvoicePaymentWithIdOnly = await prisma.salesInvoicePayment.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a SalesInvoicePayment. + * @param {SalesInvoicePaymentCreateArgs} args - Arguments to create a SalesInvoicePayment. + * @example + * // Create one SalesInvoicePayment + * const SalesInvoicePayment = await prisma.salesInvoicePayment.create({ + * data: { + * // ... data to create a SalesInvoicePayment + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many SalesInvoicePayments. + * @param {SalesInvoicePaymentCreateManyArgs} args - Arguments to create many SalesInvoicePayments. + * @example + * // Create many SalesInvoicePayments + * const salesInvoicePayment = await prisma.salesInvoicePayment.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a SalesInvoicePayment. + * @param {SalesInvoicePaymentDeleteArgs} args - Arguments to delete one SalesInvoicePayment. + * @example + * // Delete one SalesInvoicePayment + * const SalesInvoicePayment = await prisma.salesInvoicePayment.delete({ + * where: { + * // ... filter to delete one SalesInvoicePayment + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one SalesInvoicePayment. + * @param {SalesInvoicePaymentUpdateArgs} args - Arguments to update one SalesInvoicePayment. + * @example + * // Update one SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more SalesInvoicePayments. + * @param {SalesInvoicePaymentDeleteManyArgs} args - Arguments to filter SalesInvoicePayments to delete. + * @example + * // Delete a few SalesInvoicePayments + * const { count } = await prisma.salesInvoicePayment.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more SalesInvoicePayments. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many SalesInvoicePayments + * const salesInvoicePayment = await prisma.salesInvoicePayment.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one SalesInvoicePayment. + * @param {SalesInvoicePaymentUpsertArgs} args - Arguments to update or create a SalesInvoicePayment. + * @example + * // Update or create a SalesInvoicePayment + * const salesInvoicePayment = await prisma.salesInvoicePayment.upsert({ + * create: { + * // ... data to create a SalesInvoicePayment + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the SalesInvoicePayment we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__SalesInvoicePaymentClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of SalesInvoicePayments. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentCountArgs} args - Arguments to filter SalesInvoicePayments to count. + * @example + * // Count the number of SalesInvoicePayments + * const count = await prisma.salesInvoicePayment.count({ + * where: { + * // ... the filter for the SalesInvoicePayments we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a SalesInvoicePayment. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by SalesInvoicePayment. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SalesInvoicePaymentGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends SalesInvoicePaymentGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: SalesInvoicePaymentGroupByArgs['orderBy'] } + : { orderBy?: SalesInvoicePaymentGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetSalesInvoicePaymentGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the SalesInvoicePayment model + */ +readonly fields: SalesInvoicePaymentFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for SalesInvoicePayment. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__SalesInvoicePaymentClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + invoice = {}>(args?: Prisma.Subset>): Prisma.Prisma__SalesInvoiceClient, 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. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the SalesInvoicePayment model + */ +export interface SalesInvoicePaymentFieldRefs { + readonly id: Prisma.FieldRef<"SalesInvoicePayment", 'Int'> + readonly invoiceId: Prisma.FieldRef<"SalesInvoicePayment", 'Int'> + readonly amount: Prisma.FieldRef<"SalesInvoicePayment", 'Decimal'> + readonly paymentMethod: Prisma.FieldRef<"SalesInvoicePayment", 'PaymentMethodType'> + readonly paidAt: Prisma.FieldRef<"SalesInvoicePayment", 'DateTime'> + readonly createdAt: Prisma.FieldRef<"SalesInvoicePayment", 'DateTime'> +} + + +// Custom InputTypes +/** + * SalesInvoicePayment findUnique + */ +export type SalesInvoicePaymentFindUniqueArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter, which SalesInvoicePayment to fetch. + */ + where: Prisma.SalesInvoicePaymentWhereUniqueInput +} + +/** + * SalesInvoicePayment findUniqueOrThrow + */ +export type SalesInvoicePaymentFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter, which SalesInvoicePayment to fetch. + */ + where: Prisma.SalesInvoicePaymentWhereUniqueInput +} + +/** + * SalesInvoicePayment findFirst + */ +export type SalesInvoicePaymentFindFirstArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter, which SalesInvoicePayment to fetch. + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SalesInvoicePayments to fetch. + */ + orderBy?: Prisma.SalesInvoicePaymentOrderByWithRelationInput | Prisma.SalesInvoicePaymentOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for SalesInvoicePayments. + */ + cursor?: Prisma.SalesInvoicePaymentWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SalesInvoicePayments from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SalesInvoicePayments. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of SalesInvoicePayments. + */ + distinct?: Prisma.SalesInvoicePaymentScalarFieldEnum | Prisma.SalesInvoicePaymentScalarFieldEnum[] +} + +/** + * SalesInvoicePayment findFirstOrThrow + */ +export type SalesInvoicePaymentFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter, which SalesInvoicePayment to fetch. + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SalesInvoicePayments to fetch. + */ + orderBy?: Prisma.SalesInvoicePaymentOrderByWithRelationInput | Prisma.SalesInvoicePaymentOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for SalesInvoicePayments. + */ + cursor?: Prisma.SalesInvoicePaymentWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SalesInvoicePayments from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SalesInvoicePayments. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of SalesInvoicePayments. + */ + distinct?: Prisma.SalesInvoicePaymentScalarFieldEnum | Prisma.SalesInvoicePaymentScalarFieldEnum[] +} + +/** + * SalesInvoicePayment findMany + */ +export type SalesInvoicePaymentFindManyArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter, which SalesInvoicePayments to fetch. + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SalesInvoicePayments to fetch. + */ + orderBy?: Prisma.SalesInvoicePaymentOrderByWithRelationInput | Prisma.SalesInvoicePaymentOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing SalesInvoicePayments. + */ + cursor?: Prisma.SalesInvoicePaymentWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SalesInvoicePayments from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SalesInvoicePayments. + */ + skip?: number + distinct?: Prisma.SalesInvoicePaymentScalarFieldEnum | Prisma.SalesInvoicePaymentScalarFieldEnum[] +} + +/** + * SalesInvoicePayment create + */ +export type SalesInvoicePaymentCreateArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * The data needed to create a SalesInvoicePayment. + */ + data: Prisma.XOR +} + +/** + * SalesInvoicePayment createMany + */ +export type SalesInvoicePaymentCreateManyArgs = { + /** + * The data used to create many SalesInvoicePayments. + */ + data: Prisma.SalesInvoicePaymentCreateManyInput | Prisma.SalesInvoicePaymentCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * SalesInvoicePayment update + */ +export type SalesInvoicePaymentUpdateArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * The data needed to update a SalesInvoicePayment. + */ + data: Prisma.XOR + /** + * Choose, which SalesInvoicePayment to update. + */ + where: Prisma.SalesInvoicePaymentWhereUniqueInput +} + +/** + * SalesInvoicePayment updateMany + */ +export type SalesInvoicePaymentUpdateManyArgs = { + /** + * The data used to update SalesInvoicePayments. + */ + data: Prisma.XOR + /** + * Filter which SalesInvoicePayments to update + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * Limit how many SalesInvoicePayments to update. + */ + limit?: number +} + +/** + * SalesInvoicePayment upsert + */ +export type SalesInvoicePaymentUpsertArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * The filter to search for the SalesInvoicePayment to update in case it exists. + */ + where: Prisma.SalesInvoicePaymentWhereUniqueInput + /** + * In case the SalesInvoicePayment found by the `where` argument doesn't exist, create a new SalesInvoicePayment with this data. + */ + create: Prisma.XOR + /** + * In case the SalesInvoicePayment was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * SalesInvoicePayment delete + */ +export type SalesInvoicePaymentDeleteArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null + /** + * Filter which SalesInvoicePayment to delete. + */ + where: Prisma.SalesInvoicePaymentWhereUniqueInput +} + +/** + * SalesInvoicePayment deleteMany + */ +export type SalesInvoicePaymentDeleteManyArgs = { + /** + * Filter which SalesInvoicePayments to delete + */ + where?: Prisma.SalesInvoicePaymentWhereInput + /** + * Limit how many SalesInvoicePayments to delete. + */ + limit?: number +} + +/** + * SalesInvoicePayment without action + */ +export type SalesInvoicePaymentDefaultArgs = { + /** + * Select specific fields to fetch from the SalesInvoicePayment + */ + select?: Prisma.SalesInvoicePaymentSelect | null + /** + * Omit specific fields from the SalesInvoicePayment + */ + omit?: Prisma.SalesInvoicePaymentOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoicePaymentInclude | null +} diff --git a/src/generated/prisma/models/StockMovement.ts b/src/generated/prisma/models/StockMovement.ts index 44d1751..1447d58 100644 --- a/src/generated/prisma/models/StockMovement.ts +++ b/src/generated/prisma/models/StockMovement.ts @@ -29,7 +29,7 @@ export type AggregateStockMovement = { export type StockMovementAvgAggregateOutputType = { id: number | null quantity: runtime.Decimal | null - fee: runtime.Decimal | null + unitPrice: runtime.Decimal | null totalCost: runtime.Decimal | null productId: number | null inventoryId: number | null @@ -43,7 +43,7 @@ export type StockMovementAvgAggregateOutputType = { export type StockMovementSumAggregateOutputType = { id: number | null quantity: runtime.Decimal | null - fee: runtime.Decimal | null + unitPrice: runtime.Decimal | null totalCost: runtime.Decimal | null productId: number | null inventoryId: number | null @@ -58,7 +58,7 @@ export type StockMovementMinAggregateOutputType = { id: number | null type: $Enums.MovementType | null quantity: runtime.Decimal | null - fee: runtime.Decimal | null + unitPrice: runtime.Decimal | null totalCost: runtime.Decimal | null referenceType: $Enums.MovementReferenceType | null referenceId: string | null @@ -76,7 +76,7 @@ export type StockMovementMaxAggregateOutputType = { id: number | null type: $Enums.MovementType | null quantity: runtime.Decimal | null - fee: runtime.Decimal | null + unitPrice: runtime.Decimal | null totalCost: runtime.Decimal | null referenceType: $Enums.MovementReferenceType | null referenceId: string | null @@ -94,7 +94,7 @@ export type StockMovementCountAggregateOutputType = { id: number type: number quantity: number - fee: number + unitPrice: number totalCost: number referenceType: number referenceId: number @@ -113,7 +113,7 @@ export type StockMovementCountAggregateOutputType = { export type StockMovementAvgAggregateInputType = { id?: true quantity?: true - fee?: true + unitPrice?: true totalCost?: true productId?: true inventoryId?: true @@ -127,7 +127,7 @@ export type StockMovementAvgAggregateInputType = { export type StockMovementSumAggregateInputType = { id?: true quantity?: true - fee?: true + unitPrice?: true totalCost?: true productId?: true inventoryId?: true @@ -142,7 +142,7 @@ export type StockMovementMinAggregateInputType = { id?: true type?: true quantity?: true - fee?: true + unitPrice?: true totalCost?: true referenceType?: true referenceId?: true @@ -160,7 +160,7 @@ export type StockMovementMaxAggregateInputType = { id?: true type?: true quantity?: true - fee?: true + unitPrice?: true totalCost?: true referenceType?: true referenceId?: true @@ -178,7 +178,7 @@ export type StockMovementCountAggregateInputType = { id?: true type?: true quantity?: true - fee?: true + unitPrice?: true totalCost?: true referenceType?: true referenceId?: true @@ -283,7 +283,7 @@ export type StockMovementGroupByOutputType = { id: number type: $Enums.MovementType quantity: runtime.Decimal - fee: runtime.Decimal + unitPrice: runtime.Decimal totalCost: runtime.Decimal referenceType: $Enums.MovementReferenceType referenceId: string @@ -324,7 +324,7 @@ export type StockMovementWhereInput = { id?: Prisma.IntFilter<"StockMovement"> | number type?: Prisma.EnumMovementTypeFilter<"StockMovement"> | $Enums.MovementType quantity?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string totalCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string referenceType?: Prisma.EnumMovementReferenceTypeFilter<"StockMovement"> | $Enums.MovementReferenceType referenceId?: Prisma.StringFilter<"StockMovement"> | string @@ -347,7 +347,7 @@ export type StockMovementOrderByWithRelationInput = { id?: Prisma.SortOrder type?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder referenceType?: Prisma.SortOrder referenceId?: Prisma.SortOrder @@ -374,7 +374,7 @@ export type StockMovementWhereUniqueInput = Prisma.AtLeast<{ NOT?: Prisma.StockMovementWhereInput | Prisma.StockMovementWhereInput[] type?: Prisma.EnumMovementTypeFilter<"StockMovement"> | $Enums.MovementType quantity?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string totalCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string referenceType?: Prisma.EnumMovementReferenceTypeFilter<"StockMovement"> | $Enums.MovementReferenceType referenceId?: Prisma.StringFilter<"StockMovement"> | string @@ -397,7 +397,7 @@ export type StockMovementOrderByWithAggregationInput = { id?: Prisma.SortOrder type?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder referenceType?: Prisma.SortOrder referenceId?: Prisma.SortOrder @@ -423,7 +423,7 @@ export type StockMovementScalarWhereWithAggregatesInput = { id?: Prisma.IntWithAggregatesFilter<"StockMovement"> | number type?: Prisma.EnumMovementTypeWithAggregatesFilter<"StockMovement"> | $Enums.MovementType quantity?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string totalCost?: Prisma.DecimalWithAggregatesFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string referenceType?: Prisma.EnumMovementReferenceTypeWithAggregatesFilter<"StockMovement"> | $Enums.MovementReferenceType referenceId?: Prisma.StringWithAggregatesFilter<"StockMovement"> | string @@ -440,7 +440,7 @@ export type StockMovementScalarWhereWithAggregatesInput = { export type StockMovementCreateInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -458,7 +458,7 @@ export type StockMovementUncheckedCreateInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -475,7 +475,7 @@ export type StockMovementUncheckedCreateInput = { export type StockMovementUpdateInput = { type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: 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 @@ -493,7 +493,7 @@ export type StockMovementUncheckedUpdateInput = { 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 + unitPrice?: 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 @@ -511,7 +511,7 @@ export type StockMovementCreateManyInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -528,7 +528,7 @@ export type StockMovementCreateManyInput = { export type StockMovementUpdateManyMutationInput = { type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: 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 @@ -541,7 +541,7 @@ export type StockMovementUncheckedUpdateManyInput = { 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 + unitPrice?: 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 @@ -575,7 +575,7 @@ export type StockMovementCountOrderByAggregateInput = { id?: Prisma.SortOrder type?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder referenceType?: Prisma.SortOrder referenceId?: Prisma.SortOrder @@ -592,7 +592,7 @@ export type StockMovementCountOrderByAggregateInput = { export type StockMovementAvgOrderByAggregateInput = { id?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder productId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder @@ -607,7 +607,7 @@ export type StockMovementMaxOrderByAggregateInput = { id?: Prisma.SortOrder type?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder referenceType?: Prisma.SortOrder referenceId?: Prisma.SortOrder @@ -625,7 +625,7 @@ export type StockMovementMinOrderByAggregateInput = { id?: Prisma.SortOrder type?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder referenceType?: Prisma.SortOrder referenceId?: Prisma.SortOrder @@ -642,7 +642,7 @@ export type StockMovementMinOrderByAggregateInput = { export type StockMovementSumOrderByAggregateInput = { id?: Prisma.SortOrder quantity?: Prisma.SortOrder - fee?: Prisma.SortOrder + unitPrice?: Prisma.SortOrder totalCost?: Prisma.SortOrder productId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder @@ -874,7 +874,7 @@ export type StockMovementUncheckedUpdateManyWithoutSupplierNestedInput = { export type StockMovementCreateWithoutCounterInventoryInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -891,7 +891,7 @@ export type StockMovementUncheckedCreateWithoutCounterInventoryInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -917,7 +917,7 @@ export type StockMovementCreateManyCounterInventoryInputEnvelope = { export type StockMovementCreateWithoutInventoryInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -934,7 +934,7 @@ export type StockMovementUncheckedCreateWithoutInventoryInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -980,7 +980,7 @@ export type StockMovementScalarWhereInput = { id?: Prisma.IntFilter<"StockMovement"> | number type?: Prisma.EnumMovementTypeFilter<"StockMovement"> | $Enums.MovementType quantity?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string totalCost?: Prisma.DecimalFilter<"StockMovement"> | runtime.Decimal | runtime.DecimalJsLike | number | string referenceType?: Prisma.EnumMovementReferenceTypeFilter<"StockMovement"> | $Enums.MovementReferenceType referenceId?: Prisma.StringFilter<"StockMovement"> | string @@ -1013,7 +1013,7 @@ export type StockMovementUpdateManyWithWhereWithoutInventoryInput = { export type StockMovementCreateWithoutCustomerInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1030,7 +1030,7 @@ export type StockMovementUncheckedCreateWithoutCustomerInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1072,7 +1072,7 @@ export type StockMovementUpdateManyWithWhereWithoutCustomerInput = { export type StockMovementCreateWithoutProductInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1089,7 +1089,7 @@ export type StockMovementUncheckedCreateWithoutProductInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1131,7 +1131,7 @@ export type StockMovementUpdateManyWithWhereWithoutProductInput = { export type StockMovementCreateWithoutSupplierInput = { type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1148,7 +1148,7 @@ export type StockMovementUncheckedCreateWithoutSupplierInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1191,7 +1191,7 @@ export type StockMovementCreateManyCounterInventoryInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1208,7 +1208,7 @@ export type StockMovementCreateManyInventoryInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1224,7 +1224,7 @@ export type StockMovementCreateManyInventoryInput = { 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 + unitPrice?: 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 @@ -1241,7 +1241,7 @@ 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 + unitPrice?: 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 @@ -1258,7 +1258,7 @@ 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 + unitPrice?: 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 @@ -1274,7 +1274,7 @@ export type StockMovementUncheckedUpdateManyWithoutCounterInventoryInput = { export type StockMovementUpdateWithoutInventoryInput = { type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: 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 @@ -1291,7 +1291,7 @@ export type StockMovementUncheckedUpdateWithoutInventoryInput = { 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 + unitPrice?: 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 @@ -1308,7 +1308,7 @@ export type StockMovementUncheckedUpdateManyWithoutInventoryInput = { 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 + unitPrice?: 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 @@ -1325,7 +1325,7 @@ export type StockMovementCreateManyCustomerInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1341,7 +1341,7 @@ export type StockMovementCreateManyCustomerInput = { 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 + unitPrice?: 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 @@ -1358,7 +1358,7 @@ 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 + unitPrice?: 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 @@ -1375,7 +1375,7 @@ 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 + unitPrice?: 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 @@ -1392,7 +1392,7 @@ export type StockMovementCreateManyProductInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1408,7 +1408,7 @@ export type StockMovementCreateManyProductInput = { export type StockMovementUpdateWithoutProductInput = { type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: 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 @@ -1425,7 +1425,7 @@ export type StockMovementUncheckedUpdateWithoutProductInput = { 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 + unitPrice?: 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 @@ -1442,7 +1442,7 @@ export type StockMovementUncheckedUpdateManyWithoutProductInput = { 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 + unitPrice?: 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 @@ -1459,7 +1459,7 @@ export type StockMovementCreateManySupplierInput = { id?: number type: $Enums.MovementType quantity: runtime.Decimal | runtime.DecimalJsLike | number | string - fee: runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice: runtime.Decimal | runtime.DecimalJsLike | number | string totalCost: runtime.Decimal | runtime.DecimalJsLike | number | string referenceType: $Enums.MovementReferenceType referenceId: string @@ -1475,7 +1475,7 @@ export type StockMovementCreateManySupplierInput = { export type StockMovementUpdateWithoutSupplierInput = { type?: Prisma.EnumMovementTypeFieldUpdateOperationsInput | $Enums.MovementType quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - fee?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + unitPrice?: 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 @@ -1492,7 +1492,7 @@ export type StockMovementUncheckedUpdateWithoutSupplierInput = { 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 + unitPrice?: 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 @@ -1509,7 +1509,7 @@ export type StockMovementUncheckedUpdateManyWithoutSupplierInput = { 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 + unitPrice?: 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 @@ -1528,7 +1528,7 @@ export type StockMovementSelect = runtime.Types.Extensions.GetOmit<"id" | "type" | "quantity" | "fee" | "totalCost" | "referenceType" | "referenceId" | "createdAt" | "productId" | "inventoryId" | "avgCost" | "supplierId" | "remainedInStock" | "counterInventoryId" | "customerId", ExtArgs["result"]["stockMovement"]> +export type StockMovementOmit = runtime.Types.Extensions.GetOmit<"id" | "type" | "quantity" | "unitPrice" | "totalCost" | "referenceType" | "referenceId" | "createdAt" | "productId" | "inventoryId" | "avgCost" | "supplierId" | "remainedInStock" | "counterInventoryId" | "customerId", ExtArgs["result"]["stockMovement"]> export type StockMovementInclude = { counterInventory?: boolean | Prisma.StockMovement$counterInventoryArgs customer?: boolean | Prisma.StockMovement$customerArgs @@ -1589,7 +1589,7 @@ export type $StockMovementPayload readonly type: Prisma.FieldRef<"StockMovement", 'MovementType'> readonly quantity: Prisma.FieldRef<"StockMovement", 'Decimal'> - readonly fee: Prisma.FieldRef<"StockMovement", 'Decimal'> + readonly unitPrice: Prisma.FieldRef<"StockMovement", 'Decimal'> readonly totalCost: Prisma.FieldRef<"StockMovement", 'Decimal'> readonly referenceType: Prisma.FieldRef<"StockMovement", 'MovementReferenceType'> readonly referenceId: Prisma.FieldRef<"StockMovement", 'String'> diff --git a/src/generated/prisma/models/StockReservation.ts b/src/generated/prisma/models/StockReservation.ts new file mode 100644 index 0000000..a108e37 --- /dev/null +++ b/src/generated/prisma/models/StockReservation.ts @@ -0,0 +1,1466 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `StockReservation` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model StockReservation + * + */ +export type StockReservationModel = runtime.Types.Result.DefaultSelection + +export type AggregateStockReservation = { + _count: StockReservationCountAggregateOutputType | null + _avg: StockReservationAvgAggregateOutputType | null + _sum: StockReservationSumAggregateOutputType | null + _min: StockReservationMinAggregateOutputType | null + _max: StockReservationMaxAggregateOutputType | null +} + +export type StockReservationAvgAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + productId: number | null + inventoryId: number | null + orderId: number | null +} + +export type StockReservationSumAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + productId: number | null + inventoryId: number | null + orderId: number | null +} + +export type StockReservationMinAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + expiresAt: Date | null + createdAt: Date | null + productId: number | null + inventoryId: number | null + orderId: number | null +} + +export type StockReservationMaxAggregateOutputType = { + id: number | null + quantity: runtime.Decimal | null + expiresAt: Date | null + createdAt: Date | null + productId: number | null + inventoryId: number | null + orderId: number | null +} + +export type StockReservationCountAggregateOutputType = { + id: number + quantity: number + expiresAt: number + createdAt: number + productId: number + inventoryId: number + orderId: number + _all: number +} + + +export type StockReservationAvgAggregateInputType = { + id?: true + quantity?: true + productId?: true + inventoryId?: true + orderId?: true +} + +export type StockReservationSumAggregateInputType = { + id?: true + quantity?: true + productId?: true + inventoryId?: true + orderId?: true +} + +export type StockReservationMinAggregateInputType = { + id?: true + quantity?: true + expiresAt?: true + createdAt?: true + productId?: true + inventoryId?: true + orderId?: true +} + +export type StockReservationMaxAggregateInputType = { + id?: true + quantity?: true + expiresAt?: true + createdAt?: true + productId?: true + inventoryId?: true + orderId?: true +} + +export type StockReservationCountAggregateInputType = { + id?: true + quantity?: true + expiresAt?: true + createdAt?: true + productId?: true + inventoryId?: true + orderId?: true + _all?: true +} + +export type StockReservationAggregateArgs = { + /** + * Filter which StockReservation to aggregate. + */ + where?: Prisma.StockReservationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of StockReservations to fetch. + */ + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.StockReservationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` StockReservations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` StockReservations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned StockReservations + **/ + _count?: true | StockReservationCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: StockReservationAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: StockReservationSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: StockReservationMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: StockReservationMaxAggregateInputType +} + +export type GetStockReservationAggregateType = { + [P in keyof T & keyof AggregateStockReservation]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type StockReservationGroupByArgs = { + where?: Prisma.StockReservationWhereInput + orderBy?: Prisma.StockReservationOrderByWithAggregationInput | Prisma.StockReservationOrderByWithAggregationInput[] + by: Prisma.StockReservationScalarFieldEnum[] | Prisma.StockReservationScalarFieldEnum + having?: Prisma.StockReservationScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: StockReservationCountAggregateInputType | true + _avg?: StockReservationAvgAggregateInputType + _sum?: StockReservationSumAggregateInputType + _min?: StockReservationMinAggregateInputType + _max?: StockReservationMaxAggregateInputType +} + +export type StockReservationGroupByOutputType = { + id: number + quantity: runtime.Decimal + expiresAt: Date + createdAt: Date + productId: number + inventoryId: number + orderId: number + _count: StockReservationCountAggregateOutputType | null + _avg: StockReservationAvgAggregateOutputType | null + _sum: StockReservationSumAggregateOutputType | null + _min: StockReservationMinAggregateOutputType | null + _max: StockReservationMaxAggregateOutputType | null +} + +type GetStockReservationGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof StockReservationGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type StockReservationWhereInput = { + AND?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] + OR?: Prisma.StockReservationWhereInput[] + NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] + id?: Prisma.IntFilter<"StockReservation"> | number + quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + productId?: Prisma.IntFilter<"StockReservation"> | number + inventoryId?: Prisma.IntFilter<"StockReservation"> | number + orderId?: Prisma.IntFilter<"StockReservation"> | number + inventory?: Prisma.XOR + product?: Prisma.XOR +} + +export type StockReservationOrderByWithRelationInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + expiresAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder + inventory?: Prisma.InventoryOrderByWithRelationInput + product?: Prisma.ProductOrderByWithRelationInput +} + +export type StockReservationWhereUniqueInput = Prisma.AtLeast<{ + id?: number + AND?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] + OR?: Prisma.StockReservationWhereInput[] + NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] + quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + productId?: Prisma.IntFilter<"StockReservation"> | number + inventoryId?: Prisma.IntFilter<"StockReservation"> | number + orderId?: Prisma.IntFilter<"StockReservation"> | number + inventory?: Prisma.XOR + product?: Prisma.XOR +}, "id"> + +export type StockReservationOrderByWithAggregationInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + expiresAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder + _count?: Prisma.StockReservationCountOrderByAggregateInput + _avg?: Prisma.StockReservationAvgOrderByAggregateInput + _max?: Prisma.StockReservationMaxOrderByAggregateInput + _min?: Prisma.StockReservationMinOrderByAggregateInput + _sum?: Prisma.StockReservationSumOrderByAggregateInput +} + +export type StockReservationScalarWhereWithAggregatesInput = { + AND?: Prisma.StockReservationScalarWhereWithAggregatesInput | Prisma.StockReservationScalarWhereWithAggregatesInput[] + OR?: Prisma.StockReservationScalarWhereWithAggregatesInput[] + NOT?: Prisma.StockReservationScalarWhereWithAggregatesInput | Prisma.StockReservationScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number + quantity?: Prisma.DecimalWithAggregatesFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeWithAggregatesFilter<"StockReservation"> | Date | string + createdAt?: Prisma.DateTimeWithAggregatesFilter<"StockReservation"> | Date | string + productId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number + inventoryId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number + orderId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number +} + +export type StockReservationCreateInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + orderId: number + inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput + product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput +} + +export type StockReservationUncheckedCreateInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + productId: number + inventoryId: number + orderId: number +} + +export type StockReservationUpdateInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number + inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput + product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput +} + +export type StockReservationUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationCreateManyInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + productId: number + inventoryId: number + orderId: number +} + +export type StockReservationUpdateManyMutationInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationListRelationFilter = { + every?: Prisma.StockReservationWhereInput + some?: Prisma.StockReservationWhereInput + none?: Prisma.StockReservationWhereInput +} + +export type StockReservationOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type StockReservationCountOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + expiresAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder +} + +export type StockReservationAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder +} + +export type StockReservationMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + expiresAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder +} + +export type StockReservationMinOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + expiresAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder +} + +export type StockReservationSumOrderByAggregateInput = { + id?: Prisma.SortOrder + quantity?: Prisma.SortOrder + productId?: Prisma.SortOrder + inventoryId?: Prisma.SortOrder + orderId?: Prisma.SortOrder +} + +export type StockReservationCreateNestedManyWithoutInventoryInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutInventoryInput[] | Prisma.StockReservationUncheckedCreateWithoutInventoryInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutInventoryInput | Prisma.StockReservationCreateOrConnectWithoutInventoryInput[] + createMany?: Prisma.StockReservationCreateManyInventoryInputEnvelope + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] +} + +export type StockReservationUncheckedCreateNestedManyWithoutInventoryInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutInventoryInput[] | Prisma.StockReservationUncheckedCreateWithoutInventoryInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutInventoryInput | Prisma.StockReservationCreateOrConnectWithoutInventoryInput[] + createMany?: Prisma.StockReservationCreateManyInventoryInputEnvelope + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] +} + +export type StockReservationUpdateManyWithoutInventoryNestedInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutInventoryInput[] | Prisma.StockReservationUncheckedCreateWithoutInventoryInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutInventoryInput | Prisma.StockReservationCreateOrConnectWithoutInventoryInput[] + upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutInventoryInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutInventoryInput[] + createMany?: Prisma.StockReservationCreateManyInventoryInputEnvelope + set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutInventoryInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutInventoryInput[] + updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutInventoryInput | Prisma.StockReservationUpdateManyWithWhereWithoutInventoryInput[] + deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] +} + +export type StockReservationUncheckedUpdateManyWithoutInventoryNestedInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutInventoryInput[] | Prisma.StockReservationUncheckedCreateWithoutInventoryInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutInventoryInput | Prisma.StockReservationCreateOrConnectWithoutInventoryInput[] + upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutInventoryInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutInventoryInput[] + createMany?: Prisma.StockReservationCreateManyInventoryInputEnvelope + set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutInventoryInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutInventoryInput[] + updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutInventoryInput | Prisma.StockReservationUpdateManyWithWhereWithoutInventoryInput[] + deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] +} + +export type StockReservationCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[] + createMany?: Prisma.StockReservationCreateManyProductInputEnvelope + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] +} + +export type StockReservationUncheckedCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[] + createMany?: Prisma.StockReservationCreateManyProductInputEnvelope + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] +} + +export type StockReservationUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[] + upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutProductInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.StockReservationCreateManyProductInputEnvelope + set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutProductInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutProductInput | Prisma.StockReservationUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] +} + +export type StockReservationUncheckedUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[] + upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutProductInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.StockReservationCreateManyProductInputEnvelope + set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[] + update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutProductInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutProductInput | Prisma.StockReservationUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] +} + +export type StockReservationCreateWithoutInventoryInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + orderId: number + product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput +} + +export type StockReservationUncheckedCreateWithoutInventoryInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + productId: number + orderId: number +} + +export type StockReservationCreateOrConnectWithoutInventoryInput = { + where: Prisma.StockReservationWhereUniqueInput + create: Prisma.XOR +} + +export type StockReservationCreateManyInventoryInputEnvelope = { + data: Prisma.StockReservationCreateManyInventoryInput | Prisma.StockReservationCreateManyInventoryInput[] + skipDuplicates?: boolean +} + +export type StockReservationUpsertWithWhereUniqueWithoutInventoryInput = { + where: Prisma.StockReservationWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type StockReservationUpdateWithWhereUniqueWithoutInventoryInput = { + where: Prisma.StockReservationWhereUniqueInput + data: Prisma.XOR +} + +export type StockReservationUpdateManyWithWhereWithoutInventoryInput = { + where: Prisma.StockReservationScalarWhereInput + data: Prisma.XOR +} + +export type StockReservationScalarWhereInput = { + AND?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] + OR?: Prisma.StockReservationScalarWhereInput[] + NOT?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] + id?: Prisma.IntFilter<"StockReservation"> | number + quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string + productId?: Prisma.IntFilter<"StockReservation"> | number + inventoryId?: Prisma.IntFilter<"StockReservation"> | number + orderId?: Prisma.IntFilter<"StockReservation"> | number +} + +export type StockReservationCreateWithoutProductInput = { + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + orderId: number + inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput +} + +export type StockReservationUncheckedCreateWithoutProductInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + inventoryId: number + orderId: number +} + +export type StockReservationCreateOrConnectWithoutProductInput = { + where: Prisma.StockReservationWhereUniqueInput + create: Prisma.XOR +} + +export type StockReservationCreateManyProductInputEnvelope = { + data: Prisma.StockReservationCreateManyProductInput | Prisma.StockReservationCreateManyProductInput[] + skipDuplicates?: boolean +} + +export type StockReservationUpsertWithWhereUniqueWithoutProductInput = { + where: Prisma.StockReservationWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type StockReservationUpdateWithWhereUniqueWithoutProductInput = { + where: Prisma.StockReservationWhereUniqueInput + data: Prisma.XOR +} + +export type StockReservationUpdateManyWithWhereWithoutProductInput = { + where: Prisma.StockReservationScalarWhereInput + data: Prisma.XOR +} + +export type StockReservationCreateManyInventoryInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + productId: number + orderId: number +} + +export type StockReservationUpdateWithoutInventoryInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number + product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput +} + +export type StockReservationUncheckedUpdateWithoutInventoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationUncheckedUpdateManyWithoutInventoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + productId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationCreateManyProductInput = { + id?: number + quantity: runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt: Date | string + createdAt?: Date | string + inventoryId: number + orderId: number +} + +export type StockReservationUpdateWithoutProductInput = { + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + orderId?: Prisma.IntFieldUpdateOperationsInput | number + inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput +} + +export type StockReservationUncheckedUpdateWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type StockReservationUncheckedUpdateManyWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + orderId?: Prisma.IntFieldUpdateOperationsInput | number +} + + + +export type StockReservationSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + quantity?: boolean + expiresAt?: boolean + createdAt?: boolean + productId?: boolean + inventoryId?: boolean + orderId?: boolean + inventory?: boolean | Prisma.InventoryDefaultArgs + product?: boolean | Prisma.ProductDefaultArgs +}, ExtArgs["result"]["stockReservation"]> + + + +export type StockReservationSelectScalar = { + id?: boolean + quantity?: boolean + expiresAt?: boolean + createdAt?: boolean + productId?: boolean + inventoryId?: boolean + orderId?: boolean +} + +export type StockReservationOmit = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "expiresAt" | "createdAt" | "productId" | "inventoryId" | "orderId", ExtArgs["result"]["stockReservation"]> +export type StockReservationInclude = { + inventory?: boolean | Prisma.InventoryDefaultArgs + product?: boolean | Prisma.ProductDefaultArgs +} + +export type $StockReservationPayload = { + name: "StockReservation" + objects: { + inventory: Prisma.$InventoryPayload + product: Prisma.$ProductPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + quantity: runtime.Decimal + expiresAt: Date + createdAt: Date + productId: number + inventoryId: number + orderId: number + }, ExtArgs["result"]["stockReservation"]> + composites: {} +} + +export type StockReservationGetPayload = runtime.Types.Result.GetResult + +export type StockReservationCountArgs = + Omit & { + select?: StockReservationCountAggregateInputType | true + } + +export interface StockReservationDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['StockReservation'], meta: { name: 'StockReservation' } } + /** + * Find zero or one StockReservation that matches the filter. + * @param {StockReservationFindUniqueArgs} args - Arguments to find a StockReservation + * @example + * // Get one StockReservation + * const stockReservation = await prisma.stockReservation.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one StockReservation that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {StockReservationFindUniqueOrThrowArgs} args - Arguments to find a StockReservation + * @example + * // Get one StockReservation + * const stockReservation = await prisma.stockReservation.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first StockReservation that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationFindFirstArgs} args - Arguments to find a StockReservation + * @example + * // Get one StockReservation + * const stockReservation = await prisma.stockReservation.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first StockReservation that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationFindFirstOrThrowArgs} args - Arguments to find a StockReservation + * @example + * // Get one StockReservation + * const stockReservation = await prisma.stockReservation.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more StockReservations that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all StockReservations + * const stockReservations = await prisma.stockReservation.findMany() + * + * // Get first 10 StockReservations + * const stockReservations = await prisma.stockReservation.findMany({ take: 10 }) + * + * // Only select the `id` + * const stockReservationWithIdOnly = await prisma.stockReservation.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a StockReservation. + * @param {StockReservationCreateArgs} args - Arguments to create a StockReservation. + * @example + * // Create one StockReservation + * const StockReservation = await prisma.stockReservation.create({ + * data: { + * // ... data to create a StockReservation + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many StockReservations. + * @param {StockReservationCreateManyArgs} args - Arguments to create many StockReservations. + * @example + * // Create many StockReservations + * const stockReservation = await prisma.stockReservation.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a StockReservation. + * @param {StockReservationDeleteArgs} args - Arguments to delete one StockReservation. + * @example + * // Delete one StockReservation + * const StockReservation = await prisma.stockReservation.delete({ + * where: { + * // ... filter to delete one StockReservation + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one StockReservation. + * @param {StockReservationUpdateArgs} args - Arguments to update one StockReservation. + * @example + * // Update one StockReservation + * const stockReservation = await prisma.stockReservation.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more StockReservations. + * @param {StockReservationDeleteManyArgs} args - Arguments to filter StockReservations to delete. + * @example + * // Delete a few StockReservations + * const { count } = await prisma.stockReservation.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more StockReservations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many StockReservations + * const stockReservation = await prisma.stockReservation.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one StockReservation. + * @param {StockReservationUpsertArgs} args - Arguments to update or create a StockReservation. + * @example + * // Update or create a StockReservation + * const stockReservation = await prisma.stockReservation.upsert({ + * create: { + * // ... data to create a StockReservation + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the StockReservation we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__StockReservationClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of StockReservations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationCountArgs} args - Arguments to filter StockReservations to count. + * @example + * // Count the number of StockReservations + * const count = await prisma.stockReservation.count({ + * where: { + * // ... the filter for the StockReservations we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a StockReservation. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by StockReservation. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {StockReservationGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends StockReservationGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: StockReservationGroupByArgs['orderBy'] } + : { orderBy?: StockReservationGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetStockReservationGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the StockReservation model + */ +readonly fields: StockReservationFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for StockReservation. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__StockReservationClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + inventory = {}>(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> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the StockReservation model + */ +export interface StockReservationFieldRefs { + readonly id: Prisma.FieldRef<"StockReservation", 'Int'> + readonly quantity: Prisma.FieldRef<"StockReservation", 'Decimal'> + readonly expiresAt: Prisma.FieldRef<"StockReservation", 'DateTime'> + readonly createdAt: Prisma.FieldRef<"StockReservation", 'DateTime'> + readonly productId: Prisma.FieldRef<"StockReservation", 'Int'> + readonly inventoryId: Prisma.FieldRef<"StockReservation", 'Int'> + readonly orderId: Prisma.FieldRef<"StockReservation", 'Int'> +} + + +// Custom InputTypes +/** + * StockReservation findUnique + */ +export type StockReservationFindUniqueArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter, which StockReservation to fetch. + */ + where: Prisma.StockReservationWhereUniqueInput +} + +/** + * StockReservation findUniqueOrThrow + */ +export type StockReservationFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter, which StockReservation to fetch. + */ + where: Prisma.StockReservationWhereUniqueInput +} + +/** + * StockReservation findFirst + */ +export type StockReservationFindFirstArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter, which StockReservation to fetch. + */ + where?: Prisma.StockReservationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of StockReservations to fetch. + */ + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for StockReservations. + */ + cursor?: Prisma.StockReservationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` StockReservations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` StockReservations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of StockReservations. + */ + distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[] +} + +/** + * StockReservation findFirstOrThrow + */ +export type StockReservationFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter, which StockReservation to fetch. + */ + where?: Prisma.StockReservationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of StockReservations to fetch. + */ + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for StockReservations. + */ + cursor?: Prisma.StockReservationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` StockReservations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` StockReservations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of StockReservations. + */ + distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[] +} + +/** + * StockReservation findMany + */ +export type StockReservationFindManyArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter, which StockReservations to fetch. + */ + where?: Prisma.StockReservationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of StockReservations to fetch. + */ + orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing StockReservations. + */ + cursor?: Prisma.StockReservationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` StockReservations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` StockReservations. + */ + skip?: number + distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[] +} + +/** + * StockReservation create + */ +export type StockReservationCreateArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * The data needed to create a StockReservation. + */ + data: Prisma.XOR +} + +/** + * StockReservation createMany + */ +export type StockReservationCreateManyArgs = { + /** + * The data used to create many StockReservations. + */ + data: Prisma.StockReservationCreateManyInput | Prisma.StockReservationCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * StockReservation update + */ +export type StockReservationUpdateArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * The data needed to update a StockReservation. + */ + data: Prisma.XOR + /** + * Choose, which StockReservation to update. + */ + where: Prisma.StockReservationWhereUniqueInput +} + +/** + * StockReservation updateMany + */ +export type StockReservationUpdateManyArgs = { + /** + * The data used to update StockReservations. + */ + data: Prisma.XOR + /** + * Filter which StockReservations to update + */ + where?: Prisma.StockReservationWhereInput + /** + * Limit how many StockReservations to update. + */ + limit?: number +} + +/** + * StockReservation upsert + */ +export type StockReservationUpsertArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * The filter to search for the StockReservation to update in case it exists. + */ + where: Prisma.StockReservationWhereUniqueInput + /** + * In case the StockReservation found by the `where` argument doesn't exist, create a new StockReservation with this data. + */ + create: Prisma.XOR + /** + * In case the StockReservation was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * StockReservation delete + */ +export type StockReservationDeleteArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null + /** + * Filter which StockReservation to delete. + */ + where: Prisma.StockReservationWhereUniqueInput +} + +/** + * StockReservation deleteMany + */ +export type StockReservationDeleteManyArgs = { + /** + * Filter which StockReservations to delete + */ + where?: Prisma.StockReservationWhereInput + /** + * Limit how many StockReservations to delete. + */ + limit?: number +} + +/** + * StockReservation without action + */ +export type StockReservationDefaultArgs = { + /** + * Select specific fields to fetch from the StockReservation + */ + select?: Prisma.StockReservationSelect | null + /** + * Omit specific fields from the StockReservation + */ + omit?: Prisma.StockReservationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.StockReservationInclude | null +} diff --git a/src/modules/inventories/index/inventories.service.ts b/src/modules/inventories/index/inventories.service.ts index 2046f08..6136619 100644 --- a/src/modules/inventories/index/inventories.service.ts +++ b/src/modules/inventories/index/inventories.service.ts @@ -92,13 +92,13 @@ export class InventoriesService { console.log(movements) const mapped = movements.map(movement => { - const { id, quantity, fee, totalCost, avgCost, product } = movement + const { id, quantity, unitPrice, totalCost, avgCost, product } = movement if (info === null) { info = { date: movement.createdAt, type: movement.type, quantity: Number(movement.quantity), - fee: Number(movement.fee), + unitPrice: Number(movement.unitPrice), totalCost: Number(movement.totalCost), referenceType: movement.referenceType, referenceId: movement.referenceId, @@ -107,13 +107,13 @@ export class InventoriesService { } } else { info.quantity += Number(movement.quantity) - info.fee += Number(movement.fee) + info.unitPrice += Number(movement.unitPrice) info.totalCost += Number(movement.totalCost) } return { id, quantity: Number(quantity), - fee: Number(fee), + unitPrice: Number(unitPrice), totalCost: Number(totalCost), avgCost: Number(avgCost), product, diff --git a/src/modules/pos/dto/create-pos.dto.ts b/src/modules/pos/dto/create-pos.dto.ts index 7fd5c97..5b0cf11 100644 --- a/src/modules/pos/dto/create-pos.dto.ts +++ b/src/modules/pos/dto/create-pos.dto.ts @@ -33,5 +33,5 @@ export class CreateOrderItemDto { @ApiProperty() @IsNumber() @Type(() => Number) - fee: number + unitPrice: number } diff --git a/src/modules/pos/pos.service.ts b/src/modules/pos/pos.service.ts index d9a143e..52180c1 100644 --- a/src/modules/pos/pos.service.ts +++ b/src/modules/pos/pos.service.ts @@ -170,7 +170,10 @@ export class PosService { const newCode = String(Number(lastCode) + 1) - const totalAmount = data.items.reduce((acc, item) => acc + item.count * item.fee, 0) + const totalAmount = data.items.reduce( + (acc, item) => acc + item.count * item.unitPrice, + 0, + ) const preparedOrder: SalesInvoiceCreateInput = { ...res, @@ -182,8 +185,8 @@ export class PosService { create: items.map(item => ({ product: { connect: { id: Number(item.productId) } }, count: item.count, - fee: item.fee, - total: item.count * item.fee, + unitPrice: item.unitPrice, + total: item.count * item.unitPrice, })), }, } diff --git a/src/modules/statistics/queries/top-alert-stocks.sql b/src/modules/statistics/queries/top-alert-stocks.sql new file mode 100644 index 0000000..200b363 --- /dev/null +++ b/src/modules/statistics/queries/top-alert-stocks.sql @@ -0,0 +1,17 @@ +SELECT p.id +FROM Products p +WHERE ( + SELECT COALESCE(SUM(sb.quantity), 0) + FROM Stock_Balance sb + WHERE + sb.productId = p.id + ) < p.minimumStockAlertLevel +ORDER BY ( + p.minimumStockAlertLevel - ( + SELECT COALESCE(SUM(sb.quantity), 0) + FROM Stock_Balance sb + WHERE + sb.productId = p.id + ) + ) DESC +LIMIT 10 diff --git a/src/modules/statistics/statistics.controller.ts b/src/modules/statistics/statistics.controller.ts new file mode 100644 index 0000000..3418b42 --- /dev/null +++ b/src/modules/statistics/statistics.controller.ts @@ -0,0 +1,27 @@ +import { Controller, Get } from '@nestjs/common' +import { StatisticsService } from './statistics.service' + +@Controller('statistics') +export class StatisticsController { + constructor(private readonly statisticsService: StatisticsService) {} + + @Get('top-last-sales') + getTopLastSales() { + return this.statisticsService.getTopLastSales() + } + + @Get('top-alert-stocks') + getTopAlertStocks() { + return this.statisticsService.getTopAlertStocks() + } + + @Get('top-supplier-debts') + getTopSupplierDebts() { + return this.statisticsService.getTopSupplierDebts() + } + + @Get('top-sales') + getTopSellProducts() { + return this.statisticsService.getTopSellProducts() + } +} diff --git a/src/modules/statistics/statistics.module.ts b/src/modules/statistics/statistics.module.ts new file mode 100644 index 0000000..4ce07cb --- /dev/null +++ b/src/modules/statistics/statistics.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common' +import { PrismaService } from '../../prisma/prisma.service' +import { StatisticsController } from './statistics.controller' +import { StatisticsService } from './statistics.service' + +@Module({ + controllers: [StatisticsController], + providers: [StatisticsService, PrismaService], +}) +export class StatisticsModule {} diff --git a/src/modules/statistics/statistics.service.ts b/src/modules/statistics/statistics.service.ts new file mode 100644 index 0000000..1f3eb90 --- /dev/null +++ b/src/modules/statistics/statistics.service.ts @@ -0,0 +1,184 @@ +import { Injectable } from '@nestjs/common' +import * as fs from 'fs' +import * as path from 'path' +import { ResponseMapper } from '../../common/response/response-mapper' +import { PrismaService } from '../../prisma/prisma.service' + +@Injectable() +export class StatisticsService { + constructor(private prisma: PrismaService) {} + + private readSqlFile(filename: string): string { + const filePath = path.join(__dirname, 'queries', filename) + return fs.readFileSync(filePath, 'utf8') + } + + async getTopLastSales() { + const sales = await this.prisma.salesInvoice.findMany({ + take: 10, + orderBy: { createdAt: 'desc' }, + include: { + customer: { select: { id: true, firstName: true, lastName: true } }, + posAccount: { select: { id: true, name: true } }, + items: { + include: { + product: { select: { id: true, name: true } }, + }, + }, + }, + }) + + const mapped = sales.map(sale => ({ + ...sale, + totalAmount: Number(sale.totalAmount), + itemsCount: sale.items.length, + })) + + return ResponseMapper.list(mapped) + } + + async getTopAlertStocks() { + const productIds = await this.prisma.$queryRaw<{ id: number }[]>` + SELECT p.id + FROM Products p + WHERE (SELECT COALESCE(SUM(sb.quantity), 0) FROM Stock_Balance sb WHERE sb.productId = p.id) < p.minimumStockAlertLevel + -- ORDER BY (p.minimumStockAlertLevel - (SELECT COALESCE(SUM(sb.quantity), 0) FROM stock_balance sb WHERE sb.productId = p.id)) DESC + LIMIT 10 + ` + + const ids = productIds.map(p => p.id) + + if (ids.length === 0) { + return ResponseMapper.list([]) + } + + const products = await this.prisma.product.findMany({ + where: { id: { in: ids } }, + select: { + id: true, + name: true, + sku: true, + minimumStockAlertLevel: true, + stockBalances: { + select: { + quantity: true, + inventory: { select: { id: true, name: true } }, + }, + }, + category: { select: { id: true, name: true } }, + brand: { select: { id: true, name: true } }, + }, + }) + + const mappedData = products.map(product => ({ + ...product, + stock: product.stockBalances.reduce((acc, sb) => acc + Number(sb.quantity), 0), + deficit: + Number(product.minimumStockAlertLevel) - + product.stockBalances.reduce((acc, sb) => acc + Number(sb.quantity), 0), + })) + + return ResponseMapper.list(mappedData) + } + + async getTopSupplierDebts() { + // Get unpaid receipts + const receipts = await this.prisma.purchaseReceipt.findMany({ + where: { + status: { not: 'PAID' }, + }, + select: { + id: true, + totalAmount: true, + paidAmount: true, + supplierId: true, + }, + }) + + const debtMap = new Map< + number, + { supplierId: number; totalDebt: number; unpaidReceipts: number } + >() + + for (const receipt of receipts) { + const debt = Number(receipt.totalAmount) - Number(receipt.paidAmount) + if (debt > 0) { + const existing = debtMap.get(receipt.supplierId) + if (existing) { + existing.totalDebt += debt + existing.unpaidReceipts += 1 + } else { + debtMap.set(receipt.supplierId, { + supplierId: receipt.supplierId, + totalDebt: debt, + unpaidReceipts: 1, + }) + } + } + } + + const supplierIds = Array.from(debtMap.keys()) + const suppliers = await this.prisma.supplier.findMany({ + where: { id: { in: supplierIds } }, + select: { id: true, firstName: true, lastName: true }, + }) + + const supplierMap = new Map( + suppliers.map(s => [s.id, `${s.firstName} ${s.lastName}`.trim()]), + ) + + const mapped = Array.from(debtMap.values()) + .map(item => ({ + id: item.supplierId, + name: supplierMap.get(item.supplierId) || 'Unknown', + totalDebt: item.totalDebt, + unpaidReceipts: item.unpaidReceipts, + })) + .sort((a, b) => b.totalDebt - a.totalDebt) + .slice(0, 10) + + return ResponseMapper.list(mapped) + } + + async getTopSellProducts() { + const productData = await this.prisma.$queryRaw` + SELECT p.id, p.name, p.sku, COALESCE(SUM(sii.count), 0) as totalSold + FROM Products p + LEFT JOIN Sales_Invoice_Items sii ON p.id = sii.productId + GROUP BY p.id + HAVING totalSold > 0 + ORDER BY totalSold DESC + LIMIT 10 + ` + + const ids = productData.map(p => p.id) + + if (ids.length === 0) { + return ResponseMapper.list([]) + } + + const products = await this.prisma.product.findMany({ + where: { id: { in: ids } }, + select: { + id: true, + category: { select: { id: true, name: true } }, + brand: { select: { id: true, name: true } }, + }, + }) + + const productMap = new Map( + products.map(p => [p.id, { category: p.category, brand: p.brand }]), + ) + + const mapped = productData.map(product => ({ + id: product.id, + name: product.name, + sku: product.sku, + totalSold: Number(product.totalSold), + category: productMap.get(product.id)?.category, + brand: productMap.get(product.id)?.brand, + })) + + return ResponseMapper.list(mapped) + } +} diff --git a/src/modules/suppliers/invoices/invoices.service.ts b/src/modules/suppliers/invoices/invoices.service.ts index 1404677..3d57cc3 100644 --- a/src/modules/suppliers/invoices/invoices.service.ts +++ b/src/modules/suppliers/invoices/invoices.service.ts @@ -23,8 +23,8 @@ export class SupplierInvoicesService { select: { id: true, count: true, - fee: true, - total: true, + unitPrice: true, + totalAmount: true, product: { select: { id: true, @@ -149,6 +149,8 @@ export class SupplierInvoicesService { async createPayment(invoiceId: number, data: CreateReceiptPaymentDto) { const { bankAccountId, ...rest } = data + console.log(data) + const payment = await this.prisma.purchaseReceiptPayments.create({ data: { ...rest, diff --git a/src/purchase-receipt-items/dto/create-purchase-receipt-item.dto.ts b/src/purchase-receipt-items/dto/create-purchase-receipt-item.dto.ts index 48a21c6..8f6f87d 100644 --- a/src/purchase-receipt-items/dto/create-purchase-receipt-item.dto.ts +++ b/src/purchase-receipt-items/dto/create-purchase-receipt-item.dto.ts @@ -10,12 +10,12 @@ export class CreatePurchaseReceiptItemDto { @Type(() => Number) @IsNumber() @Min(0) - fee: number + unitPrice: number @Type(() => Number) @IsNumber() @Min(0) - total: number + totalAmount: number @Type(() => Number) @IsNotEmpty() diff --git a/src/purchase-receipt-items/dto/update-purchase-receipt-item.dto.ts b/src/purchase-receipt-items/dto/update-purchase-receipt-item.dto.ts index fd99e2b..caa5f27 100644 --- a/src/purchase-receipt-items/dto/update-purchase-receipt-item.dto.ts +++ b/src/purchase-receipt-items/dto/update-purchase-receipt-item.dto.ts @@ -10,7 +10,7 @@ export class UpdatePurchaseReceiptItemDto { @IsOptional() @Type(() => Number) @IsNumber() - fee?: number + unitPrice?: number @IsOptional() @Type(() => Number) diff --git a/src/purchase-receipt-items/purchase-receipt-items.service.ts b/src/purchase-receipt-items/purchase-receipt-items.service.ts index 0cc5b20..cbdf78f 100644 --- a/src/purchase-receipt-items/purchase-receipt-items.service.ts +++ b/src/purchase-receipt-items/purchase-receipt-items.service.ts @@ -17,7 +17,7 @@ export class PurchaseReceiptItemsService { payload.receipt = { connect: { id: Number(payload.receiptId) } } delete payload.receiptId } - payload.fee = String(payload.fee) + payload.unitPrice = String(payload.unitPrice) payload.count = String(payload.count) payload.total = String(payload.total) const item = await this.prisma.purchaseReceiptItem.create({ data: payload }) diff --git a/src/purchase-receipts/purchase-receipts.service.ts b/src/purchase-receipts/purchase-receipts.service.ts index b4d8f78..bfd481f 100644 --- a/src/purchase-receipts/purchase-receipts.service.ts +++ b/src/purchase-receipts/purchase-receipts.service.ts @@ -21,8 +21,8 @@ export class PurchaseReceiptsService { create: dto.items.map((item, idx) => { const mapped = { count: new Prisma.Decimal(item.count ?? 0), - fee: new Prisma.Decimal(item.fee ?? 0), - total: new Prisma.Decimal(item.total ?? 0), + unitPrice: new Prisma.Decimal(item.unitPrice ?? 0), + totalAmount: new Prisma.Decimal(item.totalAmount ?? 0), description: item.description ?? null, product: { connect: { id: item.productId } }, } @@ -34,6 +34,10 @@ export class PurchaseReceiptsService { const item = await this.prisma.purchaseReceipt.create({ data, include: { items: true }, + omit: { + supplierId: true, + inventoryId: true, + }, }) return ResponseMapper.create(item) } diff --git a/src/sales-invoice-items/dto/create-sales-invoice-item.dto.ts b/src/sales-invoice-items/dto/create-sales-invoice-item.dto.ts index f13fe76..10640cc 100644 --- a/src/sales-invoice-items/dto/create-sales-invoice-item.dto.ts +++ b/src/sales-invoice-items/dto/create-sales-invoice-item.dto.ts @@ -8,7 +8,7 @@ export class CreateSalesInvoiceItemDto { @Type(() => Number) @IsNumber() - fee: number + unitPrice: number @Type(() => Number) @IsNumber() diff --git a/src/sales-invoice-items/dto/update-sales-invoice-item.dto.ts b/src/sales-invoice-items/dto/update-sales-invoice-item.dto.ts index 1475047..e07671d 100644 --- a/src/sales-invoice-items/dto/update-sales-invoice-item.dto.ts +++ b/src/sales-invoice-items/dto/update-sales-invoice-item.dto.ts @@ -10,7 +10,7 @@ export class UpdateSalesInvoiceItemDto { @IsOptional() @Type(() => Number) @IsNumber() - fee?: number + unitPrice?: number @IsOptional() @Type(() => Number) diff --git a/src/stock-movements/dto/create-stock-movement.dto.ts b/src/stock-movements/dto/create-stock-movement.dto.ts index 9ffa6e5..a3d4c2a 100644 --- a/src/stock-movements/dto/create-stock-movement.dto.ts +++ b/src/stock-movements/dto/create-stock-movement.dto.ts @@ -12,7 +12,7 @@ export class CreateStockMovementDto { @Type(() => Number) @IsNumber() - fee: number + unitPrice: number @Type(() => Number) @IsNumber()