diff --git a/fix_trigger.sql b/fix_trigger.sql new file mode 100644 index 0000000..bae2ec1 --- /dev/null +++ b/fix_trigger.sql @@ -0,0 +1,91 @@ +-- 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/package.json b/package.json index 7fa25a5..6b3b85d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "@nestjs/platform-express": "^11.0.1", "@nestjs/swagger": "^11.2.3", "@prisma/adapter-mariadb": "^7.1.0", - "@prisma/client": "^7.1.0", "class-transformer": "^0.5.1", "class-validator": "^0.14.3", "dayjs": "^1.11.19", @@ -25,6 +24,7 @@ "@nestjs/cli": "^11.0.0", "@nestjs/schematics": "^11.0.0", "@nestjs/testing": "^11.0.1", + "@prisma/client": "^7.2.0", "@types/express": "^5.0.0", "@types/jest": "^30.0.0", "@types/node": "^22.10.7", @@ -36,7 +36,7 @@ "jest": "^30.0.0", "prettier": "^3.4.2", "prettier-plugin-prisma": "^5.0.0", - "prisma": "^7.1.0", + "prisma": "^7.2.0", "source-map-support": "^0.5.21", "supertest": "^7.0.0", "ts-jest": "^29.2.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 41cffe2..3a1d821 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ importers: '@prisma/adapter-mariadb': specifier: ^7.1.0 version: 7.1.0 - '@prisma/client': - specifier: ^7.1.0 - version: 7.1.0(prisma@7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3))(typescript@5.9.3) class-transformer: specifier: ^0.5.1 version: 0.5.1 @@ -72,6 +69,9 @@ importers: '@nestjs/testing': specifier: ^11.0.1 version: 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(@nestjs/platform-express@11.1.9) + '@prisma/client': + specifier: ^7.2.0 + version: 7.2.0(prisma@7.2.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3))(typescript@5.9.3) '@types/express': specifier: ^5.0.0 version: 5.0.6 @@ -106,8 +106,8 @@ importers: specifier: ^5.0.0 version: 5.0.0(prettier@3.7.4) prisma: - specifier: ^7.1.0 - version: 7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3) + specifier: ^7.2.0 + version: 7.2.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3) source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1003,11 +1003,11 @@ packages: '@prisma/adapter-mariadb@7.1.0': resolution: {integrity: sha512-my5vKT6J4zRi5nNmLxosMafdQCk7tZgQHZ11mfaeFKh8xrJSEjFn0TFa1py8khHvFMvnadKUWdctjPpoJuxSBQ==} - '@prisma/client-runtime-utils@7.1.0': - resolution: {integrity: sha512-39xmeBrNTN40FzF34aJMjfX1PowVCqoT3UKUWBBSP3aXV05NRqGBC3x2wCDs96ti6ZgdiVzqnRDHtbzU8X+lPQ==} + '@prisma/client-runtime-utils@7.2.0': + resolution: {integrity: sha512-dn7oB53v0tqkB0wBdMuTNFNPdEbfICEUe82Tn9FoKAhJCUkDH+fmyEp0ClciGh+9Hp2Tuu2K52kth2MTLstvmA==} - '@prisma/client@7.1.0': - resolution: {integrity: sha512-qf7GPYHmS/xybNiSOpzv9wBo+UwqfL2PeyX+08v+KVHDI0AlSCQIh5bBySkH3alu06NX9wy98JEnckhMHoMFfA==} + '@prisma/client@7.2.0': + resolution: {integrity: sha512-JdLF8lWZ+LjKGKpBqyAlenxd/kXjd1Abf/xK+6vUA7R7L2Suo6AFTHFRpPSdAKCan9wzdFApsUpSa/F6+t1AtA==} engines: {node: ^20.19 || ^22.12 || >=24.0} peerDependencies: prisma: '*' @@ -1018,8 +1018,8 @@ packages: typescript: optional: true - '@prisma/config@7.1.0': - resolution: {integrity: sha512-Uz+I43Wn1RYNHtuYtOhOnUcNMWp2Pd3GUDDKs37xlHptCGpzEG3MRR9L+8Y2ISMsMI24z/Ni+ww6OB/OO8M0sQ==} + '@prisma/config@7.2.0': + resolution: {integrity: sha512-qmvSnfQ6l/srBW1S7RZGfjTQhc44Yl3ldvU6y3pgmuLM+83SBDs6UQVgMtQuMRe9J3gGqB0RF8wER6RlXEr6jQ==} '@prisma/debug@6.8.2': resolution: {integrity: sha512-4muBSSUwJJ9BYth5N8tqts8JtiLT8QI/RSAzEogwEfpbYGFo9mYsInsVo8dqXdPO2+Rm5OG5q0qWDDE3nyUbVg==} @@ -1027,26 +1027,29 @@ packages: '@prisma/debug@7.1.0': resolution: {integrity: sha512-pPAckG6etgAsEBusmZiFwM9bldLSNkn++YuC4jCTJACdK5hLOVnOzX7eSL2FgaU6Gomd6wIw21snUX2dYroMZQ==} - '@prisma/dev@0.15.0': - resolution: {integrity: sha512-KhWaipnFlS/fWEs6I6Oqjcy2S08vKGmxJ5LexqUl/3Ve0EgLUsZwdKF0MvqPM5F5ttw8GtfZarjM5y7VLwv9Ow==} + '@prisma/debug@7.2.0': + resolution: {integrity: sha512-YSGTiSlBAVJPzX4ONZmMotL+ozJwQjRmZweQNIq/ER0tQJKJynNkRB3kyvt37eOfsbMCXk3gnLF6J9OJ4QWftw==} + + '@prisma/dev@0.17.0': + resolution: {integrity: sha512-6sGebe5jxX+FEsQTpjHLzvOGPn6ypFQprcs3jcuIWv1Xp/5v6P/rjfdvAwTkP2iF6pDx2tCd8vGLNWcsWzImTA==} '@prisma/driver-adapter-utils@7.1.0': resolution: {integrity: sha512-AlVLzeXkw81+47MvQ9M8DvTiHkRfJ8xzklTbYjpskb0cTTDVHboTI/OVwT6Wcep/bNvfLKJYO0nylBiM5rxgww==} - '@prisma/engines-version@7.1.0-6.ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba': - resolution: {integrity: sha512-qZUevUh+yPhGT28rDQnV8V2kLnFjirzhVD67elRPIJHRsUV/mkII10HSrJrhK/U2GYgAxXR2VEREtq7AsfS8qw==} + '@prisma/engines-version@7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3': + resolution: {integrity: sha512-KezsjCZDsbjNR7SzIiVlUsn9PnLePI7r5uxABlwL+xoerurZTfgQVbIjvjF2sVr3Uc0ZcsnREw3F84HvbggGdA==} - '@prisma/engines@7.1.0': - resolution: {integrity: sha512-KQlraOybdHAzVv45KWKJzpR9mJLkib7/TyApQpqrsL7FUHfgjIcy8jrVGt3iNfG6/GDDl+LNlJ84JSQwIfdzxA==} + '@prisma/engines@7.2.0': + resolution: {integrity: sha512-HUeOI/SvCDsHrR9QZn24cxxZcujOjcS3w1oW/XVhnSATAli5SRMOfp/WkG3TtT5rCxDA4xOnlJkW7xkho4nURA==} - '@prisma/fetch-engine@7.1.0': - resolution: {integrity: sha512-GZYF5Q8kweXWGfn87hTu17kw7x1DgnehgKoE4Zg1BmHYF3y1Uu0QRY/qtSE4veH3g+LW8f9HKqA0tARG66bxxQ==} + '@prisma/fetch-engine@7.2.0': + resolution: {integrity: sha512-Z5XZztJ8Ap+wovpjPD2lQKnB8nWFGNouCrglaNFjxIWAGWz0oeHXwUJRiclIoSSXN/ptcs9/behptSk8d0Yy6w==} '@prisma/get-platform@6.8.2': resolution: {integrity: sha512-vXSxyUgX3vm1Q70QwzwkjeYfRryIvKno1SXbIqwSptKwqKzskINnDUcx85oX+ys6ooN2ATGSD0xN2UTfg6Zcow==} - '@prisma/get-platform@7.1.0': - resolution: {integrity: sha512-lq8hMdjKiZftuT5SssYB3EtQj8+YjL24/ZTLflQqzFquArKxBcyp6Xrblto+4lzIKJqnpOjfMiBjMvl7YuD7+Q==} + '@prisma/get-platform@7.2.0': + resolution: {integrity: sha512-k1V0l0Td1732EHpAfi2eySTezyllok9dXb6UQanajkJQzPUGi3vO2z7jdkz67SypFTdmbnyGYxvEvYZdZsMAVA==} '@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584': resolution: {integrity: sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==} @@ -1054,8 +1057,8 @@ packages: '@prisma/query-plan-executor@6.18.0': resolution: {integrity: sha512-jZ8cfzFgL0jReE1R10gT8JLHtQxjWYLiQ//wHmVYZ2rVkFHoh0DT8IXsxcKcFlfKN7ak7k6j0XMNn2xVNyr5cA==} - '@prisma/studio-core@0.8.2': - resolution: {integrity: sha512-/iAEWEUpTja+7gVMu1LtR2pPlvDmveAwMHdTWbDeGlT7yiv0ZTCPpmeAGdq/Y9aJ9Zj1cEGBXGRbmmNPj022PQ==} + '@prisma/studio-core@0.9.0': + resolution: {integrity: sha512-xA2zoR/ADu/NCSQuriBKTh6Ps4XjU0bErkEcgMfnSGh346K1VI7iWKnoq1l2DoxUqiddPHIEWwtxJ6xCHG6W7g==} peerDependencies: '@types/react': ^18.0.0 || ^19.0.0 react: ^18.0.0 || ^19.0.0 @@ -2992,8 +2995,8 @@ packages: resolution: {integrity: sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - prisma@7.1.0: - resolution: {integrity: sha512-dy/3urE4JjhdiW5b09pGjVhGI7kPESK2VlCDrCqeYK5m5SslAtG5FCGnZWP7E8Sdg+Ow1wV2mhJH5RTFL5gEsw==} + prisma@7.2.0: + resolution: {integrity: sha512-jSdHWgWOgFF24+nRyyNRVBIgGDQEsMEF8KPHvhBBg3jWyR9fUAK0Nq9ThUmiGlNgq2FA7vSk/ZoCvefod+a8qg==} engines: {node: ^20.19 || ^22.12 || >=24.0} hasBin: true peerDependencies: @@ -4575,16 +4578,16 @@ snapshots: '@prisma/driver-adapter-utils': 7.1.0 mariadb: 3.4.5 - '@prisma/client-runtime-utils@7.1.0': {} + '@prisma/client-runtime-utils@7.2.0': {} - '@prisma/client@7.1.0(prisma@7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3))(typescript@5.9.3)': + '@prisma/client@7.2.0(prisma@7.2.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3))(typescript@5.9.3)': dependencies: - '@prisma/client-runtime-utils': 7.1.0 + '@prisma/client-runtime-utils': 7.2.0 optionalDependencies: - prisma: 7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3) + prisma: 7.2.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3) typescript: 5.9.3 - '@prisma/config@7.1.0': + '@prisma/config@7.2.0': dependencies: c12: 3.1.0 deepmerge-ts: 7.1.5 @@ -4597,7 +4600,9 @@ snapshots: '@prisma/debug@7.1.0': {} - '@prisma/dev@0.15.0(typescript@5.9.3)': + '@prisma/debug@7.2.0': {} + + '@prisma/dev@0.17.0(typescript@5.9.3)': dependencies: '@electric-sql/pglite': 0.3.2 '@electric-sql/pglite-socket': 0.0.6(@electric-sql/pglite@0.3.2) @@ -4623,34 +4628,34 @@ snapshots: dependencies: '@prisma/debug': 7.1.0 - '@prisma/engines-version@7.1.0-6.ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba': {} + '@prisma/engines-version@7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3': {} - '@prisma/engines@7.1.0': + '@prisma/engines@7.2.0': dependencies: - '@prisma/debug': 7.1.0 - '@prisma/engines-version': 7.1.0-6.ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba - '@prisma/fetch-engine': 7.1.0 - '@prisma/get-platform': 7.1.0 + '@prisma/debug': 7.2.0 + '@prisma/engines-version': 7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3 + '@prisma/fetch-engine': 7.2.0 + '@prisma/get-platform': 7.2.0 - '@prisma/fetch-engine@7.1.0': + '@prisma/fetch-engine@7.2.0': dependencies: - '@prisma/debug': 7.1.0 - '@prisma/engines-version': 7.1.0-6.ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba - '@prisma/get-platform': 7.1.0 + '@prisma/debug': 7.2.0 + '@prisma/engines-version': 7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3 + '@prisma/get-platform': 7.2.0 '@prisma/get-platform@6.8.2': dependencies: '@prisma/debug': 6.8.2 - '@prisma/get-platform@7.1.0': + '@prisma/get-platform@7.2.0': dependencies: - '@prisma/debug': 7.1.0 + '@prisma/debug': 7.2.0 '@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584': {} '@prisma/query-plan-executor@6.18.0': {} - '@prisma/studio-core@0.8.2(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)': + '@prisma/studio-core@0.9.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)': dependencies: '@types/react': 19.2.7 react: 19.2.1 @@ -6815,12 +6820,12 @@ snapshots: ansi-styles: 5.2.0 react-is: 18.3.1 - prisma@7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3): + prisma@7.2.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3): dependencies: - '@prisma/config': 7.1.0 - '@prisma/dev': 0.15.0(typescript@5.9.3) - '@prisma/engines': 7.1.0 - '@prisma/studio-core': 0.8.2(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1) + '@prisma/config': 7.2.0 + '@prisma/dev': 0.17.0(typescript@5.9.3) + '@prisma/engines': 7.2.0 + '@prisma/studio-core': 0.9.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1) mysql2: 3.15.3 postgres: 3.4.7 optionalDependencies: diff --git a/prisma/migrations/20251230122834_update/migration.sql b/prisma/migrations/20251230122834_update/migration.sql new file mode 100644 index 0000000..a8403e7 --- /dev/null +++ b/prisma/migrations/20251230122834_update/migration.sql @@ -0,0 +1,50 @@ +/* + 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 new file mode 100644 index 0000000..ebe5cd4 --- /dev/null +++ b/prisma/migrations/20251230154405_update/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `Products` ADD COLUMN `minimumStockAlertLevel` DECIMAL(10, 0) NOT NULL DEFAULT 1.00; diff --git a/prisma/schema/inventory.prisma b/prisma/schema/inventory.prisma index 0d8b005..fefed3f 100644 --- a/prisma/schema/inventory.prisma +++ b/prisma/schema/inventory.prisma @@ -10,7 +10,6 @@ model Inventory { inventoryTransfersFrom InventoryTransfer[] @relation("Inventory_From") inventoryTransfersTo InventoryTransfer[] @relation("Inventory_To") purchaseReceipts PurchaseReceipt[] - salesInvoices SalesInvoice[] @relation("Inventory_SalesInvoices") stockAdjustments StockAdjustment[] @relation("Inventory_Stock_Adjustments") stockBalances StockBalance[] @relation("StockBalance_inventory") counterStockMovements StockMovement[] @relation("StockMovement_CounterInventory") @@ -24,9 +23,10 @@ model InventoryBankAccount { inventoryId Int bankAccountId Int - inventory Inventory @relation(fields: [inventoryId], references: [id]) - bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) - posAccounts PosAccount[] + inventory Inventory @relation(fields: [inventoryId], references: [id]) + bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) + posAccounts PosAccount[] + purchaseReceiptPayments PurchaseReceiptPayments[] @@id([inventoryId, bankAccountId]) @@index([bankAccountId]) @@ -45,6 +45,7 @@ model PosAccount { deletedAt DateTime? @db.Timestamp(0) inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId]) + salesInvoices SalesInvoice[] @@index([inventoryId]) @@map("Pos_Accounts") diff --git a/prisma/schema/others.prisma b/prisma/schema/others.prisma index cc3c7aa..e87ff52 100644 --- a/prisma/schema/others.prisma +++ b/prisma/schema/others.prisma @@ -12,9 +12,9 @@ model Customer { createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) - orders Order[] @relation("Customer_Orders") - salesInvoices SalesInvoice[] @relation("Customer_Sales_Invoices") - stockMovements StockMovement[] @relation("StockMovement_Customer") + orders Order[] @relation() + stockMovements StockMovement[] @relation() + salesInvoices SalesInvoice[] @@map("Customers") } @@ -30,27 +30,27 @@ model Order { updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) customerId Int - customer Customer @relation("Customer_Orders", fields: [customerId], references: [id], onUpdate: NoAction) + customer Customer @relation(fields: [customerId], references: [id], onUpdate: NoAction) - @@index([customerId], map: "Orders_customerId_fkey") + @@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? - inventoryId Int - items SalesInvoiceItem[] @relation("SalesInvoice_Items") - customer Customer? @relation("Customer_Sales_Invoices", fields: [customerId], references: [id]) - inventory Inventory @relation("Inventory_SalesInvoices", fields: [inventoryId], references: [id]) + 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([inventoryId], map: "Sales_Invoices_inventoryId_fkey") - @@index([customerId], map: "Sales_Invoices_customerId_fkey") + @@index([customerId]) + @@index([posAccountId]) @@map("Sales_Invoices") } @@ -62,11 +62,11 @@ model SalesInvoiceItem { createdAt DateTime @default(now()) @db.Timestamp(0) invoiceId Int productId Int - invoice SalesInvoice @relation("SalesInvoice_Items", fields: [invoiceId], references: [id]) - product Product @relation("Product_SalesInvoiceItems", fields: [productId], references: [id]) + invoice SalesInvoice @relation(fields: [invoiceId], references: [id]) + product Product @relation(fields: [productId], references: [id]) - @@index([invoiceId], map: "Sales_Invoice_Items_invoiceId_fkey") - @@index([productId], map: "Sales_Invoice_Items_productId_fkey") + @@index([invoiceId]) + @@index([productId]) @@map("Sales_Invoice_Items") } diff --git a/prisma/schema/product.prisma b/prisma/schema/product.prisma index 6c91d2c..4b96a25 100644 --- a/prisma/schema/product.prisma +++ b/prisma/schema/product.prisma @@ -4,7 +4,7 @@ model ProductVariant { basePrice Decimal @db.Decimal(15, 2) salePrice Decimal @db.Decimal(15, 2) description String? @db.Text - barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100) + barcode String? @unique() @db.VarChar(100) imageUrl String? @db.VarChar(255) unit String? @db.VarChar(10) quantity Decimal? @default(0.00) @db.Decimal(10, 0) @@ -25,24 +25,24 @@ model Product { id Int @id @default(autoincrement()) name String @db.VarChar(255) description String? @db.Text - sku String? @unique(map: "products_sku_unique") @db.VarChar(100) - barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100) + sku String? @unique() @db.VarChar(100) + barcode String? @unique() @db.VarChar(100) createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) brandId Int? categoryId Int? salePrice Decimal @default(0.00) @db.Decimal(15, 0) + minimumStockAlertLevel Decimal @default(1.00) @db.Decimal(10, 0) inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product") - // productCharges ProductCharge[] @relation("Product_Charges") variants ProductVariant[] @relation("Product_Variant") brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction) category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction) purchaseReceiptItems PurchaseReceiptItem[] @relation("Product_PurchaseReceiptItems") - salesInvoiceItems SalesInvoiceItem[] @relation("Product_SalesInvoiceItems") stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments") stockBalances StockBalance[] @relation("StockBalance_Product") stockMovements StockMovement[] @relation("StockMovement_Product") + salesInvoiceItems SalesInvoiceItem[] @@index([brandId], map: "Products_brandId_fkey") @@index([categoryId], map: "Products_categoryId_fkey") diff --git a/prisma/schema/purchase.prisma b/prisma/schema/purchase.prisma index a9a728d..9f960b9 100644 --- a/prisma/schema/purchase.prisma +++ b/prisma/schema/purchase.prisma @@ -47,8 +47,11 @@ model PurchaseReceiptPayments { description String? @db.Text createdAt DateTime @default(now()) @db.Timestamp(0) - receipt PurchaseReceipt @relation(fields: [receiptId], references: [id]) - bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) + receipt PurchaseReceipt @relation(fields: [receiptId], references: [id]) + bankAccount BankAccount @relation(fields: [bankAccountId], references: [id]) + inventoryBankAccount InventoryBankAccount? @relation(fields: [inventoryBankAccountInventoryId, inventoryBankAccountBankAccountId], references: [inventoryId, bankAccountId]) + inventoryBankAccountInventoryId Int? + inventoryBankAccountBankAccountId Int? @@index([receiptId], map: "Purchase_Receipt_Payments_receiptId_fkey") @@map("Purchase_Receipt_Payments") diff --git a/prisma/schema/stock.prisma b/prisma/schema/stock.prisma index f38ab7e..8df0580 100644 --- a/prisma/schema/stock.prisma +++ b/prisma/schema/stock.prisma @@ -15,7 +15,7 @@ model StockMovement { counterInventoryId Int? customerId Int? counterInventory Inventory? @relation("StockMovement_CounterInventory", fields: [counterInventoryId], references: [id]) - customer Customer? @relation("StockMovement_Customer", fields: [customerId], references: [id]) + customer Customer? @relation(fields: [customerId], references: [id]) inventory Inventory @relation("StockMovement_Inventory", fields: [inventoryId], references: [id]) product Product @relation("StockMovement_Product", fields: [productId], references: [id]) supplier Supplier? @relation("StockMovement_Supplier", fields: [supplierId], references: [id]) diff --git a/prisma/triggers/dump_triggers.sql b/prisma/triggers/dump_triggers.sql index d9784a2..8ff0cd1 100644 --- a/prisma/triggers/dump_triggers.sql +++ b/prisma/triggers/dump_triggers.sql @@ -1,5 +1,5 @@ -- AUTO-GENERATED MYSQL TRIGGER DUMP --- Generated at: 2025-12-26T18:34:53.930Z +-- Generated at: 2025-12-30T15:42:45.224Z -- ------------------------------------------ -- Trigger: trg_transfer_item_after_insert @@ -7,7 +7,6 @@ -- 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; @@ -45,13 +44,12 @@ end; -- Table: Purchase_Receipt_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_purchase_receipt_item_after_insert`; - CREATE DEFINER=`pos`@`%` TRIGGER `trg_purchase_receipt_item_after_insert` AFTER INSERT ON `Purchase_Receipt_Items` FOR EACH ROW BEGIN DECLARE latestQuantity DECIMAL(10, 2) DEFAULT 0; DECLARE invId INT; DECLARE suppId INT; - -- Get inventory & supplier from receipt + -- Get inventory & supplier from SELECT inventoryId, supplierId INTO invId, suppId FROM Purchase_Receipts @@ -108,11 +106,12 @@ END; -- 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 FROM Purchase_Receipts @@ -131,19 +130,20 @@ END; -- 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; + 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 +SELECT COALESCE(totalAmount, 0), COALESCE(paidAmount, 0), supplierId + INTO receiptTotal, newPaid, _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 @@ -168,7 +168,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_insert` AFTER INSERT ON ` SELECT IFNULL(balance, 0) INTO lastBalance FROM Supplier_Ledger - WHERE supplierId = supplierId + WHERE supplierId = _supplierId ORDER BY id DESC LIMIT 1; @@ -185,13 +185,13 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_insert` AFTER INSERT ON ` ) VALUES ( - supplierId, + _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), - 'PURCHASE_PAYMENT', + 'PAYMENT', NEW.id, NOW() ); @@ -203,7 +203,6 @@ END; -- Table: Purchase_Receipt_Payments -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_pr_payment_after_delete`; - 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); @@ -238,7 +237,6 @@ END; -- 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; @@ -277,16 +275,18 @@ END; -- Table: Sales_Invoice_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_sales_invoice_items_before_insert`; +CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE INSERT ON `Sales_Invoice_Items` FOR EACH ROW BEGIN -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; + 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 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 @@ -307,17 +307,28 @@ end; -- Table: Sales_Invoice_Items -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_sales_invoice_items_after_insert`; - CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_after_insert` AFTER INSERT ON `Sales_Invoice_Items` FOR EACH ROW begin DECLARE current_stock DECIMAL(10, 2); DECLARE inventory_id INT; DECLARE customer_id INT; +DECLARE pos_id INT; - SELECT inventoryId , customerId INTO inventory_id, customer_id + + 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 @@ -354,7 +365,7 @@ DECLARE customer_id INT; WHEN NEW.count = 0 THEN 0 ELSE NEW.total / NEW.count END, - current_stock + NEW.count, + current_stock - NEW.count, customer_id, NOW() ); @@ -368,7 +379,6 @@ END; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_transfer`; - CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_transfer` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'INVENTORY_TRANSFER' THEN IF NEW.type = 'IN' THEN INSERT INTO Stock_Balance ( @@ -451,7 +461,6 @@ END; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_purchase_insert`; - CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_purchase_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'PURCHASE' THEN INSERT INTO @@ -486,7 +495,6 @@ END; -- Table: Stock_Movements -- ------------------------------------------ DROP TRIGGER IF EXISTS `trg_stock_sale_insert`; - CREATE DEFINER=`pos`@`%` TRIGGER `trg_stock_sale_insert` AFTER INSERT ON `Stock_Movements` FOR EACH ROW BEGIN IF NEW.referenceType = 'SALES' THEN INSERT INTO @@ -514,3 +522,4 @@ ON DUPLICATE KEY UPDATE END IF; END; + diff --git a/src/generated/prisma/internal/class.ts b/src/generated/prisma/internal/class.ts index 2823129..28b44bd 100644 --- a/src/generated/prisma/internal/class.ts +++ b/src/generated/prisma/internal/class.ts @@ -17,10 +17,10 @@ import type * as Prisma from "./prismaNamespace.js" const config: runtime.GetPrismaClientConfig = { "previewFeatures": [], - "clientVersion": "7.1.0", - "engineVersion": "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba", + "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 salesInvoices SalesInvoice[] @relation(\"Inventory_SalesInvoices\")\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\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\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(\"Customer_Orders\")\n salesInvoices SalesInvoice[] @relation(\"Customer_Sales_Invoices\")\n stockMovements StockMovement[] @relation(\"StockMovement_Customer\")\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(\"Customer_Orders\", fields: [customerId], references: [id], onUpdate: NoAction)\n\n @@index([customerId], map: \"Orders_customerId_fkey\")\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 inventoryId Int\n items SalesInvoiceItem[] @relation(\"SalesInvoice_Items\")\n customer Customer? @relation(\"Customer_Sales_Invoices\", fields: [customerId], references: [id])\n inventory Inventory @relation(\"Inventory_SalesInvoices\", fields: [inventoryId], references: [id])\n\n @@index([inventoryId], map: \"Sales_Invoices_inventoryId_fkey\")\n @@index([customerId], map: \"Sales_Invoices_customerId_fkey\")\n @@map(\"Sales_Invoices\")\n}\n\nmodel SalesInvoiceItem {\n id Int @id @default(autoincrement())\n count Decimal @db.Decimal(10, 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(\"SalesInvoice_Items\", fields: [invoiceId], references: [id])\n product Product @relation(\"Product_SalesInvoiceItems\", fields: [productId], references: [id])\n\n @@index([invoiceId], map: \"Sales_Invoice_Items_invoiceId_fkey\")\n @@index([productId], map: \"Sales_Invoice_Items_productId_fkey\")\n @@map(\"Sales_Invoice_Items\")\n}\n\nmodel 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(map: \"products_barcode_unique\") @db.VarChar(100)\n imageUrl String? @db.VarChar(255)\n unit String? @db.VarChar(10)\n quantity Decimal? @default(0.00) @db.Decimal(10, 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(map: \"products_sku_unique\") @db.VarChar(100)\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n brandId Int?\n categoryId Int?\n salePrice Decimal @default(0.00) @db.Decimal(15, 0)\n inventoryTransferItems InventoryTransferItem[] @relation(\"InventoryTransferItem_Product\")\n // productCharges ProductCharge[] @relation(\"Product_Charges\")\n variants ProductVariant[] @relation(\"Product_Variant\")\n brand ProductBrand? @relation(\"Product_Brand\", fields: [brandId], references: [id], onUpdate: NoAction)\n category ProductCategory? @relation(\"Product_Category\", fields: [categoryId], references: [id], onUpdate: NoAction)\n purchaseReceiptItems PurchaseReceiptItem[] @relation(\"Product_PurchaseReceiptItems\")\n salesInvoiceItems SalesInvoiceItem[] @relation(\"Product_SalesInvoiceItems\")\n stockAdjustments StockAdjustment[] @relation(\"Product_Stock_Adjustments\")\n stockBalances StockBalance[] @relation(\"StockBalance_Product\")\n stockMovements StockMovement[] @relation(\"StockMovement_Product\")\n\n @@index([brandId], map: \"Products_brandId_fkey\")\n @@index([categoryId], map: \"Products_categoryId_fkey\")\n @@map(\"Products\")\n}\n\nmodel ProductBrand {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Brand\")\n\n @@map(\"Product_brands\")\n}\n\nmodel ProductCategory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n products Product[] @relation(\"Product_Category\")\n\n @@map(\"Product_categories\")\n}\n\nmodel 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\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(\"StockMovement_Customer\", 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\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", "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\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Inventory_SalesInvoices\"},{\"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\"}],\"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\"}],\"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\":\"Customer_Orders\"},{\"name\":\"salesInvoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"Customer_Sales_Invoices\"},{\"name\":\"stockMovements\",\"kind\":\"object\",\"type\":\"StockMovement\",\"relationName\":\"StockMovement_Customer\"}],\"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\":\"Customer_Orders\"}],\"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\":\"inventoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"Customer_Sales_Invoices\"},{\"name\":\"inventory\",\"kind\":\"object\",\"type\":\"Inventory\",\"relationName\":\"Inventory_SalesInvoices\"}],\"dbName\":\"Sales_Invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"count\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoiceId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoice_Items\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_SalesInvoiceItems\"}],\"dbName\":\"Sales_Invoice_Items\"},\"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\":\"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\":\"salesInvoiceItems\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"Product_SalesInvoiceItems\"},{\"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\"}],\"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\"}],\"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\":\"StockMovement_Customer\"},{\"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\"}],\"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\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') diff --git a/src/generated/prisma/internal/prismaNamespace.ts b/src/generated/prisma/internal/prismaNamespace.ts index 0e66c23..97ddd94 100644 --- a/src/generated/prisma/internal/prismaNamespace.ts +++ b/src/generated/prisma/internal/prismaNamespace.ts @@ -80,12 +80,12 @@ export type PrismaVersion = { } /** - * Prisma Client JS version: 7.1.0 - * Query Engine version: ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba + * Prisma Client JS version: 7.2.0 + * Query Engine version: 0c8ef2ce45c83248ab3df073180d5eda9e8be7a3 */ export const prismaVersion: PrismaVersion = { - client: "7.1.0", - engine: "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba" + client: "7.2.0", + engine: "0c8ef2ce45c83248ab3df073180d5eda9e8be7a3" } /** @@ -2580,7 +2580,7 @@ export const SalesInvoiceScalarFieldEnum = { createdAt: 'createdAt', updatedAt: 'updatedAt', customerId: 'customerId', - inventoryId: 'inventoryId' + posAccountId: 'posAccountId' } as const export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] @@ -2642,7 +2642,8 @@ export const ProductScalarFieldEnum = { deletedAt: 'deletedAt', brandId: 'brandId', categoryId: 'categoryId', - salePrice: 'salePrice' + salePrice: 'salePrice', + minimumStockAlertLevel: 'minimumStockAlertLevel' } as const export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum] @@ -2713,7 +2714,9 @@ export const PurchaseReceiptPaymentsScalarFieldEnum = { receiptId: 'receiptId', payedAt: 'payedAt', description: 'description', - createdAt: 'createdAt' + createdAt: 'createdAt', + inventoryBankAccountInventoryId: 'inventoryBankAccountInventoryId', + inventoryBankAccountBankAccountId: 'inventoryBankAccountBankAccountId' } as const export type PurchaseReceiptPaymentsScalarFieldEnum = (typeof PurchaseReceiptPaymentsScalarFieldEnum)[keyof typeof PurchaseReceiptPaymentsScalarFieldEnum] diff --git a/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/generated/prisma/internal/prismaNamespaceBrowser.ts index 487cbbf..2fe93a0 100644 --- a/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -293,7 +293,7 @@ export const SalesInvoiceScalarFieldEnum = { createdAt: 'createdAt', updatedAt: 'updatedAt', customerId: 'customerId', - inventoryId: 'inventoryId' + posAccountId: 'posAccountId' } as const export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum] @@ -355,7 +355,8 @@ export const ProductScalarFieldEnum = { deletedAt: 'deletedAt', brandId: 'brandId', categoryId: 'categoryId', - salePrice: 'salePrice' + salePrice: 'salePrice', + minimumStockAlertLevel: 'minimumStockAlertLevel' } as const export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum] @@ -426,7 +427,9 @@ export const PurchaseReceiptPaymentsScalarFieldEnum = { receiptId: 'receiptId', payedAt: 'payedAt', description: 'description', - createdAt: 'createdAt' + createdAt: 'createdAt', + inventoryBankAccountInventoryId: 'inventoryBankAccountInventoryId', + inventoryBankAccountBankAccountId: 'inventoryBankAccountBankAccountId' } as const export type PurchaseReceiptPaymentsScalarFieldEnum = (typeof PurchaseReceiptPaymentsScalarFieldEnum)[keyof typeof PurchaseReceiptPaymentsScalarFieldEnum] diff --git a/src/generated/prisma/models/Customer.ts b/src/generated/prisma/models/Customer.ts index fe807db..b9cc610 100644 --- a/src/generated/prisma/models/Customer.ts +++ b/src/generated/prisma/models/Customer.ts @@ -281,8 +281,8 @@ export type CustomerWhereInput = { updatedAt?: Prisma.DateTimeFilter<"Customer"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null orders?: Prisma.OrderListRelationFilter - salesInvoices?: Prisma.SalesInvoiceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + salesInvoices?: Prisma.SalesInvoiceListRelationFilter } export type CustomerOrderByWithRelationInput = { @@ -300,8 +300,8 @@ export type CustomerOrderByWithRelationInput = { updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder orders?: Prisma.OrderOrderByRelationAggregateInput - salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput + salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput _relevance?: Prisma.CustomerOrderByRelevanceInput } @@ -323,8 +323,8 @@ export type CustomerWhereUniqueInput = Prisma.AtLeast<{ updatedAt?: Prisma.DateTimeFilter<"Customer"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null orders?: Prisma.OrderListRelationFilter - salesInvoices?: Prisma.SalesInvoiceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + salesInvoices?: Prisma.SalesInvoiceListRelationFilter }, "id" | "mobileNumber"> export type CustomerOrderByWithAggregationInput = { @@ -381,8 +381,8 @@ export type CustomerCreateInput = { updatedAt?: Date | string deletedAt?: Date | string | null orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput } export type CustomerUncheckedCreateInput = { @@ -400,8 +400,8 @@ export type CustomerUncheckedCreateInput = { updatedAt?: Date | string deletedAt?: Date | string | null orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput } export type CustomerUpdateInput = { @@ -418,8 +418,8 @@ export type CustomerUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput } export type CustomerUncheckedUpdateInput = { @@ -437,8 +437,8 @@ export type CustomerUncheckedUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput } export type CustomerCreateManyInput = { @@ -619,8 +619,8 @@ export type CustomerCreateWithoutOrdersInput = { createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput } export type CustomerUncheckedCreateWithoutOrdersInput = { @@ -637,8 +637,8 @@ export type CustomerUncheckedCreateWithoutOrdersInput = { createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCustomerInput + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput } export type CustomerCreateOrConnectWithoutOrdersInput = { @@ -670,8 +670,8 @@ export type CustomerUpdateWithoutOrdersInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput } export type CustomerUncheckedUpdateWithoutOrdersInput = { @@ -688,8 +688,8 @@ export type CustomerUncheckedUpdateWithoutOrdersInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCustomerNestedInput + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput } export type CustomerCreateWithoutSalesInvoicesInput = { @@ -871,14 +871,14 @@ export type CustomerUncheckedUpdateWithoutStockMovementsInput = { export type CustomerCountOutputType = { orders: number - salesInvoices: number stockMovements: number + salesInvoices: number } export type CustomerCountOutputTypeSelect = { orders?: boolean | CustomerCountOutputTypeCountOrdersArgs - salesInvoices?: boolean | CustomerCountOutputTypeCountSalesInvoicesArgs stockMovements?: boolean | CustomerCountOutputTypeCountStockMovementsArgs + salesInvoices?: boolean | CustomerCountOutputTypeCountSalesInvoicesArgs } /** @@ -901,15 +901,15 @@ export type CustomerCountOutputTypeCountOrdersArgs = { - where?: Prisma.SalesInvoiceWhereInput +export type CustomerCountOutputTypeCountStockMovementsArgs = { + where?: Prisma.StockMovementWhereInput } /** * CustomerCountOutputType without action */ -export type CustomerCountOutputTypeCountStockMovementsArgs = { - where?: Prisma.StockMovementWhereInput +export type CustomerCountOutputTypeCountSalesInvoicesArgs = { + where?: Prisma.SalesInvoiceWhereInput } @@ -928,8 +928,8 @@ export type CustomerSelect - salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs stockMovements?: boolean | Prisma.Customer$stockMovementsArgs + salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs }, ExtArgs["result"]["customer"]> @@ -954,8 +954,8 @@ export type CustomerSelectScalar = { export type CustomerOmit = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["customer"]> export type CustomerInclude = { orders?: boolean | Prisma.Customer$ordersArgs - salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs stockMovements?: boolean | Prisma.Customer$stockMovementsArgs + salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs } @@ -963,8 +963,8 @@ export type $CustomerPayload[] - salesInvoices: Prisma.$SalesInvoicePayload[] stockMovements: Prisma.$StockMovementPayload[] + salesInvoices: Prisma.$SalesInvoicePayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1321,8 +1321,8 @@ readonly fields: CustomerFieldRefs; export interface Prisma__CustomerClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" orders = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - salesInvoices = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + salesInvoices = {}>(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. @@ -1731,30 +1731,6 @@ export type Customer$ordersArgs = { - /** - * Select specific fields to fetch from the SalesInvoice - */ - select?: Prisma.SalesInvoiceSelect | null - /** - * Omit specific fields from the SalesInvoice - */ - omit?: Prisma.SalesInvoiceOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SalesInvoiceInclude | null - where?: Prisma.SalesInvoiceWhereInput - orderBy?: Prisma.SalesInvoiceOrderByWithRelationInput | Prisma.SalesInvoiceOrderByWithRelationInput[] - cursor?: Prisma.SalesInvoiceWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[] -} - /** * Customer.stockMovements */ @@ -1779,6 +1755,30 @@ export type Customer$stockMovementsArgs = { + /** + * Select specific fields to fetch from the SalesInvoice + */ + select?: Prisma.SalesInvoiceSelect | null + /** + * Omit specific fields from the SalesInvoice + */ + omit?: Prisma.SalesInvoiceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoiceInclude | null + where?: Prisma.SalesInvoiceWhereInput + orderBy?: Prisma.SalesInvoiceOrderByWithRelationInput | Prisma.SalesInvoiceOrderByWithRelationInput[] + cursor?: Prisma.SalesInvoiceWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[] +} + /** * Customer without action */ diff --git a/src/generated/prisma/models/Inventory.ts b/src/generated/prisma/models/Inventory.ts index 621d743..ffdf298 100644 --- a/src/generated/prisma/models/Inventory.ts +++ b/src/generated/prisma/models/Inventory.ts @@ -243,7 +243,6 @@ export type InventoryWhereInput = { inventoryTransfersFrom?: Prisma.InventoryTransferListRelationFilter inventoryTransfersTo?: Prisma.InventoryTransferListRelationFilter purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter - salesInvoices?: Prisma.SalesInvoiceListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter counterStockMovements?: Prisma.StockMovementListRelationFilter @@ -263,7 +262,6 @@ export type InventoryOrderByWithRelationInput = { inventoryTransfersFrom?: Prisma.InventoryTransferOrderByRelationAggregateInput inventoryTransfersTo?: Prisma.InventoryTransferOrderByRelationAggregateInput purchaseReceipts?: Prisma.PurchaseReceiptOrderByRelationAggregateInput - salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput stockAdjustments?: Prisma.StockAdjustmentOrderByRelationAggregateInput stockBalances?: Prisma.StockBalanceOrderByRelationAggregateInput counterStockMovements?: Prisma.StockMovementOrderByRelationAggregateInput @@ -287,7 +285,6 @@ export type InventoryWhereUniqueInput = Prisma.AtLeast<{ inventoryTransfersFrom?: Prisma.InventoryTransferListRelationFilter inventoryTransfersTo?: Prisma.InventoryTransferListRelationFilter purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter - salesInvoices?: Prisma.SalesInvoiceListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter counterStockMovements?: Prisma.StockMovementListRelationFilter @@ -336,7 +333,6 @@ export type InventoryCreateInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -356,7 +352,6 @@ export type InventoryUncheckedCreateInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -375,7 +370,6 @@ export type InventoryUpdateInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -395,7 +389,6 @@ export type InventoryUncheckedUpdateInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput @@ -534,20 +527,6 @@ export type InventoryUpdateOneRequiredWithoutInventoryTransfersToNestedInput = { update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutInventoryTransfersToInput> } -export type InventoryCreateNestedOneWithoutSalesInvoicesInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutSalesInvoicesInput - connect?: Prisma.InventoryWhereUniqueInput -} - -export type InventoryUpdateOneRequiredWithoutSalesInvoicesNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutSalesInvoicesInput - upsert?: Prisma.InventoryUpsertWithoutSalesInvoicesInput - connect?: Prisma.InventoryWhereUniqueInput - update?: Prisma.XOR, Prisma.InventoryUncheckedUpdateWithoutSalesInvoicesInput> -} - export type InventoryCreateNestedOneWithoutPurchaseReceiptsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.InventoryCreateOrConnectWithoutPurchaseReceiptsInput @@ -631,7 +610,6 @@ export type InventoryCreateWithoutInventoryBankAccountsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -650,7 +628,6 @@ export type InventoryUncheckedCreateWithoutInventoryBankAccountsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -684,7 +661,6 @@ export type InventoryUpdateWithoutInventoryBankAccountsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -703,7 +679,6 @@ export type InventoryUncheckedUpdateWithoutInventoryBankAccountsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput @@ -720,7 +695,6 @@ export type InventoryCreateWithoutInventoryTransfersFromInput = { isPointOfSale?: boolean inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -739,7 +713,6 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersFromInput = { isPointOfSale?: boolean inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -762,7 +735,6 @@ export type InventoryCreateWithoutInventoryTransfersToInput = { isPointOfSale?: boolean inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -781,7 +753,6 @@ export type InventoryUncheckedCreateWithoutInventoryTransfersToInput = { isPointOfSale?: boolean inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -815,7 +786,6 @@ export type InventoryUpdateWithoutInventoryTransfersFromInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -834,7 +804,6 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersFromInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput @@ -863,7 +832,6 @@ export type InventoryUpdateWithoutInventoryTransfersToInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -882,97 +850,6 @@ export type InventoryUncheckedUpdateWithoutInventoryTransfersToInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput - stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput - stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput - counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput - stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput - inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutInventoryNestedInput -} - -export type InventoryCreateWithoutSalesInvoicesInput = { - 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 InventoryUncheckedCreateWithoutSalesInvoicesInput = { - 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 InventoryCreateOrConnectWithoutSalesInvoicesInput = { - where: Prisma.InventoryWhereUniqueInput - create: Prisma.XOR -} - -export type InventoryUpsertWithoutSalesInvoicesInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.InventoryWhereInput -} - -export type InventoryUpdateToOneWithWhereWithoutSalesInvoicesInput = { - where?: Prisma.InventoryWhereInput - data: Prisma.XOR -} - -export type InventoryUpdateWithoutSalesInvoicesInput = { - 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 InventoryUncheckedUpdateWithoutSalesInvoicesInput = { - 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 @@ -990,7 +867,6 @@ export type InventoryCreateWithoutPurchaseReceiptsInput = { isPointOfSale?: boolean inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -1009,7 +885,6 @@ export type InventoryUncheckedCreateWithoutPurchaseReceiptsInput = { isPointOfSale?: boolean inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -1043,7 +918,6 @@ export type InventoryUpdateWithoutPurchaseReceiptsInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -1062,7 +936,6 @@ export type InventoryUncheckedUpdateWithoutPurchaseReceiptsInput = { isPointOfSale?: Prisma.BoolFieldUpdateOperationsInput | boolean inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput @@ -1081,7 +954,6 @@ export type InventoryCreateWithoutCounterStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput @@ -1100,7 +972,6 @@ export type InventoryUncheckedCreateWithoutCounterStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput @@ -1123,7 +994,6 @@ export type InventoryCreateWithoutStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput @@ -1142,7 +1012,6 @@ export type InventoryUncheckedCreateWithoutStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput @@ -1176,7 +1045,6 @@ export type InventoryUpdateWithoutCounterStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput @@ -1195,7 +1063,6 @@ export type InventoryUncheckedUpdateWithoutCounterStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput @@ -1224,7 +1091,6 @@ export type InventoryUpdateWithoutStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput @@ -1243,7 +1109,6 @@ export type InventoryUncheckedUpdateWithoutStockMovementsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput @@ -1261,7 +1126,6 @@ export type InventoryCreateWithoutStockBalancesInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput @@ -1280,7 +1144,6 @@ export type InventoryUncheckedCreateWithoutStockBalancesInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput @@ -1314,7 +1177,6 @@ export type InventoryUpdateWithoutStockBalancesInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput @@ -1333,7 +1195,6 @@ export type InventoryUncheckedUpdateWithoutStockBalancesInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput @@ -1351,7 +1212,6 @@ export type InventoryCreateWithoutStockAdjustmentsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutInventoryInput @@ -1370,7 +1230,6 @@ export type InventoryUncheckedCreateWithoutStockAdjustmentsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutFromInventoryInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedCreateNestedManyWithoutToInventoryInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutInventoryInput - salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutInventoryInput counterStockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutCounterInventoryInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutInventoryInput @@ -1404,7 +1263,6 @@ export type InventoryUpdateWithoutStockAdjustmentsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutInventoryNestedInput @@ -1423,7 +1281,6 @@ export type InventoryUncheckedUpdateWithoutStockAdjustmentsInput = { inventoryTransfersFrom?: Prisma.InventoryTransferUncheckedUpdateManyWithoutFromInventoryNestedInput inventoryTransfersTo?: Prisma.InventoryTransferUncheckedUpdateManyWithoutToInventoryNestedInput purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutInventoryNestedInput - salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutInventoryNestedInput counterStockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutCounterInventoryNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutInventoryNestedInput @@ -1439,7 +1296,6 @@ export type InventoryCountOutputType = { inventoryTransfersFrom: number inventoryTransfersTo: number purchaseReceipts: number - salesInvoices: number stockAdjustments: number stockBalances: number counterStockMovements: number @@ -1451,7 +1307,6 @@ export type InventoryCountOutputTypeSelect = { - where?: Prisma.SalesInvoiceWhereInput -} - /** * InventoryCountOutputType without action */ @@ -1545,7 +1393,6 @@ export type InventorySelect inventoryTransfersTo?: boolean | Prisma.Inventory$inventoryTransfersToArgs purchaseReceipts?: boolean | Prisma.Inventory$purchaseReceiptsArgs - salesInvoices?: boolean | Prisma.Inventory$salesInvoicesArgs stockAdjustments?: boolean | Prisma.Inventory$stockAdjustmentsArgs stockBalances?: boolean | Prisma.Inventory$stockBalancesArgs counterStockMovements?: boolean | Prisma.Inventory$counterStockMovementsArgs @@ -1572,7 +1419,6 @@ export type InventoryInclude inventoryTransfersTo?: boolean | Prisma.Inventory$inventoryTransfersToArgs purchaseReceipts?: boolean | Prisma.Inventory$purchaseReceiptsArgs - salesInvoices?: boolean | Prisma.Inventory$salesInvoicesArgs stockAdjustments?: boolean | Prisma.Inventory$stockAdjustmentsArgs stockBalances?: boolean | Prisma.Inventory$stockBalancesArgs counterStockMovements?: boolean | Prisma.Inventory$counterStockMovementsArgs @@ -1587,7 +1433,6 @@ export type $InventoryPayload[] inventoryTransfersTo: Prisma.$InventoryTransferPayload[] purchaseReceipts: Prisma.$PurchaseReceiptPayload[] - salesInvoices: Prisma.$SalesInvoicePayload[] stockAdjustments: Prisma.$StockAdjustmentPayload[] stockBalances: Prisma.$StockBalancePayload[] counterStockMovements: Prisma.$StockMovementPayload[] @@ -1946,7 +1791,6 @@ export interface Prisma__InventoryClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> inventoryTransfersTo = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> purchaseReceipts = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - salesInvoices = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockAdjustments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockBalances = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> counterStockMovements = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> @@ -2403,30 +2247,6 @@ export type Inventory$purchaseReceiptsArgs = { - /** - * Select specific fields to fetch from the SalesInvoice - */ - select?: Prisma.SalesInvoiceSelect | null - /** - * Omit specific fields from the SalesInvoice - */ - omit?: Prisma.SalesInvoiceOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SalesInvoiceInclude | null - where?: Prisma.SalesInvoiceWhereInput - orderBy?: Prisma.SalesInvoiceOrderByWithRelationInput | Prisma.SalesInvoiceOrderByWithRelationInput[] - cursor?: Prisma.SalesInvoiceWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[] -} - /** * Inventory.stockAdjustments */ diff --git a/src/generated/prisma/models/InventoryBankAccount.ts b/src/generated/prisma/models/InventoryBankAccount.ts index 58a6722..6678fed 100644 --- a/src/generated/prisma/models/InventoryBankAccount.ts +++ b/src/generated/prisma/models/InventoryBankAccount.ts @@ -199,6 +199,7 @@ export type InventoryBankAccountWhereInput = { inventory?: Prisma.XOR bankAccount?: Prisma.XOR posAccounts?: Prisma.PosAccountListRelationFilter + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter } export type InventoryBankAccountOrderByWithRelationInput = { @@ -207,6 +208,7 @@ export type InventoryBankAccountOrderByWithRelationInput = { inventory?: Prisma.InventoryOrderByWithRelationInput bankAccount?: Prisma.BankAccountOrderByWithRelationInput posAccounts?: Prisma.PosAccountOrderByRelationAggregateInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOrderByRelationAggregateInput } export type InventoryBankAccountWhereUniqueInput = Prisma.AtLeast<{ @@ -219,6 +221,7 @@ export type InventoryBankAccountWhereUniqueInput = Prisma.AtLeast<{ inventory?: Prisma.XOR bankAccount?: Prisma.XOR posAccounts?: Prisma.PosAccountListRelationFilter + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter }, "inventoryId_bankAccountId"> export type InventoryBankAccountOrderByWithAggregationInput = { @@ -243,24 +246,28 @@ export type InventoryBankAccountCreateInput = { inventory: Prisma.InventoryCreateNestedOneWithoutInventoryBankAccountsInput bankAccount: Prisma.BankAccountCreateNestedOneWithoutInventoryBankAccountsInput posAccounts?: Prisma.PosAccountCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountUncheckedCreateInput = { inventoryId: number bankAccountId: number posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountUpdateInput = { inventory?: Prisma.InventoryUpdateOneRequiredWithoutInventoryBankAccountsNestedInput bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutInventoryBankAccountsNestedInput posAccounts?: Prisma.PosAccountUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateInput = { inventoryId?: Prisma.IntFieldUpdateOperationsInput | number bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountCreateManyInput = { @@ -322,6 +329,11 @@ export type InventoryBankAccountScalarRelationFilter = { isNot?: Prisma.InventoryBankAccountWhereInput } +export type InventoryBankAccountNullableScalarRelationFilter = { + is?: Prisma.InventoryBankAccountWhereInput | null + isNot?: Prisma.InventoryBankAccountWhereInput | null +} + export type InventoryBankAccountCreateNestedManyWithoutBankAccountInput = { create?: Prisma.XOR | Prisma.InventoryBankAccountCreateWithoutBankAccountInput[] | Prisma.InventoryBankAccountUncheckedCreateWithoutBankAccountInput[] connectOrCreate?: Prisma.InventoryBankAccountCreateOrConnectWithoutBankAccountInput | Prisma.InventoryBankAccountCreateOrConnectWithoutBankAccountInput[] @@ -420,14 +432,32 @@ export type InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput = update?: Prisma.XOR, Prisma.InventoryBankAccountUncheckedUpdateWithoutPosAccountsInput> } +export type InventoryBankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryBankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput + connect?: Prisma.InventoryBankAccountWhereUniqueInput +} + +export type InventoryBankAccountUpdateOneWithoutPurchaseReceiptPaymentsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.InventoryBankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput + upsert?: Prisma.InventoryBankAccountUpsertWithoutPurchaseReceiptPaymentsInput + disconnect?: Prisma.InventoryBankAccountWhereInput | boolean + delete?: Prisma.InventoryBankAccountWhereInput | boolean + connect?: Prisma.InventoryBankAccountWhereUniqueInput + update?: Prisma.XOR, Prisma.InventoryBankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput> +} + export type InventoryBankAccountCreateWithoutBankAccountInput = { inventory: Prisma.InventoryCreateNestedOneWithoutInventoryBankAccountsInput posAccounts?: Prisma.PosAccountCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountUncheckedCreateWithoutBankAccountInput = { inventoryId: number posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountCreateOrConnectWithoutBankAccountInput = { @@ -467,11 +497,13 @@ export type InventoryBankAccountScalarWhereInput = { export type InventoryBankAccountCreateWithoutInventoryInput = { bankAccount: Prisma.BankAccountCreateNestedOneWithoutInventoryBankAccountsInput posAccounts?: Prisma.PosAccountCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountUncheckedCreateWithoutInventoryInput = { bankAccountId: number posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutInventoryBankAccountInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountCreateOrConnectWithoutInventoryInput = { @@ -503,11 +535,13 @@ export type InventoryBankAccountUpdateManyWithWhereWithoutInventoryInput = { export type InventoryBankAccountCreateWithoutPosAccountsInput = { inventory: Prisma.InventoryCreateNestedOneWithoutInventoryBankAccountsInput bankAccount: Prisma.BankAccountCreateNestedOneWithoutInventoryBankAccountsInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountUncheckedCreateWithoutPosAccountsInput = { inventoryId: number bankAccountId: number + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutInventoryBankAccountInput } export type InventoryBankAccountCreateOrConnectWithoutPosAccountsInput = { @@ -529,11 +563,53 @@ export type InventoryBankAccountUpdateToOneWithWhereWithoutPosAccountsInput = { export type InventoryBankAccountUpdateWithoutPosAccountsInput = { inventory?: Prisma.InventoryUpdateOneRequiredWithoutInventoryBankAccountsNestedInput bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutInventoryBankAccountsNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateWithoutPosAccountsInput = { inventoryId?: Prisma.IntFieldUpdateOperationsInput | number bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountNestedInput +} + +export type InventoryBankAccountCreateWithoutPurchaseReceiptPaymentsInput = { + inventory: Prisma.InventoryCreateNestedOneWithoutInventoryBankAccountsInput + bankAccount: Prisma.BankAccountCreateNestedOneWithoutInventoryBankAccountsInput + posAccounts?: Prisma.PosAccountCreateNestedManyWithoutInventoryBankAccountInput +} + +export type InventoryBankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = { + inventoryId: number + bankAccountId: number + posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutInventoryBankAccountInput +} + +export type InventoryBankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput = { + where: Prisma.InventoryBankAccountWhereUniqueInput + create: Prisma.XOR +} + +export type InventoryBankAccountUpsertWithoutPurchaseReceiptPaymentsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.InventoryBankAccountWhereInput +} + +export type InventoryBankAccountUpdateToOneWithWhereWithoutPurchaseReceiptPaymentsInput = { + where?: Prisma.InventoryBankAccountWhereInput + data: Prisma.XOR +} + +export type InventoryBankAccountUpdateWithoutPurchaseReceiptPaymentsInput = { + inventory?: Prisma.InventoryUpdateOneRequiredWithoutInventoryBankAccountsNestedInput + bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutInventoryBankAccountsNestedInput + posAccounts?: Prisma.PosAccountUpdateManyWithoutInventoryBankAccountNestedInput +} + +export type InventoryBankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = { + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountCreateManyBankAccountInput = { @@ -543,11 +619,13 @@ export type InventoryBankAccountCreateManyBankAccountInput = { export type InventoryBankAccountUpdateWithoutBankAccountInput = { inventory?: Prisma.InventoryUpdateOneRequiredWithoutInventoryBankAccountsNestedInput posAccounts?: Prisma.PosAccountUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateWithoutBankAccountInput = { inventoryId?: Prisma.IntFieldUpdateOperationsInput | number posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateManyWithoutBankAccountInput = { @@ -561,11 +639,13 @@ export type InventoryBankAccountCreateManyInventoryInput = { export type InventoryBankAccountUpdateWithoutInventoryInput = { bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutInventoryBankAccountsNestedInput posAccounts?: Prisma.PosAccountUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateWithoutInventoryInput = { bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput + purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountNestedInput } export type InventoryBankAccountUncheckedUpdateManyWithoutInventoryInput = { @@ -579,10 +659,12 @@ export type InventoryBankAccountUncheckedUpdateManyWithoutInventoryInput = { export type InventoryBankAccountCountOutputType = { posAccounts: number + purchaseReceiptPayments: number } export type InventoryBankAccountCountOutputTypeSelect = { posAccounts?: boolean | InventoryBankAccountCountOutputTypeCountPosAccountsArgs + purchaseReceiptPayments?: boolean | InventoryBankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs } /** @@ -602,6 +684,13 @@ export type InventoryBankAccountCountOutputTypeCountPosAccountsArgs = { + where?: Prisma.PurchaseReceiptPaymentsWhereInput +} + export type InventoryBankAccountSelect = runtime.Types.Extensions.GetSelect<{ inventoryId?: boolean @@ -609,6 +698,7 @@ export type InventoryBankAccountSelect bankAccount?: boolean | Prisma.BankAccountDefaultArgs posAccounts?: boolean | Prisma.InventoryBankAccount$posAccountsArgs + purchaseReceiptPayments?: boolean | Prisma.InventoryBankAccount$purchaseReceiptPaymentsArgs _count?: boolean | Prisma.InventoryBankAccountCountOutputTypeDefaultArgs }, ExtArgs["result"]["inventoryBankAccount"]> @@ -624,6 +714,7 @@ export type InventoryBankAccountInclude bankAccount?: boolean | Prisma.BankAccountDefaultArgs posAccounts?: boolean | Prisma.InventoryBankAccount$posAccountsArgs + purchaseReceiptPayments?: boolean | Prisma.InventoryBankAccount$purchaseReceiptPaymentsArgs _count?: boolean | Prisma.InventoryBankAccountCountOutputTypeDefaultArgs } @@ -633,6 +724,7 @@ export type $InventoryBankAccountPayload bankAccount: Prisma.$BankAccountPayload posAccounts: Prisma.$PosAccountPayload[] + purchaseReceiptPayments: Prisma.$PurchaseReceiptPaymentsPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ inventoryId: number @@ -980,6 +1072,7 @@ export interface Prisma__InventoryBankAccountClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> bankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__BankAccountClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> posAccounts = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + purchaseReceiptPayments = {}>(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. @@ -1377,6 +1470,30 @@ export type InventoryBankAccount$posAccountsArgs = { + /** + * Select specific fields to fetch from the PurchaseReceiptPayments + */ + select?: Prisma.PurchaseReceiptPaymentsSelect | null + /** + * Omit specific fields from the PurchaseReceiptPayments + */ + omit?: Prisma.PurchaseReceiptPaymentsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.PurchaseReceiptPaymentsInclude | null + where?: Prisma.PurchaseReceiptPaymentsWhereInput + orderBy?: Prisma.PurchaseReceiptPaymentsOrderByWithRelationInput | Prisma.PurchaseReceiptPaymentsOrderByWithRelationInput[] + cursor?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.PurchaseReceiptPaymentsScalarFieldEnum | Prisma.PurchaseReceiptPaymentsScalarFieldEnum[] +} + /** * InventoryBankAccount without action */ diff --git a/src/generated/prisma/models/PosAccount.ts b/src/generated/prisma/models/PosAccount.ts index 8d2bdad..8bf01a9 100644 --- a/src/generated/prisma/models/PosAccount.ts +++ b/src/generated/prisma/models/PosAccount.ts @@ -257,6 +257,7 @@ export type PosAccountWhereInput = { updatedAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null inventoryBankAccount?: Prisma.XOR + salesInvoices?: Prisma.SalesInvoiceListRelationFilter } export type PosAccountOrderByWithRelationInput = { @@ -270,6 +271,7 @@ export type PosAccountOrderByWithRelationInput = { updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder inventoryBankAccount?: Prisma.InventoryBankAccountOrderByWithRelationInput + salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput _relevance?: Prisma.PosAccountOrderByRelevanceInput } @@ -287,6 +289,7 @@ export type PosAccountWhereUniqueInput = Prisma.AtLeast<{ updatedAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null inventoryBankAccount?: Prisma.XOR + salesInvoices?: Prisma.SalesInvoiceListRelationFilter }, "id" | "code"> export type PosAccountOrderByWithAggregationInput = { @@ -329,6 +332,7 @@ export type PosAccountCreateInput = { updatedAt?: Date | string deletedAt?: Date | string | null inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput } export type PosAccountUncheckedCreateInput = { @@ -341,6 +345,7 @@ export type PosAccountUncheckedCreateInput = { createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput } export type PosAccountUpdateInput = { @@ -351,6 +356,7 @@ export type PosAccountUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput } export type PosAccountUncheckedUpdateInput = { @@ -363,6 +369,7 @@ export type PosAccountUncheckedUpdateInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput } export type PosAccountCreateManyInput = { @@ -462,6 +469,11 @@ export type PosAccountSumOrderByAggregateInput = { inventoryId?: Prisma.SortOrder } +export type PosAccountScalarRelationFilter = { + is?: Prisma.PosAccountWhereInput + isNot?: Prisma.PosAccountWhereInput +} + export type PosAccountCreateNestedManyWithoutInventoryBankAccountInput = { create?: Prisma.XOR | Prisma.PosAccountCreateWithoutInventoryBankAccountInput[] | Prisma.PosAccountUncheckedCreateWithoutInventoryBankAccountInput[] connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutInventoryBankAccountInput | Prisma.PosAccountCreateOrConnectWithoutInventoryBankAccountInput[] @@ -504,6 +516,20 @@ export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput deleteMany?: Prisma.PosAccountScalarWhereInput | Prisma.PosAccountScalarWhereInput[] } +export type PosAccountCreateNestedOneWithoutSalesInvoicesInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutSalesInvoicesInput + connect?: Prisma.PosAccountWhereUniqueInput +} + +export type PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutSalesInvoicesInput + upsert?: Prisma.PosAccountUpsertWithoutSalesInvoicesInput + connect?: Prisma.PosAccountWhereUniqueInput + update?: Prisma.XOR, Prisma.PosAccountUncheckedUpdateWithoutSalesInvoicesInput> +} + export type PosAccountCreateWithoutInventoryBankAccountInput = { name: string code: string @@ -511,6 +537,7 @@ export type PosAccountCreateWithoutInventoryBankAccountInput = { createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null + salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput } export type PosAccountUncheckedCreateWithoutInventoryBankAccountInput = { @@ -521,6 +548,7 @@ export type PosAccountUncheckedCreateWithoutInventoryBankAccountInput = { createdAt?: Date | string updatedAt?: Date | string deletedAt?: Date | string | null + salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput } export type PosAccountCreateOrConnectWithoutInventoryBankAccountInput = { @@ -564,6 +592,66 @@ export type PosAccountScalarWhereInput = { deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null } +export type PosAccountCreateWithoutSalesInvoicesInput = { + name: string + code: string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput +} + +export type PosAccountUncheckedCreateWithoutSalesInvoicesInput = { + id?: number + name: string + code: string + description?: string | null + bankAccountId: number + inventoryId: number + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null +} + +export type PosAccountCreateOrConnectWithoutSalesInvoicesInput = { + where: Prisma.PosAccountWhereUniqueInput + create: Prisma.XOR +} + +export type PosAccountUpsertWithoutSalesInvoicesInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.PosAccountWhereInput +} + +export type PosAccountUpdateToOneWithWhereWithoutSalesInvoicesInput = { + where?: Prisma.PosAccountWhereInput + data: Prisma.XOR +} + +export type PosAccountUpdateWithoutSalesInvoicesInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + code?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput +} + +export type PosAccountUncheckedUpdateWithoutSalesInvoicesInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + code?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + export type PosAccountCreateManyInventoryBankAccountInput = { id?: number name: string @@ -581,6 +669,7 @@ export type PosAccountUpdateWithoutInventoryBankAccountInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput } export type PosAccountUncheckedUpdateWithoutInventoryBankAccountInput = { @@ -591,6 +680,7 @@ export type PosAccountUncheckedUpdateWithoutInventoryBankAccountInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput } export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountInput = { @@ -604,6 +694,35 @@ export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountInput = { } +/** + * Count Type PosAccountCountOutputType + */ + +export type PosAccountCountOutputType = { + salesInvoices: number +} + +export type PosAccountCountOutputTypeSelect = { + salesInvoices?: boolean | PosAccountCountOutputTypeCountSalesInvoicesArgs +} + +/** + * PosAccountCountOutputType without action + */ +export type PosAccountCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the PosAccountCountOutputType + */ + select?: Prisma.PosAccountCountOutputTypeSelect | null +} + +/** + * PosAccountCountOutputType without action + */ +export type PosAccountCountOutputTypeCountSalesInvoicesArgs = { + where?: Prisma.SalesInvoiceWhereInput +} + export type PosAccountSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -616,6 +735,8 @@ export type PosAccountSelect + salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs + _count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs }, ExtArgs["result"]["posAccount"]> @@ -635,12 +756,15 @@ export type PosAccountSelectScalar = { export type PosAccountOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "code" | "description" | "bankAccountId" | "inventoryId" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["posAccount"]> export type PosAccountInclude = { inventoryBankAccount?: boolean | Prisma.InventoryBankAccountDefaultArgs + salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs + _count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs } export type $PosAccountPayload = { name: "PosAccount" objects: { inventoryBankAccount: Prisma.$InventoryBankAccountPayload + salesInvoices: Prisma.$SalesInvoicePayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -993,6 +1117,7 @@ readonly fields: PosAccountFieldRefs; export interface Prisma__PosAccountClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" inventoryBankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryBankAccountClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + salesInvoices = {}>(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. @@ -1373,6 +1498,30 @@ export type PosAccountDeleteManyArgs = { + /** + * Select specific fields to fetch from the SalesInvoice + */ + select?: Prisma.SalesInvoiceSelect | null + /** + * Omit specific fields from the SalesInvoice + */ + omit?: Prisma.SalesInvoiceOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoiceInclude | null + where?: Prisma.SalesInvoiceWhereInput + orderBy?: Prisma.SalesInvoiceOrderByWithRelationInput | Prisma.SalesInvoiceOrderByWithRelationInput[] + cursor?: Prisma.SalesInvoiceWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[] +} + /** * PosAccount without action */ diff --git a/src/generated/prisma/models/Product.ts b/src/generated/prisma/models/Product.ts index 4a02547..52b537b 100644 --- a/src/generated/prisma/models/Product.ts +++ b/src/generated/prisma/models/Product.ts @@ -31,6 +31,7 @@ export type ProductAvgAggregateOutputType = { brandId: number | null categoryId: number | null salePrice: runtime.Decimal | null + minimumStockAlertLevel: runtime.Decimal | null } export type ProductSumAggregateOutputType = { @@ -38,6 +39,7 @@ export type ProductSumAggregateOutputType = { brandId: number | null categoryId: number | null salePrice: runtime.Decimal | null + minimumStockAlertLevel: runtime.Decimal | null } export type ProductMinAggregateOutputType = { @@ -52,6 +54,7 @@ export type ProductMinAggregateOutputType = { brandId: number | null categoryId: number | null salePrice: runtime.Decimal | null + minimumStockAlertLevel: runtime.Decimal | null } export type ProductMaxAggregateOutputType = { @@ -66,6 +69,7 @@ export type ProductMaxAggregateOutputType = { brandId: number | null categoryId: number | null salePrice: runtime.Decimal | null + minimumStockAlertLevel: runtime.Decimal | null } export type ProductCountAggregateOutputType = { @@ -80,6 +84,7 @@ export type ProductCountAggregateOutputType = { brandId: number categoryId: number salePrice: number + minimumStockAlertLevel: number _all: number } @@ -89,6 +94,7 @@ export type ProductAvgAggregateInputType = { brandId?: true categoryId?: true salePrice?: true + minimumStockAlertLevel?: true } export type ProductSumAggregateInputType = { @@ -96,6 +102,7 @@ export type ProductSumAggregateInputType = { brandId?: true categoryId?: true salePrice?: true + minimumStockAlertLevel?: true } export type ProductMinAggregateInputType = { @@ -110,6 +117,7 @@ export type ProductMinAggregateInputType = { brandId?: true categoryId?: true salePrice?: true + minimumStockAlertLevel?: true } export type ProductMaxAggregateInputType = { @@ -124,6 +132,7 @@ export type ProductMaxAggregateInputType = { brandId?: true categoryId?: true salePrice?: true + minimumStockAlertLevel?: true } export type ProductCountAggregateInputType = { @@ -138,6 +147,7 @@ export type ProductCountAggregateInputType = { brandId?: true categoryId?: true salePrice?: true + minimumStockAlertLevel?: true _all?: true } @@ -239,6 +249,7 @@ export type ProductGroupByOutputType = { brandId: number | null categoryId: number | null salePrice: runtime.Decimal + minimumStockAlertLevel: runtime.Decimal _count: ProductCountAggregateOutputType | null _avg: ProductAvgAggregateOutputType | null _sum: ProductSumAggregateOutputType | null @@ -276,15 +287,16 @@ export type ProductWhereInput = { brandId?: Prisma.IntNullableFilter<"Product"> | number | null categoryId?: Prisma.IntNullableFilter<"Product"> | number | null salePrice?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string inventoryTransferItems?: Prisma.InventoryTransferItemListRelationFilter variants?: Prisma.ProductVariantListRelationFilter brand?: Prisma.XOR | null category?: Prisma.XOR | null purchaseReceiptItems?: Prisma.PurchaseReceiptItemListRelationFilter - salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter } export type ProductOrderByWithRelationInput = { @@ -299,15 +311,16 @@ export type ProductOrderByWithRelationInput = { brandId?: Prisma.SortOrderInput | Prisma.SortOrder categoryId?: Prisma.SortOrderInput | Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder inventoryTransferItems?: Prisma.InventoryTransferItemOrderByRelationAggregateInput variants?: Prisma.ProductVariantOrderByRelationAggregateInput brand?: Prisma.ProductBrandOrderByWithRelationInput category?: Prisma.ProductCategoryOrderByWithRelationInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemOrderByRelationAggregateInput - salesInvoiceItems?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput stockAdjustments?: Prisma.StockAdjustmentOrderByRelationAggregateInput stockBalances?: Prisma.StockBalanceOrderByRelationAggregateInput stockMovements?: Prisma.StockMovementOrderByRelationAggregateInput + salesInvoiceItems?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput _relevance?: Prisma.ProductOrderByRelevanceInput } @@ -326,15 +339,16 @@ export type ProductWhereUniqueInput = Prisma.AtLeast<{ brandId?: Prisma.IntNullableFilter<"Product"> | number | null categoryId?: Prisma.IntNullableFilter<"Product"> | number | null salePrice?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string inventoryTransferItems?: Prisma.InventoryTransferItemListRelationFilter variants?: Prisma.ProductVariantListRelationFilter brand?: Prisma.XOR | null category?: Prisma.XOR | null purchaseReceiptItems?: Prisma.PurchaseReceiptItemListRelationFilter - salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter stockAdjustments?: Prisma.StockAdjustmentListRelationFilter stockBalances?: Prisma.StockBalanceListRelationFilter stockMovements?: Prisma.StockMovementListRelationFilter + salesInvoiceItems?: Prisma.SalesInvoiceItemListRelationFilter }, "id" | "sku" | "barcode"> export type ProductOrderByWithAggregationInput = { @@ -349,6 +363,7 @@ export type ProductOrderByWithAggregationInput = { brandId?: Prisma.SortOrderInput | Prisma.SortOrder categoryId?: Prisma.SortOrderInput | Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder _count?: Prisma.ProductCountOrderByAggregateInput _avg?: Prisma.ProductAvgOrderByAggregateInput _max?: Prisma.ProductMaxOrderByAggregateInput @@ -371,6 +386,7 @@ export type ProductScalarWhereWithAggregatesInput = { brandId?: Prisma.IntNullableWithAggregatesFilter<"Product"> | number | null categoryId?: Prisma.IntNullableWithAggregatesFilter<"Product"> | number | null salePrice?: Prisma.DecimalWithAggregatesFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalWithAggregatesFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductCreateInput = { @@ -382,15 +398,16 @@ export type ProductCreateInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateInput = { @@ -405,13 +422,14 @@ export type ProductUncheckedCreateInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductUpdateInput = { @@ -423,15 +441,16 @@ export type ProductUpdateInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateInput = { @@ -446,13 +465,14 @@ export type ProductUncheckedUpdateInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateManyInput = { @@ -467,6 +487,7 @@ export type ProductCreateManyInput = { brandId?: number | null categoryId?: number | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductUpdateManyMutationInput = { @@ -478,6 +499,7 @@ export type ProductUpdateManyMutationInput = { 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 } export type ProductUncheckedUpdateManyInput = { @@ -492,6 +514,7 @@ export type ProductUncheckedUpdateManyInput = { 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 } export type ProductScalarRelationFilter = { @@ -517,6 +540,7 @@ export type ProductCountOrderByAggregateInput = { brandId?: Prisma.SortOrder categoryId?: Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder } export type ProductAvgOrderByAggregateInput = { @@ -524,6 +548,7 @@ export type ProductAvgOrderByAggregateInput = { brandId?: Prisma.SortOrder categoryId?: Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder } export type ProductMaxOrderByAggregateInput = { @@ -538,6 +563,7 @@ export type ProductMaxOrderByAggregateInput = { brandId?: Prisma.SortOrder categoryId?: Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder } export type ProductMinOrderByAggregateInput = { @@ -552,6 +578,7 @@ export type ProductMinOrderByAggregateInput = { brandId?: Prisma.SortOrder categoryId?: Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder } export type ProductSumOrderByAggregateInput = { @@ -559,6 +586,7 @@ export type ProductSumOrderByAggregateInput = { brandId?: Prisma.SortOrder categoryId?: Prisma.SortOrder salePrice?: Prisma.SortOrder + minimumStockAlertLevel?: Prisma.SortOrder } export type ProductListRelationFilter = { @@ -762,14 +790,15 @@ export type ProductCreateWithoutInventoryTransferItemsInput = { updatedAt?: Date | string deletedAt?: Date | string | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutInventoryTransferItemsInput = { @@ -784,12 +813,13 @@ export type ProductUncheckedCreateWithoutInventoryTransferItemsInput = { brandId?: number | null categoryId?: number | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutInventoryTransferItemsInput = { @@ -817,14 +847,15 @@ export type ProductUpdateWithoutInventoryTransferItemsInput = { 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 variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutInventoryTransferItemsInput = { @@ -839,12 +870,13 @@ export type ProductUncheckedUpdateWithoutInventoryTransferItemsInput = { 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 variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutSalesInvoiceItemsInput = { @@ -856,6 +888,7 @@ export type ProductCreateWithoutSalesInvoiceItemsInput = { 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 @@ -878,6 +911,7 @@ export type ProductUncheckedCreateWithoutSalesInvoiceItemsInput = { 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 @@ -911,6 +945,7 @@ export type ProductUpdateWithoutSalesInvoiceItemsInput = { 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 @@ -933,6 +968,7 @@ export type ProductUncheckedUpdateWithoutSalesInvoiceItemsInput = { 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 @@ -950,14 +986,15 @@ export type ProductCreateWithoutVariantsInput = { updatedAt?: Date | string deletedAt?: Date | string | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string inventoryTransferItems?: Prisma.InventoryTransferItemCreateNestedManyWithoutProductInput brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutVariantsInput = { @@ -972,12 +1009,13 @@ export type ProductUncheckedCreateWithoutVariantsInput = { brandId?: number | null categoryId?: number | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string inventoryTransferItems?: Prisma.InventoryTransferItemUncheckedCreateNestedManyWithoutProductInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutVariantsInput = { @@ -1005,14 +1043,15 @@ export type ProductUpdateWithoutVariantsInput = { 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 brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutVariantsInput = { @@ -1027,12 +1066,13 @@ export type ProductUncheckedUpdateWithoutVariantsInput = { 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 purchaseReceiptItems?: Prisma.PurchaseReceiptItemUncheckedUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutBrandInput = { @@ -1044,14 +1084,15 @@ export type ProductCreateWithoutBrandInput = { 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 category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutBrandInput = { @@ -1065,13 +1106,14 @@ export type ProductUncheckedCreateWithoutBrandInput = { deletedAt?: Date | string | 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutBrandInput = { @@ -1115,6 +1157,7 @@ export type ProductScalarWhereInput = { brandId?: Prisma.IntNullableFilter<"Product"> | number | null categoryId?: Prisma.IntNullableFilter<"Product"> | number | null salePrice?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductCreateWithoutCategoryInput = { @@ -1126,14 +1169,15 @@ export type ProductCreateWithoutCategoryInput = { 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 purchaseReceiptItems?: Prisma.PurchaseReceiptItemCreateNestedManyWithoutProductInput - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutCategoryInput = { @@ -1147,13 +1191,14 @@ export type ProductUncheckedCreateWithoutCategoryInput = { deletedAt?: Date | string | null brandId?: 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutCategoryInput = { @@ -1191,14 +1236,15 @@ export type ProductCreateWithoutPurchaseReceiptItemsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutPurchaseReceiptItemsInput = { @@ -1213,12 +1259,13 @@ export type ProductUncheckedCreateWithoutPurchaseReceiptItemsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutPurchaseReceiptItemsInput = { @@ -1246,14 +1293,15 @@ export type ProductUpdateWithoutPurchaseReceiptItemsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutPurchaseReceiptItemsInput = { @@ -1268,12 +1316,13 @@ export type ProductUncheckedUpdateWithoutPurchaseReceiptItemsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockMovementsInput = { @@ -1285,14 +1334,15 @@ export type ProductCreateWithoutStockMovementsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockMovementsInput = { @@ -1307,12 +1357,13 @@ export type ProductUncheckedCreateWithoutStockMovementsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockMovementsInput = { @@ -1340,14 +1391,15 @@ export type ProductUpdateWithoutStockMovementsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockMovementsInput = { @@ -1362,12 +1414,13 @@ export type ProductUncheckedUpdateWithoutStockMovementsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockBalancesInput = { @@ -1379,14 +1432,15 @@ export type ProductCreateWithoutStockBalancesInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockBalancesInput = { @@ -1401,12 +1455,13 @@ export type ProductUncheckedCreateWithoutStockBalancesInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockAdjustments?: Prisma.StockAdjustmentUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockBalancesInput = { @@ -1434,14 +1489,15 @@ export type ProductUpdateWithoutStockBalancesInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockBalancesInput = { @@ -1456,12 +1512,13 @@ export type ProductUncheckedUpdateWithoutStockBalancesInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateWithoutStockAdjustmentsInput = { @@ -1473,14 +1530,15 @@ export type ProductCreateWithoutStockAdjustmentsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemCreateNestedManyWithoutProductInput } export type ProductUncheckedCreateWithoutStockAdjustmentsInput = { @@ -1495,12 +1553,13 @@ export type ProductUncheckedCreateWithoutStockAdjustmentsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput stockBalances?: Prisma.StockBalanceUncheckedCreateNestedManyWithoutProductInput stockMovements?: Prisma.StockMovementUncheckedCreateNestedManyWithoutProductInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutProductInput } export type ProductCreateOrConnectWithoutStockAdjustmentsInput = { @@ -1528,14 +1587,15 @@ export type ProductUpdateWithoutStockAdjustmentsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutStockAdjustmentsInput = { @@ -1550,12 +1610,13 @@ export type ProductUncheckedUpdateWithoutStockAdjustmentsInput = { 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateManyBrandInput = { @@ -1569,6 +1630,7 @@ export type ProductCreateManyBrandInput = { deletedAt?: Date | string | null categoryId?: number | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductUpdateWithoutBrandInput = { @@ -1580,14 +1642,15 @@ export type ProductUpdateWithoutBrandInput = { 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 category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutBrandInput = { @@ -1601,13 +1664,14 @@ export type ProductUncheckedUpdateWithoutBrandInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateManyWithoutBrandInput = { @@ -1621,6 +1685,7 @@ export type ProductUncheckedUpdateManyWithoutBrandInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductCreateManyCategoryInput = { @@ -1634,6 +1699,7 @@ export type ProductCreateManyCategoryInput = { deletedAt?: Date | string | null brandId?: number | null salePrice?: runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: runtime.Decimal | runtime.DecimalJsLike | number | string } export type ProductUpdateWithoutCategoryInput = { @@ -1645,14 +1711,15 @@ export type ProductUpdateWithoutCategoryInput = { 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 purchaseReceiptItems?: Prisma.PurchaseReceiptItemUpdateManyWithoutProductNestedInput - salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateWithoutCategoryInput = { @@ -1666,13 +1733,14 @@ export type ProductUncheckedUpdateWithoutCategoryInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null brandId?: 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 - salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput stockAdjustments?: Prisma.StockAdjustmentUncheckedUpdateManyWithoutProductNestedInput stockBalances?: Prisma.StockBalanceUncheckedUpdateManyWithoutProductNestedInput stockMovements?: Prisma.StockMovementUncheckedUpdateManyWithoutProductNestedInput + salesInvoiceItems?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutProductNestedInput } export type ProductUncheckedUpdateManyWithoutCategoryInput = { @@ -1686,6 +1754,7 @@ export type ProductUncheckedUpdateManyWithoutCategoryInput = { deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + minimumStockAlertLevel?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string } @@ -1697,20 +1766,20 @@ export type ProductCountOutputType = { inventoryTransferItems: number variants: number purchaseReceiptItems: number - salesInvoiceItems: number stockAdjustments: number stockBalances: number stockMovements: number + salesInvoiceItems: number } export type ProductCountOutputTypeSelect = { inventoryTransferItems?: boolean | ProductCountOutputTypeCountInventoryTransferItemsArgs variants?: boolean | ProductCountOutputTypeCountVariantsArgs purchaseReceiptItems?: boolean | ProductCountOutputTypeCountPurchaseReceiptItemsArgs - salesInvoiceItems?: boolean | ProductCountOutputTypeCountSalesInvoiceItemsArgs stockAdjustments?: boolean | ProductCountOutputTypeCountStockAdjustmentsArgs stockBalances?: boolean | ProductCountOutputTypeCountStockBalancesArgs stockMovements?: boolean | ProductCountOutputTypeCountStockMovementsArgs + salesInvoiceItems?: boolean | ProductCountOutputTypeCountSalesInvoiceItemsArgs } /** @@ -1744,13 +1813,6 @@ export type ProductCountOutputTypeCountPurchaseReceiptItemsArgs = { - where?: Prisma.SalesInvoiceItemWhereInput -} - /** * ProductCountOutputType without action */ @@ -1772,6 +1834,13 @@ export type ProductCountOutputTypeCountStockMovementsArgs = { + where?: Prisma.SalesInvoiceItemWhereInput +} + export type ProductSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -1785,15 +1854,16 @@ export type ProductSelect variants?: boolean | Prisma.Product$variantsArgs brand?: boolean | Prisma.Product$brandArgs category?: boolean | Prisma.Product$categoryArgs purchaseReceiptItems?: boolean | Prisma.Product$purchaseReceiptItemsArgs - salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs stockAdjustments?: boolean | Prisma.Product$stockAdjustmentsArgs stockBalances?: boolean | Prisma.Product$stockBalancesArgs stockMovements?: boolean | Prisma.Product$stockMovementsArgs + salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs }, ExtArgs["result"]["product"]> @@ -1811,19 +1881,20 @@ export type ProductSelectScalar = { brandId?: boolean categoryId?: boolean salePrice?: boolean + minimumStockAlertLevel?: boolean } -export type ProductOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "sku" | "barcode" | "createdAt" | "updatedAt" | "deletedAt" | "brandId" | "categoryId" | "salePrice", ExtArgs["result"]["product"]> +export type ProductOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "sku" | "barcode" | "createdAt" | "updatedAt" | "deletedAt" | "brandId" | "categoryId" | "salePrice" | "minimumStockAlertLevel", ExtArgs["result"]["product"]> export type ProductInclude = { inventoryTransferItems?: boolean | Prisma.Product$inventoryTransferItemsArgs variants?: boolean | Prisma.Product$variantsArgs brand?: boolean | Prisma.Product$brandArgs category?: boolean | Prisma.Product$categoryArgs purchaseReceiptItems?: boolean | Prisma.Product$purchaseReceiptItemsArgs - salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs stockAdjustments?: boolean | Prisma.Product$stockAdjustmentsArgs stockBalances?: boolean | Prisma.Product$stockBalancesArgs stockMovements?: boolean | Prisma.Product$stockMovementsArgs + salesInvoiceItems?: boolean | Prisma.Product$salesInvoiceItemsArgs _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs } @@ -1835,10 +1906,10 @@ export type $ProductPayload | null category: Prisma.$ProductCategoryPayload | null purchaseReceiptItems: Prisma.$PurchaseReceiptItemPayload[] - salesInvoiceItems: Prisma.$SalesInvoiceItemPayload[] stockAdjustments: Prisma.$StockAdjustmentPayload[] stockBalances: Prisma.$StockBalancePayload[] stockMovements: Prisma.$StockMovementPayload[] + salesInvoiceItems: Prisma.$SalesInvoiceItemPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -1852,6 +1923,7 @@ export type $ProductPayload composites: {} } @@ -2197,10 +2269,10 @@ export interface Prisma__ProductClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductBrandClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> category = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductCategoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> purchaseReceiptItems = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - salesInvoiceItems = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockAdjustments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> stockBalances = {}>(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> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -2241,6 +2313,7 @@ export interface ProductFieldRefs { readonly brandId: Prisma.FieldRef<"Product", 'Int'> readonly categoryId: Prisma.FieldRef<"Product", 'Int'> readonly salePrice: Prisma.FieldRef<"Product", 'Decimal'> + readonly minimumStockAlertLevel: Prisma.FieldRef<"Product", 'Decimal'> } @@ -2693,30 +2766,6 @@ export type Product$purchaseReceiptItemsArgs = { - /** - * Select specific fields to fetch from the SalesInvoiceItem - */ - select?: Prisma.SalesInvoiceItemSelect | null - /** - * Omit specific fields from the SalesInvoiceItem - */ - omit?: Prisma.SalesInvoiceItemOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SalesInvoiceItemInclude | null - where?: Prisma.SalesInvoiceItemWhereInput - orderBy?: Prisma.SalesInvoiceItemOrderByWithRelationInput | Prisma.SalesInvoiceItemOrderByWithRelationInput[] - cursor?: Prisma.SalesInvoiceItemWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.SalesInvoiceItemScalarFieldEnum | Prisma.SalesInvoiceItemScalarFieldEnum[] -} - /** * Product.stockAdjustments */ @@ -2789,6 +2838,30 @@ export type Product$stockMovementsArgs = { + /** + * Select specific fields to fetch from the SalesInvoiceItem + */ + select?: Prisma.SalesInvoiceItemSelect | null + /** + * Omit specific fields from the SalesInvoiceItem + */ + omit?: Prisma.SalesInvoiceItemOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.SalesInvoiceItemInclude | null + where?: Prisma.SalesInvoiceItemWhereInput + orderBy?: Prisma.SalesInvoiceItemOrderByWithRelationInput | Prisma.SalesInvoiceItemOrderByWithRelationInput[] + cursor?: Prisma.SalesInvoiceItemWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.SalesInvoiceItemScalarFieldEnum | Prisma.SalesInvoiceItemScalarFieldEnum[] +} + /** * Product without action */ diff --git a/src/generated/prisma/models/PurchaseReceiptPayments.ts b/src/generated/prisma/models/PurchaseReceiptPayments.ts index fe4a032..cf0b347 100644 --- a/src/generated/prisma/models/PurchaseReceiptPayments.ts +++ b/src/generated/prisma/models/PurchaseReceiptPayments.ts @@ -31,6 +31,8 @@ export type PurchaseReceiptPaymentsAvgAggregateOutputType = { amount: runtime.Decimal | null bankAccountId: number | null receiptId: number | null + inventoryBankAccountInventoryId: number | null + inventoryBankAccountBankAccountId: number | null } export type PurchaseReceiptPaymentsSumAggregateOutputType = { @@ -38,6 +40,8 @@ export type PurchaseReceiptPaymentsSumAggregateOutputType = { amount: runtime.Decimal | null bankAccountId: number | null receiptId: number | null + inventoryBankAccountInventoryId: number | null + inventoryBankAccountBankAccountId: number | null } export type PurchaseReceiptPaymentsMinAggregateOutputType = { @@ -50,6 +54,8 @@ export type PurchaseReceiptPaymentsMinAggregateOutputType = { payedAt: Date | null description: string | null createdAt: Date | null + inventoryBankAccountInventoryId: number | null + inventoryBankAccountBankAccountId: number | null } export type PurchaseReceiptPaymentsMaxAggregateOutputType = { @@ -62,6 +68,8 @@ export type PurchaseReceiptPaymentsMaxAggregateOutputType = { payedAt: Date | null description: string | null createdAt: Date | null + inventoryBankAccountInventoryId: number | null + inventoryBankAccountBankAccountId: number | null } export type PurchaseReceiptPaymentsCountAggregateOutputType = { @@ -74,6 +82,8 @@ export type PurchaseReceiptPaymentsCountAggregateOutputType = { payedAt: number description: number createdAt: number + inventoryBankAccountInventoryId: number + inventoryBankAccountBankAccountId: number _all: number } @@ -83,6 +93,8 @@ export type PurchaseReceiptPaymentsAvgAggregateInputType = { amount?: true bankAccountId?: true receiptId?: true + inventoryBankAccountInventoryId?: true + inventoryBankAccountBankAccountId?: true } export type PurchaseReceiptPaymentsSumAggregateInputType = { @@ -90,6 +102,8 @@ export type PurchaseReceiptPaymentsSumAggregateInputType = { amount?: true bankAccountId?: true receiptId?: true + inventoryBankAccountInventoryId?: true + inventoryBankAccountBankAccountId?: true } export type PurchaseReceiptPaymentsMinAggregateInputType = { @@ -102,6 +116,8 @@ export type PurchaseReceiptPaymentsMinAggregateInputType = { payedAt?: true description?: true createdAt?: true + inventoryBankAccountInventoryId?: true + inventoryBankAccountBankAccountId?: true } export type PurchaseReceiptPaymentsMaxAggregateInputType = { @@ -114,6 +130,8 @@ export type PurchaseReceiptPaymentsMaxAggregateInputType = { payedAt?: true description?: true createdAt?: true + inventoryBankAccountInventoryId?: true + inventoryBankAccountBankAccountId?: true } export type PurchaseReceiptPaymentsCountAggregateInputType = { @@ -126,6 +144,8 @@ export type PurchaseReceiptPaymentsCountAggregateInputType = { payedAt?: true description?: true createdAt?: true + inventoryBankAccountInventoryId?: true + inventoryBankAccountBankAccountId?: true _all?: true } @@ -225,6 +245,8 @@ export type PurchaseReceiptPaymentsGroupByOutputType = { payedAt: Date description: string | null createdAt: Date + inventoryBankAccountInventoryId: number | null + inventoryBankAccountBankAccountId: number | null _count: PurchaseReceiptPaymentsCountAggregateOutputType | null _avg: PurchaseReceiptPaymentsAvgAggregateOutputType | null _sum: PurchaseReceiptPaymentsSumAggregateOutputType | null @@ -260,8 +282,11 @@ export type PurchaseReceiptPaymentsWhereInput = { payedAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string description?: Prisma.StringNullableFilter<"PurchaseReceiptPayments"> | string | null createdAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string + inventoryBankAccountInventoryId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null + inventoryBankAccountBankAccountId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null receipt?: Prisma.XOR bankAccount?: Prisma.XOR + inventoryBankAccount?: Prisma.XOR | null } export type PurchaseReceiptPaymentsOrderByWithRelationInput = { @@ -274,8 +299,11 @@ export type PurchaseReceiptPaymentsOrderByWithRelationInput = { payedAt?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrderInput | Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrderInput | Prisma.SortOrder receipt?: Prisma.PurchaseReceiptOrderByWithRelationInput bankAccount?: Prisma.BankAccountOrderByWithRelationInput + inventoryBankAccount?: Prisma.InventoryBankAccountOrderByWithRelationInput _relevance?: Prisma.PurchaseReceiptPaymentsOrderByRelevanceInput } @@ -292,8 +320,11 @@ export type PurchaseReceiptPaymentsWhereUniqueInput = Prisma.AtLeast<{ payedAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string description?: Prisma.StringNullableFilter<"PurchaseReceiptPayments"> | string | null createdAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string + inventoryBankAccountInventoryId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null + inventoryBankAccountBankAccountId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null receipt?: Prisma.XOR bankAccount?: Prisma.XOR + inventoryBankAccount?: Prisma.XOR | null }, "id"> export type PurchaseReceiptPaymentsOrderByWithAggregationInput = { @@ -306,6 +337,8 @@ export type PurchaseReceiptPaymentsOrderByWithAggregationInput = { payedAt?: Prisma.SortOrder description?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrderInput | Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrderInput | Prisma.SortOrder _count?: Prisma.PurchaseReceiptPaymentsCountOrderByAggregateInput _avg?: Prisma.PurchaseReceiptPaymentsAvgOrderByAggregateInput _max?: Prisma.PurchaseReceiptPaymentsMaxOrderByAggregateInput @@ -326,6 +359,8 @@ export type PurchaseReceiptPaymentsScalarWhereWithAggregatesInput = { payedAt?: Prisma.DateTimeWithAggregatesFilter<"PurchaseReceiptPayments"> | Date | string description?: Prisma.StringNullableWithAggregatesFilter<"PurchaseReceiptPayments"> | string | null createdAt?: Prisma.DateTimeWithAggregatesFilter<"PurchaseReceiptPayments"> | Date | string + inventoryBankAccountInventoryId?: Prisma.IntNullableWithAggregatesFilter<"PurchaseReceiptPayments"> | number | null + inventoryBankAccountBankAccountId?: Prisma.IntNullableWithAggregatesFilter<"PurchaseReceiptPayments"> | number | null } export type PurchaseReceiptPaymentsCreateInput = { @@ -337,6 +372,7 @@ export type PurchaseReceiptPaymentsCreateInput = { createdAt?: Date | string receipt: Prisma.PurchaseReceiptCreateNestedOneWithoutPaymentsInput bankAccount: Prisma.BankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput + inventoryBankAccount?: Prisma.InventoryBankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput } export type PurchaseReceiptPaymentsUncheckedCreateInput = { @@ -349,6 +385,8 @@ export type PurchaseReceiptPaymentsUncheckedCreateInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsUpdateInput = { @@ -360,6 +398,7 @@ export type PurchaseReceiptPaymentsUpdateInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string receipt?: Prisma.PurchaseReceiptUpdateOneRequiredWithoutPaymentsNestedInput bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutPurchaseReceiptPaymentsNestedInput + inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneWithoutPurchaseReceiptPaymentsNestedInput } export type PurchaseReceiptPaymentsUncheckedUpdateInput = { @@ -372,6 +411,8 @@ export type PurchaseReceiptPaymentsUncheckedUpdateInput = { payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type PurchaseReceiptPaymentsCreateManyInput = { @@ -384,6 +425,8 @@ export type PurchaseReceiptPaymentsCreateManyInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsUpdateManyMutationInput = { @@ -405,6 +448,8 @@ export type PurchaseReceiptPaymentsUncheckedUpdateManyInput = { payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type PurchaseReceiptPaymentsListRelationFilter = { @@ -433,6 +478,8 @@ export type PurchaseReceiptPaymentsCountOrderByAggregateInput = { payedAt?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrder } export type PurchaseReceiptPaymentsAvgOrderByAggregateInput = { @@ -440,6 +487,8 @@ export type PurchaseReceiptPaymentsAvgOrderByAggregateInput = { amount?: Prisma.SortOrder bankAccountId?: Prisma.SortOrder receiptId?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrder } export type PurchaseReceiptPaymentsMaxOrderByAggregateInput = { @@ -452,6 +501,8 @@ export type PurchaseReceiptPaymentsMaxOrderByAggregateInput = { payedAt?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrder } export type PurchaseReceiptPaymentsMinOrderByAggregateInput = { @@ -464,6 +515,8 @@ export type PurchaseReceiptPaymentsMinOrderByAggregateInput = { payedAt?: Prisma.SortOrder description?: Prisma.SortOrder createdAt?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrder } export type PurchaseReceiptPaymentsSumOrderByAggregateInput = { @@ -471,6 +524,8 @@ export type PurchaseReceiptPaymentsSumOrderByAggregateInput = { amount?: Prisma.SortOrder bankAccountId?: Prisma.SortOrder receiptId?: Prisma.SortOrder + inventoryBankAccountInventoryId?: Prisma.SortOrder + inventoryBankAccountBankAccountId?: Prisma.SortOrder } export type PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput = { @@ -515,6 +570,48 @@ export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedIn deleteMany?: Prisma.PurchaseReceiptPaymentsScalarWhereInput | Prisma.PurchaseReceiptPaymentsScalarWhereInput[] } +export type PurchaseReceiptPaymentsCreateNestedManyWithoutInventoryBankAccountInput = { + create?: Prisma.XOR | Prisma.PurchaseReceiptPaymentsCreateWithoutInventoryBankAccountInput[] | Prisma.PurchaseReceiptPaymentsUncheckedCreateWithoutInventoryBankAccountInput[] + connectOrCreate?: Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput[] + createMany?: Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInputEnvelope + connect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] +} + +export type PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutInventoryBankAccountInput = { + create?: Prisma.XOR | Prisma.PurchaseReceiptPaymentsCreateWithoutInventoryBankAccountInput[] | Prisma.PurchaseReceiptPaymentsUncheckedCreateWithoutInventoryBankAccountInput[] + connectOrCreate?: Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput[] + createMany?: Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInputEnvelope + connect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] +} + +export type PurchaseReceiptPaymentsUpdateManyWithoutInventoryBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.PurchaseReceiptPaymentsCreateWithoutInventoryBankAccountInput[] | Prisma.PurchaseReceiptPaymentsUncheckedCreateWithoutInventoryBankAccountInput[] + connectOrCreate?: Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput[] + upsert?: Prisma.PurchaseReceiptPaymentsUpsertWithWhereUniqueWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpsertWithWhereUniqueWithoutInventoryBankAccountInput[] + createMany?: Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInputEnvelope + set?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + disconnect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + delete?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + connect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + update?: Prisma.PurchaseReceiptPaymentsUpdateWithWhereUniqueWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpdateWithWhereUniqueWithoutInventoryBankAccountInput[] + updateMany?: Prisma.PurchaseReceiptPaymentsUpdateManyWithWhereWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpdateManyWithWhereWithoutInventoryBankAccountInput[] + deleteMany?: Prisma.PurchaseReceiptPaymentsScalarWhereInput | Prisma.PurchaseReceiptPaymentsScalarWhereInput[] +} + +export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountNestedInput = { + create?: Prisma.XOR | Prisma.PurchaseReceiptPaymentsCreateWithoutInventoryBankAccountInput[] | Prisma.PurchaseReceiptPaymentsUncheckedCreateWithoutInventoryBankAccountInput[] + connectOrCreate?: Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput[] + upsert?: Prisma.PurchaseReceiptPaymentsUpsertWithWhereUniqueWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpsertWithWhereUniqueWithoutInventoryBankAccountInput[] + createMany?: Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInputEnvelope + set?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + disconnect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + delete?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + connect?: Prisma.PurchaseReceiptPaymentsWhereUniqueInput | Prisma.PurchaseReceiptPaymentsWhereUniqueInput[] + update?: Prisma.PurchaseReceiptPaymentsUpdateWithWhereUniqueWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpdateWithWhereUniqueWithoutInventoryBankAccountInput[] + updateMany?: Prisma.PurchaseReceiptPaymentsUpdateManyWithWhereWithoutInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsUpdateManyWithWhereWithoutInventoryBankAccountInput[] + deleteMany?: Prisma.PurchaseReceiptPaymentsScalarWhereInput | Prisma.PurchaseReceiptPaymentsScalarWhereInput[] +} + export type PurchaseReceiptPaymentsCreateNestedManyWithoutReceiptInput = { create?: Prisma.XOR | Prisma.PurchaseReceiptPaymentsCreateWithoutReceiptInput[] | Prisma.PurchaseReceiptPaymentsUncheckedCreateWithoutReceiptInput[] connectOrCreate?: Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutReceiptInput | Prisma.PurchaseReceiptPaymentsCreateOrConnectWithoutReceiptInput[] @@ -569,6 +666,7 @@ export type PurchaseReceiptPaymentsCreateWithoutBankAccountInput = { description?: string | null createdAt?: Date | string receipt: Prisma.PurchaseReceiptCreateNestedOneWithoutPaymentsInput + inventoryBankAccount?: Prisma.InventoryBankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput } export type PurchaseReceiptPaymentsUncheckedCreateWithoutBankAccountInput = { @@ -580,6 +678,8 @@ export type PurchaseReceiptPaymentsUncheckedCreateWithoutBankAccountInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsCreateOrConnectWithoutBankAccountInput = { @@ -621,6 +721,57 @@ export type PurchaseReceiptPaymentsScalarWhereInput = { payedAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string description?: Prisma.StringNullableFilter<"PurchaseReceiptPayments"> | string | null createdAt?: Prisma.DateTimeFilter<"PurchaseReceiptPayments"> | Date | string + inventoryBankAccountInventoryId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null + inventoryBankAccountBankAccountId?: Prisma.IntNullableFilter<"PurchaseReceiptPayments"> | number | null +} + +export type PurchaseReceiptPaymentsCreateWithoutInventoryBankAccountInput = { + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + type: $Enums.PaymentType + payedAt: Date | string + description?: string | null + createdAt?: Date | string + receipt: Prisma.PurchaseReceiptCreateNestedOneWithoutPaymentsInput + bankAccount: Prisma.BankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput +} + +export type PurchaseReceiptPaymentsUncheckedCreateWithoutInventoryBankAccountInput = { + id?: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + type: $Enums.PaymentType + bankAccountId: number + receiptId: number + payedAt: Date | string + description?: string | null + createdAt?: Date | string +} + +export type PurchaseReceiptPaymentsCreateOrConnectWithoutInventoryBankAccountInput = { + where: Prisma.PurchaseReceiptPaymentsWhereUniqueInput + create: Prisma.XOR +} + +export type PurchaseReceiptPaymentsCreateManyInventoryBankAccountInputEnvelope = { + data: Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInput | Prisma.PurchaseReceiptPaymentsCreateManyInventoryBankAccountInput[] + skipDuplicates?: boolean +} + +export type PurchaseReceiptPaymentsUpsertWithWhereUniqueWithoutInventoryBankAccountInput = { + where: Prisma.PurchaseReceiptPaymentsWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type PurchaseReceiptPaymentsUpdateWithWhereUniqueWithoutInventoryBankAccountInput = { + where: Prisma.PurchaseReceiptPaymentsWhereUniqueInput + data: Prisma.XOR +} + +export type PurchaseReceiptPaymentsUpdateManyWithWhereWithoutInventoryBankAccountInput = { + where: Prisma.PurchaseReceiptPaymentsScalarWhereInput + data: Prisma.XOR } export type PurchaseReceiptPaymentsCreateWithoutReceiptInput = { @@ -631,6 +782,7 @@ export type PurchaseReceiptPaymentsCreateWithoutReceiptInput = { description?: string | null createdAt?: Date | string bankAccount: Prisma.BankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput + inventoryBankAccount?: Prisma.InventoryBankAccountCreateNestedOneWithoutPurchaseReceiptPaymentsInput } export type PurchaseReceiptPaymentsUncheckedCreateWithoutReceiptInput = { @@ -642,6 +794,8 @@ export type PurchaseReceiptPaymentsUncheckedCreateWithoutReceiptInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsCreateOrConnectWithoutReceiptInput = { @@ -679,6 +833,8 @@ export type PurchaseReceiptPaymentsCreateManyBankAccountInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsUpdateWithoutBankAccountInput = { @@ -689,6 +845,7 @@ export type PurchaseReceiptPaymentsUpdateWithoutBankAccountInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string receipt?: Prisma.PurchaseReceiptUpdateOneRequiredWithoutPaymentsNestedInput + inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneWithoutPurchaseReceiptPaymentsNestedInput } export type PurchaseReceiptPaymentsUncheckedUpdateWithoutBankAccountInput = { @@ -700,6 +857,8 @@ export type PurchaseReceiptPaymentsUncheckedUpdateWithoutBankAccountInput = { payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountInput = { @@ -711,6 +870,55 @@ export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountInput = payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type PurchaseReceiptPaymentsCreateManyInventoryBankAccountInput = { + id?: number + amount: runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod: $Enums.PaymentMethodType + type: $Enums.PaymentType + bankAccountId: number + receiptId: number + payedAt: Date | string + description?: string | null + createdAt?: Date | string +} + +export type PurchaseReceiptPaymentsUpdateWithoutInventoryBankAccountInput = { + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + type?: Prisma.EnumPaymentTypeFieldUpdateOperationsInput | $Enums.PaymentType + payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + receipt?: Prisma.PurchaseReceiptUpdateOneRequiredWithoutPaymentsNestedInput + bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutPurchaseReceiptPaymentsNestedInput +} + +export type PurchaseReceiptPaymentsUncheckedUpdateWithoutInventoryBankAccountInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + type?: Prisma.EnumPaymentTypeFieldUpdateOperationsInput | $Enums.PaymentType + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + receiptId?: Prisma.IntFieldUpdateOperationsInput | number + payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutInventoryBankAccountInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + paymentMethod?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType + type?: Prisma.EnumPaymentTypeFieldUpdateOperationsInput | $Enums.PaymentType + bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number + receiptId?: Prisma.IntFieldUpdateOperationsInput | number + payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string } export type PurchaseReceiptPaymentsCreateManyReceiptInput = { @@ -722,6 +930,8 @@ export type PurchaseReceiptPaymentsCreateManyReceiptInput = { payedAt: Date | string description?: string | null createdAt?: Date | string + inventoryBankAccountInventoryId?: number | null + inventoryBankAccountBankAccountId?: number | null } export type PurchaseReceiptPaymentsUpdateWithoutReceiptInput = { @@ -732,6 +942,7 @@ export type PurchaseReceiptPaymentsUpdateWithoutReceiptInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string bankAccount?: Prisma.BankAccountUpdateOneRequiredWithoutPurchaseReceiptPaymentsNestedInput + inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneWithoutPurchaseReceiptPaymentsNestedInput } export type PurchaseReceiptPaymentsUncheckedUpdateWithoutReceiptInput = { @@ -743,6 +954,8 @@ export type PurchaseReceiptPaymentsUncheckedUpdateWithoutReceiptInput = { payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutReceiptInput = { @@ -754,6 +967,8 @@ export type PurchaseReceiptPaymentsUncheckedUpdateManyWithoutReceiptInput = { payedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + inventoryBankAccountInventoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + inventoryBankAccountBankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } @@ -768,8 +983,11 @@ export type PurchaseReceiptPaymentsSelect bankAccount?: boolean | Prisma.BankAccountDefaultArgs + inventoryBankAccount?: boolean | Prisma.PurchaseReceiptPayments$inventoryBankAccountArgs }, ExtArgs["result"]["purchaseReceiptPayments"]> @@ -784,12 +1002,15 @@ export type PurchaseReceiptPaymentsSelectScalar = { payedAt?: boolean description?: boolean createdAt?: boolean + inventoryBankAccountInventoryId?: boolean + inventoryBankAccountBankAccountId?: boolean } -export type PurchaseReceiptPaymentsOmit = runtime.Types.Extensions.GetOmit<"id" | "amount" | "paymentMethod" | "type" | "bankAccountId" | "receiptId" | "payedAt" | "description" | "createdAt", ExtArgs["result"]["purchaseReceiptPayments"]> +export type PurchaseReceiptPaymentsOmit = runtime.Types.Extensions.GetOmit<"id" | "amount" | "paymentMethod" | "type" | "bankAccountId" | "receiptId" | "payedAt" | "description" | "createdAt" | "inventoryBankAccountInventoryId" | "inventoryBankAccountBankAccountId", ExtArgs["result"]["purchaseReceiptPayments"]> export type PurchaseReceiptPaymentsInclude = { receipt?: boolean | Prisma.PurchaseReceiptDefaultArgs bankAccount?: boolean | Prisma.BankAccountDefaultArgs + inventoryBankAccount?: boolean | Prisma.PurchaseReceiptPayments$inventoryBankAccountArgs } export type $PurchaseReceiptPaymentsPayload = { @@ -797,6 +1018,7 @@ export type $PurchaseReceiptPaymentsPayload bankAccount: Prisma.$BankAccountPayload + inventoryBankAccount: Prisma.$InventoryBankAccountPayload | null } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -808,6 +1030,8 @@ export type $PurchaseReceiptPaymentsPayload composites: {} } @@ -1150,6 +1374,7 @@ export interface Prisma__PurchaseReceiptPaymentsClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__PurchaseReceiptClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> bankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__BankAccountClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + inventoryBankAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryBankAccountClient, 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. @@ -1188,6 +1413,8 @@ export interface PurchaseReceiptPaymentsFieldRefs { readonly payedAt: Prisma.FieldRef<"PurchaseReceiptPayments", 'DateTime'> readonly description: Prisma.FieldRef<"PurchaseReceiptPayments", 'String'> readonly createdAt: Prisma.FieldRef<"PurchaseReceiptPayments", 'DateTime'> + readonly inventoryBankAccountInventoryId: Prisma.FieldRef<"PurchaseReceiptPayments", 'Int'> + readonly inventoryBankAccountBankAccountId: Prisma.FieldRef<"PurchaseReceiptPayments", 'Int'> } @@ -1530,6 +1757,25 @@ export type PurchaseReceiptPaymentsDeleteManyArgs = { + /** + * Select specific fields to fetch from the InventoryBankAccount + */ + select?: Prisma.InventoryBankAccountSelect | null + /** + * Omit specific fields from the InventoryBankAccount + */ + omit?: Prisma.InventoryBankAccountOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.InventoryBankAccountInclude | null + where?: Prisma.InventoryBankAccountWhereInput +} + /** * PurchaseReceiptPayments without action */ diff --git a/src/generated/prisma/models/SalesInvoice.ts b/src/generated/prisma/models/SalesInvoice.ts index 807a619..b7366ce 100644 --- a/src/generated/prisma/models/SalesInvoice.ts +++ b/src/generated/prisma/models/SalesInvoice.ts @@ -30,14 +30,14 @@ export type SalesInvoiceAvgAggregateOutputType = { id: number | null totalAmount: runtime.Decimal | null customerId: number | null - inventoryId: number | null + posAccountId: number | null } export type SalesInvoiceSumAggregateOutputType = { id: number | null totalAmount: runtime.Decimal | null customerId: number | null - inventoryId: number | null + posAccountId: number | null } export type SalesInvoiceMinAggregateOutputType = { @@ -48,7 +48,7 @@ export type SalesInvoiceMinAggregateOutputType = { createdAt: Date | null updatedAt: Date | null customerId: number | null - inventoryId: number | null + posAccountId: number | null } export type SalesInvoiceMaxAggregateOutputType = { @@ -59,7 +59,7 @@ export type SalesInvoiceMaxAggregateOutputType = { createdAt: Date | null updatedAt: Date | null customerId: number | null - inventoryId: number | null + posAccountId: number | null } export type SalesInvoiceCountAggregateOutputType = { @@ -70,7 +70,7 @@ export type SalesInvoiceCountAggregateOutputType = { createdAt: number updatedAt: number customerId: number - inventoryId: number + posAccountId: number _all: number } @@ -79,14 +79,14 @@ export type SalesInvoiceAvgAggregateInputType = { id?: true totalAmount?: true customerId?: true - inventoryId?: true + posAccountId?: true } export type SalesInvoiceSumAggregateInputType = { id?: true totalAmount?: true customerId?: true - inventoryId?: true + posAccountId?: true } export type SalesInvoiceMinAggregateInputType = { @@ -97,7 +97,7 @@ export type SalesInvoiceMinAggregateInputType = { createdAt?: true updatedAt?: true customerId?: true - inventoryId?: true + posAccountId?: true } export type SalesInvoiceMaxAggregateInputType = { @@ -108,7 +108,7 @@ export type SalesInvoiceMaxAggregateInputType = { createdAt?: true updatedAt?: true customerId?: true - inventoryId?: true + posAccountId?: true } export type SalesInvoiceCountAggregateInputType = { @@ -119,7 +119,7 @@ export type SalesInvoiceCountAggregateInputType = { createdAt?: true updatedAt?: true customerId?: true - inventoryId?: true + posAccountId?: true _all?: true } @@ -217,7 +217,7 @@ export type SalesInvoiceGroupByOutputType = { createdAt: Date updatedAt: Date customerId: number | null - inventoryId: number + posAccountId: number _count: SalesInvoiceCountAggregateOutputType | null _avg: SalesInvoiceAvgAggregateOutputType | null _sum: SalesInvoiceSumAggregateOutputType | null @@ -251,10 +251,10 @@ export type SalesInvoiceWhereInput = { createdAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updatedAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableFilter<"SalesInvoice"> | number | null - inventoryId?: Prisma.IntFilter<"SalesInvoice"> | number + posAccountId?: Prisma.IntFilter<"SalesInvoice"> | number items?: Prisma.SalesInvoiceItemListRelationFilter customer?: Prisma.XOR | null - inventory?: Prisma.XOR + posAccount?: Prisma.XOR } export type SalesInvoiceOrderByWithRelationInput = { @@ -265,10 +265,10 @@ export type SalesInvoiceOrderByWithRelationInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrderInput | Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder items?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput customer?: Prisma.CustomerOrderByWithRelationInput - inventory?: Prisma.InventoryOrderByWithRelationInput + posAccount?: Prisma.PosAccountOrderByWithRelationInput _relevance?: Prisma.SalesInvoiceOrderByRelevanceInput } @@ -283,10 +283,10 @@ export type SalesInvoiceWhereUniqueInput = Prisma.AtLeast<{ createdAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updatedAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableFilter<"SalesInvoice"> | number | null - inventoryId?: Prisma.IntFilter<"SalesInvoice"> | number + posAccountId?: Prisma.IntFilter<"SalesInvoice"> | number items?: Prisma.SalesInvoiceItemListRelationFilter customer?: Prisma.XOR | null - inventory?: Prisma.XOR + posAccount?: Prisma.XOR }, "id" | "code"> export type SalesInvoiceOrderByWithAggregationInput = { @@ -297,7 +297,7 @@ export type SalesInvoiceOrderByWithAggregationInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrderInput | Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder _count?: Prisma.SalesInvoiceCountOrderByAggregateInput _avg?: Prisma.SalesInvoiceAvgOrderByAggregateInput _max?: Prisma.SalesInvoiceMaxOrderByAggregateInput @@ -316,7 +316,7 @@ export type SalesInvoiceScalarWhereWithAggregatesInput = { createdAt?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoice"> | Date | string updatedAt?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableWithAggregatesFilter<"SalesInvoice"> | number | null - inventoryId?: Prisma.IntWithAggregatesFilter<"SalesInvoice"> | number + posAccountId?: Prisma.IntWithAggregatesFilter<"SalesInvoice"> | number } export type SalesInvoiceCreateInput = { @@ -327,7 +327,7 @@ export type SalesInvoiceCreateInput = { updatedAt?: Date | string items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput - inventory: Prisma.InventoryCreateNestedOneWithoutSalesInvoicesInput + posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput } export type SalesInvoiceUncheckedCreateInput = { @@ -338,7 +338,7 @@ export type SalesInvoiceUncheckedCreateInput = { createdAt?: Date | string updatedAt?: Date | string customerId?: number | null - inventoryId: number + posAccountId: number items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput } @@ -350,7 +350,7 @@ export type SalesInvoiceUpdateInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput - inventory?: Prisma.InventoryUpdateOneRequiredWithoutSalesInvoicesNestedInput + posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput } export type SalesInvoiceUncheckedUpdateInput = { @@ -361,7 +361,7 @@ export type SalesInvoiceUncheckedUpdateInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput } @@ -373,7 +373,7 @@ export type SalesInvoiceCreateManyInput = { createdAt?: Date | string updatedAt?: Date | string customerId?: number | null - inventoryId: number + posAccountId: number } export type SalesInvoiceUpdateManyMutationInput = { @@ -392,7 +392,7 @@ export type SalesInvoiceUncheckedUpdateManyInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number } export type SalesInvoiceListRelationFilter = { @@ -419,14 +419,14 @@ export type SalesInvoiceCountOrderByAggregateInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder } export type SalesInvoiceAvgOrderByAggregateInput = { id?: Prisma.SortOrder totalAmount?: Prisma.SortOrder customerId?: Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder } export type SalesInvoiceMaxOrderByAggregateInput = { @@ -437,7 +437,7 @@ export type SalesInvoiceMaxOrderByAggregateInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder } export type SalesInvoiceMinOrderByAggregateInput = { @@ -448,14 +448,14 @@ export type SalesInvoiceMinOrderByAggregateInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder customerId?: Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder } export type SalesInvoiceSumOrderByAggregateInput = { id?: Prisma.SortOrder totalAmount?: Prisma.SortOrder customerId?: Prisma.SortOrder - inventoryId?: Prisma.SortOrder + posAccountId?: Prisma.SortOrder } export type SalesInvoiceScalarRelationFilter = { @@ -463,45 +463,45 @@ export type SalesInvoiceScalarRelationFilter = { isNot?: Prisma.SalesInvoiceWhereInput } -export type SalesInvoiceCreateNestedManyWithoutInventoryInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutInventoryInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutInventoryInput[] - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput | Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput[] - createMany?: Prisma.SalesInvoiceCreateManyInventoryInputEnvelope +export type SalesInvoiceCreateNestedManyWithoutPosAccountInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutPosAccountInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutPosAccountInput[] + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput | Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput[] + createMany?: Prisma.SalesInvoiceCreateManyPosAccountInputEnvelope connect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] } -export type SalesInvoiceUncheckedCreateNestedManyWithoutInventoryInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutInventoryInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutInventoryInput[] - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput | Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput[] - createMany?: Prisma.SalesInvoiceCreateManyInventoryInputEnvelope +export type SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutPosAccountInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutPosAccountInput[] + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput | Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput[] + createMany?: Prisma.SalesInvoiceCreateManyPosAccountInputEnvelope connect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] } -export type SalesInvoiceUpdateManyWithoutInventoryNestedInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutInventoryInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutInventoryInput[] - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput | Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput[] - upsert?: Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutInventoryInput | Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutInventoryInput[] - createMany?: Prisma.SalesInvoiceCreateManyInventoryInputEnvelope +export type SalesInvoiceUpdateManyWithoutPosAccountNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutPosAccountInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutPosAccountInput[] + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput | Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput[] + upsert?: Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutPosAccountInput | Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutPosAccountInput[] + createMany?: Prisma.SalesInvoiceCreateManyPosAccountInputEnvelope set?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] disconnect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] delete?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] connect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] - update?: Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutInventoryInput | Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutInventoryInput[] - updateMany?: Prisma.SalesInvoiceUpdateManyWithWhereWithoutInventoryInput | Prisma.SalesInvoiceUpdateManyWithWhereWithoutInventoryInput[] + update?: Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutPosAccountInput | Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutPosAccountInput[] + updateMany?: Prisma.SalesInvoiceUpdateManyWithWhereWithoutPosAccountInput | Prisma.SalesInvoiceUpdateManyWithWhereWithoutPosAccountInput[] deleteMany?: Prisma.SalesInvoiceScalarWhereInput | Prisma.SalesInvoiceScalarWhereInput[] } -export type SalesInvoiceUncheckedUpdateManyWithoutInventoryNestedInput = { - create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutInventoryInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutInventoryInput[] - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput | Prisma.SalesInvoiceCreateOrConnectWithoutInventoryInput[] - upsert?: Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutInventoryInput | Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutInventoryInput[] - createMany?: Prisma.SalesInvoiceCreateManyInventoryInputEnvelope +export type SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput = { + create?: Prisma.XOR | Prisma.SalesInvoiceCreateWithoutPosAccountInput[] | Prisma.SalesInvoiceUncheckedCreateWithoutPosAccountInput[] + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput | Prisma.SalesInvoiceCreateOrConnectWithoutPosAccountInput[] + upsert?: Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutPosAccountInput | Prisma.SalesInvoiceUpsertWithWhereUniqueWithoutPosAccountInput[] + createMany?: Prisma.SalesInvoiceCreateManyPosAccountInputEnvelope set?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] disconnect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] delete?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] connect?: Prisma.SalesInvoiceWhereUniqueInput | Prisma.SalesInvoiceWhereUniqueInput[] - update?: Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutInventoryInput | Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutInventoryInput[] - updateMany?: Prisma.SalesInvoiceUpdateManyWithWhereWithoutInventoryInput | Prisma.SalesInvoiceUpdateManyWithWhereWithoutInventoryInput[] + update?: Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutPosAccountInput | Prisma.SalesInvoiceUpdateWithWhereUniqueWithoutPosAccountInput[] + updateMany?: Prisma.SalesInvoiceUpdateManyWithWhereWithoutPosAccountInput | Prisma.SalesInvoiceUpdateManyWithWhereWithoutPosAccountInput[] deleteMany?: Prisma.SalesInvoiceScalarWhereInput | Prisma.SalesInvoiceScalarWhereInput[] } @@ -569,7 +569,7 @@ export type SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput = { update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutItemsInput> } -export type SalesInvoiceCreateWithoutInventoryInput = { +export type SalesInvoiceCreateWithoutPosAccountInput = { code: string totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string description?: string | null @@ -579,7 +579,7 @@ export type SalesInvoiceCreateWithoutInventoryInput = { customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput } -export type SalesInvoiceUncheckedCreateWithoutInventoryInput = { +export type SalesInvoiceUncheckedCreateWithoutPosAccountInput = { id?: number code: string totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string @@ -590,30 +590,30 @@ export type SalesInvoiceUncheckedCreateWithoutInventoryInput = { items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput } -export type SalesInvoiceCreateOrConnectWithoutInventoryInput = { +export type SalesInvoiceCreateOrConnectWithoutPosAccountInput = { where: Prisma.SalesInvoiceWhereUniqueInput - create: Prisma.XOR + create: Prisma.XOR } -export type SalesInvoiceCreateManyInventoryInputEnvelope = { - data: Prisma.SalesInvoiceCreateManyInventoryInput | Prisma.SalesInvoiceCreateManyInventoryInput[] +export type SalesInvoiceCreateManyPosAccountInputEnvelope = { + data: Prisma.SalesInvoiceCreateManyPosAccountInput | Prisma.SalesInvoiceCreateManyPosAccountInput[] skipDuplicates?: boolean } -export type SalesInvoiceUpsertWithWhereUniqueWithoutInventoryInput = { +export type SalesInvoiceUpsertWithWhereUniqueWithoutPosAccountInput = { where: Prisma.SalesInvoiceWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR + update: Prisma.XOR + create: Prisma.XOR } -export type SalesInvoiceUpdateWithWhereUniqueWithoutInventoryInput = { +export type SalesInvoiceUpdateWithWhereUniqueWithoutPosAccountInput = { where: Prisma.SalesInvoiceWhereUniqueInput - data: Prisma.XOR + data: Prisma.XOR } -export type SalesInvoiceUpdateManyWithWhereWithoutInventoryInput = { +export type SalesInvoiceUpdateManyWithWhereWithoutPosAccountInput = { where: Prisma.SalesInvoiceScalarWhereInput - data: Prisma.XOR + data: Prisma.XOR } export type SalesInvoiceScalarWhereInput = { @@ -627,7 +627,7 @@ export type SalesInvoiceScalarWhereInput = { createdAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updatedAt?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customerId?: Prisma.IntNullableFilter<"SalesInvoice"> | number | null - inventoryId?: Prisma.IntFilter<"SalesInvoice"> | number + posAccountId?: Prisma.IntFilter<"SalesInvoice"> | number } export type SalesInvoiceCreateWithoutCustomerInput = { @@ -637,7 +637,7 @@ export type SalesInvoiceCreateWithoutCustomerInput = { createdAt?: Date | string updatedAt?: Date | string items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput - inventory: Prisma.InventoryCreateNestedOneWithoutSalesInvoicesInput + posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput } export type SalesInvoiceUncheckedCreateWithoutCustomerInput = { @@ -647,7 +647,7 @@ export type SalesInvoiceUncheckedCreateWithoutCustomerInput = { description?: string | null createdAt?: Date | string updatedAt?: Date | string - inventoryId: number + posAccountId: number items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput } @@ -684,7 +684,7 @@ export type SalesInvoiceCreateWithoutItemsInput = { createdAt?: Date | string updatedAt?: Date | string customer?: Prisma.CustomerCreateNestedOneWithoutSalesInvoicesInput - inventory: Prisma.InventoryCreateNestedOneWithoutSalesInvoicesInput + posAccount: Prisma.PosAccountCreateNestedOneWithoutSalesInvoicesInput } export type SalesInvoiceUncheckedCreateWithoutItemsInput = { @@ -695,7 +695,7 @@ export type SalesInvoiceUncheckedCreateWithoutItemsInput = { createdAt?: Date | string updatedAt?: Date | string customerId?: number | null - inventoryId: number + posAccountId: number } export type SalesInvoiceCreateOrConnectWithoutItemsInput = { @@ -721,7 +721,7 @@ export type SalesInvoiceUpdateWithoutItemsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput - inventory?: Prisma.InventoryUpdateOneRequiredWithoutSalesInvoicesNestedInput + posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput } export type SalesInvoiceUncheckedUpdateWithoutItemsInput = { @@ -732,10 +732,10 @@ export type SalesInvoiceUncheckedUpdateWithoutItemsInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number } -export type SalesInvoiceCreateManyInventoryInput = { +export type SalesInvoiceCreateManyPosAccountInput = { id?: number code: string totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string @@ -745,7 +745,7 @@ export type SalesInvoiceCreateManyInventoryInput = { customerId?: number | null } -export type SalesInvoiceUpdateWithoutInventoryInput = { +export type SalesInvoiceUpdateWithoutPosAccountInput = { code?: Prisma.StringFieldUpdateOperationsInput | string totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -755,7 +755,7 @@ export type SalesInvoiceUpdateWithoutInventoryInput = { customer?: Prisma.CustomerUpdateOneWithoutSalesInvoicesNestedInput } -export type SalesInvoiceUncheckedUpdateWithoutInventoryInput = { +export type SalesInvoiceUncheckedUpdateWithoutPosAccountInput = { id?: Prisma.IntFieldUpdateOperationsInput | number code?: Prisma.StringFieldUpdateOperationsInput | string totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string @@ -766,7 +766,7 @@ export type SalesInvoiceUncheckedUpdateWithoutInventoryInput = { items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput } -export type SalesInvoiceUncheckedUpdateManyWithoutInventoryInput = { +export type SalesInvoiceUncheckedUpdateManyWithoutPosAccountInput = { id?: Prisma.IntFieldUpdateOperationsInput | number code?: Prisma.StringFieldUpdateOperationsInput | string totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string @@ -783,7 +783,7 @@ export type SalesInvoiceCreateManyCustomerInput = { description?: string | null createdAt?: Date | string updatedAt?: Date | string - inventoryId: number + posAccountId: number } export type SalesInvoiceUpdateWithoutCustomerInput = { @@ -793,7 +793,7 @@ export type SalesInvoiceUpdateWithoutCustomerInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput - inventory?: Prisma.InventoryUpdateOneRequiredWithoutSalesInvoicesNestedInput + posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutSalesInvoicesNestedInput } export type SalesInvoiceUncheckedUpdateWithoutCustomerInput = { @@ -803,7 +803,7 @@ export type SalesInvoiceUncheckedUpdateWithoutCustomerInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput } @@ -814,7 +814,7 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerInput = { description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - inventoryId?: Prisma.IntFieldUpdateOperationsInput | number + posAccountId?: Prisma.IntFieldUpdateOperationsInput | number } @@ -856,10 +856,10 @@ export type SalesInvoiceSelect customer?: boolean | Prisma.SalesInvoice$customerArgs - inventory?: boolean | Prisma.InventoryDefaultArgs + posAccount?: boolean | Prisma.PosAccountDefaultArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs }, ExtArgs["result"]["salesInvoice"]> @@ -873,14 +873,14 @@ export type SalesInvoiceSelectScalar = { createdAt?: boolean updatedAt?: boolean customerId?: boolean - inventoryId?: boolean + posAccountId?: boolean } -export type SalesInvoiceOmit = runtime.Types.Extensions.GetOmit<"id" | "code" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "customerId" | "inventoryId", ExtArgs["result"]["salesInvoice"]> +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 - inventory?: boolean | Prisma.InventoryDefaultArgs + posAccount?: boolean | Prisma.PosAccountDefaultArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs } @@ -889,7 +889,7 @@ export type $SalesInvoicePayload[] customer: Prisma.$CustomerPayload | null - inventory: Prisma.$InventoryPayload + posAccount: Prisma.$PosAccountPayload } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -899,7 +899,7 @@ export type $SalesInvoicePayload composites: {} } @@ -1242,7 +1242,7 @@ export interface Prisma__SalesInvoiceClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - inventory = {}>(args?: Prisma.Subset>): Prisma.Prisma__InventoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + posAccount = {}>(args?: Prisma.Subset>): Prisma.Prisma__PosAccountClient, 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. @@ -1279,7 +1279,7 @@ export interface SalesInvoiceFieldRefs { readonly createdAt: Prisma.FieldRef<"SalesInvoice", 'DateTime'> readonly updatedAt: Prisma.FieldRef<"SalesInvoice", 'DateTime'> readonly customerId: Prisma.FieldRef<"SalesInvoice", 'Int'> - readonly inventoryId: Prisma.FieldRef<"SalesInvoice", 'Int'> + readonly posAccountId: Prisma.FieldRef<"SalesInvoice", 'Int'> } diff --git a/src/modules/inventories/index/inventories.controller.ts b/src/modules/inventories/index/inventories.controller.ts index 5b9a761..59c71dd 100644 --- a/src/modules/inventories/index/inventories.controller.ts +++ b/src/modules/inventories/index/inventories.controller.ts @@ -51,4 +51,9 @@ export class InventoriesController { getProductCardex(@Param('id') id: string, @Param('productId') productId: string) { return this.inventoriesService.getProductCardex(Number(id), Number(productId)) } + + @Get(':id/cardex') + getCardex(@Param('id') id: string) { + return this.inventoriesService.getCardex(Number(id)) + } } diff --git a/src/modules/inventories/index/inventories.service.ts b/src/modules/inventories/index/inventories.service.ts index 0c83831..2046f08 100644 --- a/src/modules/inventories/index/inventories.service.ts +++ b/src/modules/inventories/index/inventories.service.ts @@ -161,37 +161,46 @@ export class InventoriesService { return ResponseMapper.list(mapped) } + async getCardex(inventoryId: number) { + const movements = await this.prisma.stockMovement.findMany({ + where: { inventoryId }, + orderBy: { createdAt: 'asc' }, + include: { + customer: { select: { id: true, firstName: true, lastName: true } }, + supplier: { select: { id: true, firstName: true, lastName: true } }, + counterInventory: { + select: { id: true, name: true }, + }, + product: { + select: { id: true, name: true, sku: true }, + }, + }, + omit: { + inventoryId: true, + productId: true, + customerId: true, + supplierId: true, + counterInventoryId: true, + }, + }) + + return ResponseMapper.list(movements) + } + async getProductCardex(inventoryId: number, productId: number) { const movements = await this.prisma.stockMovement.findMany({ where: { productId, inventoryId }, orderBy: { createdAt: 'asc' }, - include: { inventory: true, supplier: true }, + include: { + customer: { select: { id: true, firstName: true, lastName: true } }, + supplier: { select: { id: true, firstName: true, lastName: true } }, + counterInventory: { + select: { id: true, name: true }, + }, + }, }) - const mapped = movements.map(movement => ({ - id: movement.id, - type: movement.type, - quantity: Number(movement.quantity), - fee: Number(movement.fee), - totalCost: Number(movement.totalCost), - avgCost: Number(movement.avgCost), - referenceType: movement.referenceType, - referenceId: movement.referenceId, - createdAt: movement.createdAt, - remainedInStock: movement.remainedInStock, - inventory: { - id: movement.inventory.id, - name: movement.inventory.name, - }, - supplier: movement.supplier - ? { - id: movement.supplier.id, - name: movement.supplier.firstName + ' ' + movement.supplier.lastName, - } - : null, - })) - - return ResponseMapper.list(mapped) + return ResponseMapper.list(movements) } async getInventoryBankAccounts(inventoryId: number) { diff --git a/src/modules/inventories/pos-accounts/pos-accounts.service.ts b/src/modules/inventories/pos-accounts/pos-accounts.service.ts index 16187b8..5bbef67 100644 --- a/src/modules/inventories/pos-accounts/pos-accounts.service.ts +++ b/src/modules/inventories/pos-accounts/pos-accounts.service.ts @@ -62,17 +62,39 @@ export class PosAccountsService { }, }, }, + salesInvoices: { + where: { + createdAt: { gte: new Date(new Date().setHours(0, 0, 0, 0)) }, + }, + select: { + id: true, + code: true, + totalAmount: true, + createdAt: true, + }, + }, }, omit: { inventoryId: true, bankAccountId: true, }, }) + return ResponseMapper.list( - items.map(item => ({ - ...item, - bankAccount: item.inventoryBankAccount?.bankAccount, - })), + items.map(item => { + const { inventoryBankAccount, salesInvoices, ...rest } = item + return { + ...rest, + bankAccount: inventoryBankAccount?.bankAccount, + todaySalesInfo: { + salesCount: salesInvoices.length, + salesTotal: salesInvoices.reduce( + (acc, si) => acc + Number(si.totalAmount), + 0, + ), + }, + } + }), ) } diff --git a/src/modules/pos/dto/create-pos.dto.ts b/src/modules/pos/dto/create-pos.dto.ts index 64d6bb2..7fd5c97 100644 --- a/src/modules/pos/dto/create-pos.dto.ts +++ b/src/modules/pos/dto/create-pos.dto.ts @@ -1,27 +1,37 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger' -import { ArrayMinSize, IsNumber, IsOptional } from 'class-validator' +import { Type } from 'class-transformer' +import { ArrayMinSize, IsInt, IsNumber, IsOptional, IsString } from 'class-validator' -export class CreateOrderDto { - @ApiProperty() - @IsNumber() +export class CreateSaleInvoiceDto { + @ApiPropertyOptional() @IsOptional() + @IsInt() + @Type(() => Number) customerId?: number @ApiPropertyOptional() + @IsOptional() + @IsString() + description?: string + + @ApiProperty() @ArrayMinSize(1) items: CreateOrderItemDto[] } export class CreateOrderItemDto { @ApiProperty() - @IsNumber() + @IsInt() + @Type(() => Number) productId: number @ApiProperty() @IsNumber() + @Type(() => Number) count: number @ApiProperty() @IsNumber() + @Type(() => Number) fee: number } diff --git a/src/modules/pos/pos.controller.ts b/src/modules/pos/pos.controller.ts index ba78203..cac0275 100644 --- a/src/modules/pos/pos.controller.ts +++ b/src/modules/pos/pos.controller.ts @@ -1,5 +1,5 @@ import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common' -import { CreateOrderDto } from './dto/create-pos.dto' +import { CreateSaleInvoiceDto } from './dto/create-pos.dto' import { PosService } from './pos.service' @Controller('pos') @@ -34,7 +34,7 @@ export class PosController { } @Post('/:posId/orders/create') - async createOrder(@Param('posId') posId: string, @Body() dto: CreateOrderDto) { + async createOrder(@Param('posId') posId: string, @Body() dto: CreateSaleInvoiceDto) { return this.posService.createOrder(Number(posId), dto) } } diff --git a/src/modules/pos/pos.service.ts b/src/modules/pos/pos.service.ts index 08ff483..d9a143e 100644 --- a/src/modules/pos/pos.service.ts +++ b/src/modules/pos/pos.service.ts @@ -1,29 +1,14 @@ import { Injectable } from '@nestjs/common' import { ResponseMapper } from '../../common/response/response-mapper' import { Prisma } from '../../generated/prisma/client' +import { SalesInvoiceCreateInput } from '../../generated/prisma/models' import { PrismaService } from '../../prisma/prisma.service' -import { CreateOrderDto } from './dto/create-pos.dto' +import { CreateSaleInvoiceDto } from './dto/create-pos.dto' @Injectable() export class PosService { constructor(private prisma: PrismaService) {} - async getDefaultInventoryId() { - const inventory = await this.prisma.inventory.findFirst({ - where: { isPointOfSale: true }, - select: { id: true }, - }) - return inventory?.id || null - } - - async getDefaultPosId(inventoryId: number) { - const pos = await this.prisma.posAccount.findFirst({ - where: { inventoryId }, - select: { id: true }, - }) - return pos?.id || null - } - async getInfo(posId: number) { const info = await this.prisma.posAccount.findUniqueOrThrow({ where: { id: posId }, @@ -173,41 +158,34 @@ export class PosService { return ResponseMapper.list(categories) } - async createOrder(posId: number, data: CreateOrderDto) { - const pos = await this.prisma.posAccount.findUniqueOrThrow({ - where: { id: posId }, - select: { inventoryId: true }, - }) - const inventoryId = pos.inventoryId - - const { customerId, ...res } = data - const preparedOrder = { ...res } as any + async createOrder(posId: number, data: CreateSaleInvoiceDto) { + const { customerId, items, ...res } = data const lastCode = await this.prisma.salesInvoice .findFirst({ + where: { posAccountId: posId }, orderBy: { code: 'desc' }, select: { code: true }, }) .then(si => si?.code || '0') - preparedOrder.code = String(Number(lastCode) + 1) + const newCode = String(Number(lastCode) + 1) - preparedOrder.totalAmount = data.items.reduce( - (acc, item) => acc + Number(item.fee), - 0, - ) + const totalAmount = data.items.reduce((acc, item) => acc + item.count * item.fee, 0) - preparedOrder.inventory = { connect: { id: inventoryId } } - preparedOrder.customer = { connect: { id: customerId } } - - if (Object.prototype.hasOwnProperty.call(preparedOrder, 'items')) { - preparedOrder.items = { - create: preparedOrder.items.map((item: any) => ({ + const preparedOrder: SalesInvoiceCreateInput = { + ...res, + code: newCode, + posAccount: { connect: { id: posId } }, + customer: customerId ? { connect: { id: customerId } } : undefined, + totalAmount: totalAmount, + items: { + create: items.map(item => ({ product: { connect: { id: Number(item.productId) } }, count: item.count, fee: item.fee, total: item.count * item.fee, })), - } + }, } const item = await this.prisma.salesInvoice.create({ data: preparedOrder }) diff --git a/src/products/dto/create-product.dto.ts b/src/products/dto/create-product.dto.ts index fcee16b..c276e1e 100644 --- a/src/products/dto/create-product.dto.ts +++ b/src/products/dto/create-product.dto.ts @@ -26,4 +26,8 @@ export class CreateProductDto { @Type(() => Number) @IsInt() categoryId?: number + + @IsOptional() + @Type(() => Number) + minimumStockAlertLevel?: number } diff --git a/src/products/dto/update-product.dto.ts b/src/products/dto/update-product.dto.ts index 21a0ab6..33d4ce3 100644 --- a/src/products/dto/update-product.dto.ts +++ b/src/products/dto/update-product.dto.ts @@ -27,4 +27,9 @@ export class UpdateProductDto { @Type(() => Number) @IsInt() categoryId?: number + + @IsOptional() + @Type(() => Number) + @IsInt() + minimumStockAlertLevel?: number } diff --git a/src/products/products.service.ts b/src/products/products.service.ts index 725c26e..bab0432 100644 --- a/src/products/products.service.ts +++ b/src/products/products.service.ts @@ -4,28 +4,22 @@ import { ResponseMapper } from '../common/response/response-mapper' import { Prisma } from '../generated/prisma/client' import { PrismaService } from '../prisma/prisma.service' import { CreateProductDto } from './dto/create-product.dto' +import { UpdateProductDto } from './dto/update-product.dto' @Injectable() export class ProductsService { constructor(private prisma: PrismaService) {} async create(data: CreateProductDto) { - const payload: any = { ...data } - if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) { - if (payload.brandId !== undefined && payload.brandId !== null) { - payload.brand = { connect: { id: Number(payload.brandId) } } - } - delete payload.brandId + const { brandId, categoryId, ...rest } = data + + const dataToCreate = { + ...rest, + brand: brandId ? { connect: { id: Number(brandId) } } : undefined, + category: categoryId ? { connect: { id: Number(categoryId) } } : undefined, } - if (Object.prototype.hasOwnProperty.call(payload, 'categoryId')) { - if (payload.categoryId !== undefined && payload.categoryId !== null) { - payload.category = { connect: { id: Number(payload.categoryId) } } - } - delete payload.categoryId - } - - const item = await this.prisma.product.create({ data: payload }) + const item = await this.prisma.product.create({ data: dataToCreate }) return ResponseMapper.create(item) } @@ -54,61 +48,79 @@ export class ProductsService { ? p.stockBalances.reduce((acc, sb) => acc + Number(sb.quantity), 0) : 0 - return { ...rest, brand, category, stock } + return { + ...rest, + salePrice: Number(p.salePrice), + minimumStockAlertLevel: Number(p.minimumStockAlertLevel), + brand, + category, + stock, + } }) return ResponseMapper.paginate(mapped, count, page, pageSize) } async findOne(id: number) { - const p = await this.prisma.product.findUnique({ + const product = await this.prisma.product.findUniqueOrThrow({ where: { id }, - include: { brand: true, category: true, stockBalances: true }, + include: { + brand: { + select: { id: true, name: true }, + }, + category: { + select: { id: true, name: true }, + }, + stockBalances: { + select: { + quantity: true, + avgCost: true, + inventory: { select: { id: true, name: true } }, + }, + }, + salesInvoiceItems: { + select: { id: true }, + }, + }, + omit: { + brandId: true, + categoryId: true, + }, }) - if (!p) return null - const { brandId, categoryId, ...rest } = p as any - const brand: ShortEntity | null = p.brand - ? { id: p.brand.id, name: p.brand.name } - : null - const category: ShortEntity | null = p.category - ? { id: p.category.id, name: p.category.name } - : null + const { salesInvoiceItems, ...rest } = product + return ResponseMapper.single({ ...rest, - brand, - category, - stock: - p.stockBalances && p.stockBalances.length > 0 - ? p.stockBalances.reduce((acc, sb) => acc + Number(sb.quantity), 0) - : 0, + salePrice: Number(product.salePrice), + minimumStockAlertLevel: Number(product.minimumStockAlertLevel), + stock: product.stockBalances?.reduce((acc, sb) => acc + Number(sb.quantity), 0), avgCost: - p.stockBalances && p.stockBalances.length > 0 - ? p.stockBalances.reduce((acc, sb) => acc + Number(sb.avgCost), 0) / - p.stockBalances.length - : 0, + product.stockBalances?.reduce((acc, sb) => acc + Number(sb.avgCost), 0) / + product.stockBalances.length, + salesCount: product.salesInvoiceItems.length, }) } - async update(id: number, data: any) { - const payload: any = { ...data } - if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) { - if (payload.brandId === null) { - payload.brand = { disconnect: true } - } else { - payload.brand = { connect: { id: Number(payload.brandId) } } - } - delete payload.brandId - } - if (Object.prototype.hasOwnProperty.call(payload, 'categoryId')) { - if (payload.categoryId === null) { - payload.category = { disconnect: true } - } else { - payload.category = { connect: { id: Number(payload.categoryId) } } - } - delete payload.categoryId + async update(id: number, data: UpdateProductDto) { + const { brandId, categoryId, ...rest } = data + + const dataToUpdate = { + ...rest, + brand: + brandId === null + ? { disconnect: true } + : brandId + ? { connect: { id: Number(brandId) } } + : undefined, + category: + categoryId === null + ? { disconnect: true } + : categoryId + ? { connect: { id: Number(categoryId) } } + : undefined, } - const item = await this.prisma.product.update({ where: { id }, data: payload }) + const item = await this.prisma.product.update({ where: { id }, data: dataToUpdate }) return ResponseMapper.update(item) }