feat: implement POS order management system

- Added CreateOrderDto and CreateOrderItemDto for order creation.
- Developed PosOrdersController to handle order-related endpoints.
- Created PosOrdersService for business logic related to orders.
- Implemented PosOrdersWorkflow for order processing workflows.
- Established Prisma integration for database operations in orders.
- Introduced SalesInvoicesModule and related DTOs for sales invoice management.
- Enhanced SalesInvoicesService and SalesInvoicesWorkflow for invoice processing.
This commit is contained in:
2026-01-07 15:25:59 +03:30
parent b05048e62f
commit 5fd6611aca
37 changed files with 1974 additions and 291 deletions
@@ -0,0 +1,17 @@
CREATE OR REPLACE VIEW Stock_Available_View AS
SELECT
sb.productId,
sb.inventoryId,
sb.quantity AS physicalQuantity,
COALESCE(SUM(sr.quantity), 0) AS reservedQuantity,
(
sb.quantity - COALESCE(SUM(sr.quantity), 0)
) AS availableQuantity
FROM
Stock_Balance sb
LEFT JOIN Stock_Reservations sr ON sr.productId = sb.productId
AND sr.inventoryId = sb.inventoryId
GROUP BY
sb.productId,
sb.inventoryId,
sb.quantity;
@@ -0,0 +1,21 @@
/*
Warnings:
- You are about to drop the column `expiresAt` on the `Stock_Reservations` table. All the data in the column will be lost.
- Added the required column `posAccountId` to the `Orders` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Orders` ADD COLUMN `posAccountId` INTEGER NOT NULL;
-- AlterTable
ALTER TABLE `Stock_Reservations` DROP COLUMN `expiresAt`;
-- CreateIndex
CREATE INDEX `Orders_posAccountId_idx` ON `Orders`(`posAccountId`);
-- AddForeignKey
ALTER TABLE `Orders` ADD CONSTRAINT `Orders_posAccountId_fkey` FOREIGN KEY (`posAccountId`) REFERENCES `Pos_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Stock_Reservations` ADD CONSTRAINT `Stock_Reservations_orderId_fkey` FOREIGN KEY (`orderId`) REFERENCES `Orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
+1
View File
@@ -47,6 +47,7 @@ model PosAccount {
inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId]) inventoryBankAccount InventoryBankAccount @relation(fields: [inventoryId, bankAccountId], references: [inventoryId, bankAccountId])
salesInvoices SalesInvoice[] salesInvoices SalesInvoice[]
orders Order[]
@@index([inventoryId]) @@index([inventoryId])
@@map("Pos_Accounts") @@map("Pos_Accounts")
+8 -2
View File
@@ -8,9 +8,15 @@ model Order {
updatedAt DateTime @updatedAt @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
customerId Int? customerId Int?
customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction) posAccountId Int
orderItems OrderItem[]
customer Customer? @relation(fields: [customerId], references: [id], onUpdate: NoAction)
posAccount PosAccount @relation(fields: [posAccountId], references: [id], onUpdate: NoAction)
orderItems OrderItem[]
stockReservations StockReservation[]
@@index([posAccountId])
@@index([customerId]) @@index([customerId])
@@map("Orders") @@map("Orders")
} }
+1
View File
@@ -2,6 +2,7 @@ generator client {
provider = "prisma-client" provider = "prisma-client"
output = "../../src/generated/prisma" output = "../../src/generated/prisma"
moduleFormat = "cjs" moduleFormat = "cjs"
previewFeatures = ["views"]
} }
datasource db { datasource db {
+11 -1
View File
@@ -63,15 +63,25 @@ model StockAdjustment {
model StockReservation { model StockReservation {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
quantity Decimal @db.Decimal(10, 0) quantity Decimal @db.Decimal(10, 0)
expiresAt DateTime @db.Timestamp(0)
createdAt DateTime @default(now()) @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
productId Int productId Int
inventoryId Int inventoryId Int
orderId Int orderId Int
inventory Inventory @relation(fields: [inventoryId], references: [id]) inventory Inventory @relation(fields: [inventoryId], references: [id])
product Product @relation(fields: [productId], references: [id]) product Product @relation(fields: [productId], references: [id])
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
@@index([inventoryId]) @@index([inventoryId])
@@index([productId]) @@index([productId])
@@map("Stock_Reservations") @@map("Stock_Reservations")
} }
view StockAvailableView {
productId Int
inventoryId Int
physicalQuantity Decimal @db.Decimal(10, 0)
reservedQuantity Decimal @db.Decimal(10, 0)
availableQuantity Decimal @db.Decimal(10, 0)
@@map("Stock_Available_View")
}
+41 -29
View File
@@ -1,5 +1,5 @@
-- AUTO-GENERATED MYSQL TRIGGER DUMP -- AUTO-GENERATED MYSQL TRIGGER DUMP
-- Generated at: 2026-01-04T17:29:18.092Z -- Generated at: 2026-01-06T16:09:38.959Z
-- ------------------------------------------ -- ------------------------------------------
-- index: 1 -- index: 1
@@ -52,44 +52,35 @@ end;
-- ------------------------------------------ -- ------------------------------------------
-- index: 3 -- index: 3
-- Trigger: trg_order_item_after_insert
-- Event: INSERT
-- Table: Order_Items
-- ------------------------------------------
DROP TRIGGER IF EXISTS `trg_order_item_after_insert`;
CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_insert` AFTER INSERT ON `Order_Items` FOR EACH ROW BEGIN
UPDATE Stock_Reservations SET quantity = quantity + NEW.quantity
WHERE orderId = NEW.orderId AND productId = NEW.productId;
END;
-- ------------------------------------------
-- index: 4
-- Trigger: trg_order_item_after_update -- Trigger: trg_order_item_after_update
-- Event: UPDATE -- Event: UPDATE
-- Table: Order_Items -- Table: Order_Items
-- ------------------------------------------ -- ------------------------------------------
DROP TRIGGER IF EXISTS `trg_order_item_after_update`; DROP TRIGGER IF EXISTS `trg_order_item_after_update`;
CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_update` AFTER UPDATE ON `Order_Items` FOR EACH ROW BEGIN CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_update` AFTER UPDATE ON `Order_Items` FOR EACH ROW BEGIN
UPDATE Stock_Reservations UPDATE Stock_Reservations
SET quantity = quantity - OLD.quantity + NEW.quantity SET quantity = quantity - OLD.quantity + NEW.quantity
WHERE orderId = NEW.orderId AND productId = NEW.productId; WHERE orderId = NEW.orderId AND productId = NEW.productId;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 5 -- index: 4
-- Trigger: trg_order_item_after_delete -- Trigger: trg_order_item_after_delete
-- Event: DELETE -- Event: DELETE
-- Table: Order_Items -- Table: Order_Items
-- ------------------------------------------ -- ------------------------------------------
DROP TRIGGER IF EXISTS `trg_order_item_after_delete`; DROP TRIGGER IF EXISTS `trg_order_item_after_delete`;
CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_delete` AFTER DELETE ON `Order_Items` FOR EACH ROW BEGIN CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_item_after_delete` AFTER DELETE ON `Order_Items` FOR EACH ROW BEGIN
UPDATE Stock_Reservations SET quantity = quantity - OLD.quantity
DELETE From Stock_Reservations
WHERE orderId = OLD.orderId AND productId = OLD.productId; WHERE orderId = OLD.orderId AND productId = OLD.productId;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 6 -- index: 5
-- Trigger: trg_order_after_cancel -- Trigger: trg_order_after_cancel
-- Event: UPDATE -- Event: UPDATE
-- Table: Orders -- Table: Orders
@@ -103,7 +94,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_order_after_cancel` AFTER UPDATE ON `Order
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 7 -- index: 6
-- Trigger: trg_purchase_receipt_item_after_insert -- Trigger: trg_purchase_receipt_item_after_insert
-- Event: INSERT -- Event: INSERT
-- Table: Purchase_Receipt_Items -- Table: Purchase_Receipt_Items
@@ -166,7 +157,7 @@ DECLARE invId INT;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 8 -- index: 7
-- Trigger: trg_pr_payment_after_delete -- Trigger: trg_pr_payment_after_delete
-- Event: DELETE -- Event: DELETE
-- Table: Purchase_Receipt_Payments -- Table: Purchase_Receipt_Payments
@@ -201,7 +192,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pr_payment_after_delete` AFTER DELETE ON `
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 9 -- index: 8
-- Trigger: trg_sales_invoice_items_before_insert -- Trigger: trg_sales_invoice_items_before_insert
-- Event: INSERT -- Event: INSERT
-- Table: Sales_Invoice_Items -- Table: Sales_Invoice_Items
@@ -220,10 +211,9 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE
WHERE si.id = NEW.invoiceId; WHERE si.id = NEW.invoiceId;
SELECT COALESCE(quantity, 0) INTO current_stock SELECT COALESCE(sav.availableQuantity, 0) INTO current_stock
FROM Stock_Balance sb FROM Stock_Available_View sav
WHERE productId = NEW.productId AND sb.inventoryId = inventory_id WHERE productId = NEW.productId AND sav.inventoryId = inventory_id;
LIMIT 1;
@@ -234,7 +224,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_items_before_insert` BEFORE
end; end;
-- ------------------------------------------ -- ------------------------------------------
-- index: 10 -- index: 9
-- Trigger: trg_sales_invoice_items_after_insert -- Trigger: trg_sales_invoice_items_after_insert
-- Event: INSERT -- Event: INSERT
-- Table: Sales_Invoice_Items -- Table: Sales_Invoice_Items
@@ -307,7 +297,7 @@ DECLARE pos_id INT;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 11 -- index: 10
-- Trigger: trg_pos_account_payment_after_insert -- Trigger: trg_pos_account_payment_after_insert
-- Event: INSERT -- Event: INSERT
-- Table: Sales_Invoice_Payments -- Table: Sales_Invoice_Payments
@@ -343,7 +333,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_pos_account_payment_after_insert` AFTER IN
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 12 -- index: 11
-- Trigger: trg_sales_invoice_payment_after_insert -- Trigger: trg_sales_invoice_payment_after_insert
-- Event: INSERT -- Event: INSERT
-- Table: Sales_Invoice_Payments -- Table: Sales_Invoice_Payments
@@ -382,7 +372,7 @@ CREATE DEFINER=`pos`@`%` TRIGGER `trg_sales_invoice_payment_after_insert` AFTER
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 13 -- index: 12
-- Trigger: trg_stock_sale_insert -- Trigger: trg_stock_sale_insert
-- Event: INSERT -- Event: INSERT
-- Table: Stock_Movements -- Table: Stock_Movements
@@ -417,7 +407,7 @@ END IF;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 14 -- index: 13
-- Trigger: trg_stock_purchase_insert -- Trigger: trg_stock_purchase_insert
-- Event: INSERT -- Event: INSERT
-- Table: Stock_Movements -- Table: Stock_Movements
@@ -452,7 +442,7 @@ END IF;
END; END;
-- ------------------------------------------ -- ------------------------------------------
-- index: 15 -- index: 14
-- Trigger: trg_stock_transfer -- Trigger: trg_stock_transfer
-- Event: INSERT -- Event: INSERT
-- Table: Stock_Movements -- Table: Stock_Movements
@@ -534,3 +524,25 @@ END IF;
END; END;
-- ------------------------------------------
-- index: 15
-- Trigger: trg_no_negative_available_stock
-- Event: INSERT
-- Table: Stock_Reservations
-- ------------------------------------------
DROP TRIGGER IF EXISTS `trg_no_negative_available_stock`;
CREATE DEFINER=`pos`@`%` TRIGGER `trg_no_negative_available_stock` BEFORE INSERT ON `Stock_Reservations` FOR EACH ROW BEGIN
DECLARE available DECIMAL(14,3);
SELECT availableQuantity
INTO available
FROM Stock_Available_View
WHERE productId = NEW.productId
AND inventoryId = NEW.inventoryId;
IF available < NEW.quantity THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'موجودی کافی نیست';
END IF;
END;
+1 -3
View File
@@ -12,6 +12,7 @@ import { CardexModule } from './modules/cardex/cardex.module'
import { InventoriesModule } from './modules/inventories/inventories.module' import { InventoriesModule } from './modules/inventories/inventories.module'
import { PosModule } from './modules/pos/pos.module' import { PosModule } from './modules/pos/pos.module'
import { PurchaseReceiptsModule } from './modules/purchase-receipts/purchase-receipts.module' import { PurchaseReceiptsModule } from './modules/purchase-receipts/purchase-receipts.module'
import { SalesInvoicesModule } from './modules/sales-invoices/sales-invoices.module'
import { StatisticsModule } from './modules/statistics/statistics.module' import { StatisticsModule } from './modules/statistics/statistics.module'
import { SuppliersModule } from './modules/suppliers/suppliers.module' import { SuppliersModule } from './modules/suppliers/suppliers.module'
import { PrismaModule } from './prisma/prisma.module' import { PrismaModule } from './prisma/prisma.module'
@@ -20,8 +21,6 @@ import { ProductCategoriesModule } from './product-categories/product-categories
import { ProductVariantsModule } from './product-variants/product-variants.module' import { ProductVariantsModule } from './product-variants/product-variants.module'
import { ProductsModule } from './products/products.module' import { ProductsModule } from './products/products.module'
import { RolesModule } from './roles/roles.module' import { RolesModule } from './roles/roles.module'
import { SalesInvoiceItemsModule } from './sales-invoice-items/sales-invoice-items.module'
import { SalesInvoicesModule } from './sales-invoices/sales-invoices.module'
import { StockAdjustmentsModule } from './stock-adjustments/stock-adjustments.module' import { StockAdjustmentsModule } from './stock-adjustments/stock-adjustments.module'
import { StockBalanceModule } from './stock-balance/stock-balance.module' import { StockBalanceModule } from './stock-balance/stock-balance.module'
import { StockMovementsModule } from './stock-movements/stock-movements.module' import { StockMovementsModule } from './stock-movements/stock-movements.module'
@@ -42,7 +41,6 @@ import { UsersModule } from './users/users.module'
InventoriesModule, InventoriesModule,
PurchaseReceiptsModule, PurchaseReceiptsModule,
SalesInvoicesModule, SalesInvoicesModule,
SalesInvoiceItemsModule,
InventoryTransfersModule, InventoryTransfersModule,
InventoryTransferItemsModule, InventoryTransferItemsModule,
StockMovementsModule, StockMovementsModule,
+5
View File
@@ -182,3 +182,8 @@ export type Supplier = Prisma.SupplierModel
* *
*/ */
export type SupplierLedger = Prisma.SupplierLedgerModel export type SupplierLedger = Prisma.SupplierLedgerModel
/**
* Model StockAvailableView
*
*/
export type StockAvailableView = Prisma.StockAvailableViewModel
+5
View File
@@ -202,3 +202,8 @@ export type Supplier = Prisma.SupplierModel
* *
*/ */
export type SupplierLedger = Prisma.SupplierLedgerModel export type SupplierLedger = Prisma.SupplierLedgerModel
/**
* Model StockAvailableView
*
*/
export type StockAvailableView = Prisma.StockAvailableViewModel
File diff suppressed because one or more lines are too long
@@ -416,7 +416,8 @@ export const ModelName = {
StockAdjustment: 'StockAdjustment', StockAdjustment: 'StockAdjustment',
StockReservation: 'StockReservation', StockReservation: 'StockReservation',
Supplier: 'Supplier', Supplier: 'Supplier',
SupplierLedger: 'SupplierLedger' SupplierLedger: 'SupplierLedger',
StockAvailableView: 'StockAvailableView'
} as const } as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName] export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -432,7 +433,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions omit: GlobalOmitOptions
} }
meta: { meta: {
modelProps: "user" | "role" | "otpCode" | "refreshToken" | "bankBranch" | "bankAccount" | "bankAccountTransaction" | "inventory" | "inventoryBankAccount" | "posAccount" | "inventoryTransfer" | "inventoryTransferItem" | "bank" | "order" | "orderItem" | "customer" | "triggerLog" | "productVariant" | "product" | "productBrand" | "productCategory" | "purchaseReceipt" | "purchaseReceiptItem" | "purchaseReceiptPayments" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "stockMovement" | "stockBalance" | "stockAdjustment" | "stockReservation" | "supplier" | "supplierLedger" modelProps: "user" | "role" | "otpCode" | "refreshToken" | "bankBranch" | "bankAccount" | "bankAccountTransaction" | "inventory" | "inventoryBankAccount" | "posAccount" | "inventoryTransfer" | "inventoryTransferItem" | "bank" | "order" | "orderItem" | "customer" | "triggerLog" | "productVariant" | "product" | "productBrand" | "productCategory" | "purchaseReceipt" | "purchaseReceiptItem" | "purchaseReceiptPayments" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "stockMovement" | "stockBalance" | "stockAdjustment" | "stockReservation" | "supplier" | "supplierLedger" | "stockAvailableView"
txIsolationLevel: TransactionIsolationLevel txIsolationLevel: TransactionIsolationLevel
} }
model: { model: {
@@ -2614,6 +2615,36 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
} }
} }
} }
StockAvailableView: {
payload: Prisma.$StockAvailableViewPayload<ExtArgs>
fields: Prisma.StockAvailableViewFieldRefs
operations: {
findFirst: {
args: Prisma.StockAvailableViewFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockAvailableViewPayload> | null
}
findFirstOrThrow: {
args: Prisma.StockAvailableViewFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockAvailableViewPayload>
}
findMany: {
args: Prisma.StockAvailableViewFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockAvailableViewPayload>[]
}
aggregate: {
args: Prisma.StockAvailableViewAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateStockAvailableView>
}
groupBy: {
args: Prisma.StockAvailableViewGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.StockAvailableViewGroupByOutputType>[]
}
count: {
args: Prisma.StockAvailableViewCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.StockAvailableViewCountAggregateOutputType> | number
}
}
}
} }
} & { } & {
other: { other: {
@@ -2829,7 +2860,8 @@ export const OrderScalarFieldEnum = {
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt', updatedAt: 'updatedAt',
deletedAt: 'deletedAt', deletedAt: 'deletedAt',
customerId: 'customerId' customerId: 'customerId',
posAccountId: 'posAccountId'
} as const } as const
export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum]
@@ -3078,7 +3110,6 @@ export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldE
export const StockReservationScalarFieldEnum = { export const StockReservationScalarFieldEnum = {
id: 'id', id: 'id',
quantity: 'quantity', quantity: 'quantity',
expiresAt: 'expiresAt',
createdAt: 'createdAt', createdAt: 'createdAt',
productId: 'productId', productId: 'productId',
inventoryId: 'inventoryId', inventoryId: 'inventoryId',
@@ -3122,6 +3153,17 @@ export const SupplierLedgerScalarFieldEnum = {
export type SupplierLedgerScalarFieldEnum = (typeof SupplierLedgerScalarFieldEnum)[keyof typeof SupplierLedgerScalarFieldEnum] export type SupplierLedgerScalarFieldEnum = (typeof SupplierLedgerScalarFieldEnum)[keyof typeof SupplierLedgerScalarFieldEnum]
export const StockAvailableViewScalarFieldEnum = {
productId: 'productId',
inventoryId: 'inventoryId',
physicalQuantity: 'physicalQuantity',
reservedQuantity: 'reservedQuantity',
availableQuantity: 'availableQuantity'
} as const
export type StockAvailableViewScalarFieldEnum = (typeof StockAvailableViewScalarFieldEnum)[keyof typeof StockAvailableViewScalarFieldEnum]
export const SortOrder = { export const SortOrder = {
asc: 'asc', asc: 'asc',
desc: 'desc' desc: 'desc'
@@ -3634,6 +3676,7 @@ export type GlobalOmitConfig = {
stockReservation?: Prisma.StockReservationOmit stockReservation?: Prisma.StockReservationOmit
supplier?: Prisma.SupplierOmit supplier?: Prisma.SupplierOmit
supplierLedger?: Prisma.SupplierLedgerOmit supplierLedger?: Prisma.SupplierLedgerOmit
stockAvailableView?: Prisma.StockAvailableViewOmit
} }
/* Types for Logging */ /* Types for Logging */
@@ -83,7 +83,8 @@ export const ModelName = {
StockAdjustment: 'StockAdjustment', StockAdjustment: 'StockAdjustment',
StockReservation: 'StockReservation', StockReservation: 'StockReservation',
Supplier: 'Supplier', Supplier: 'Supplier',
SupplierLedger: 'SupplierLedger' SupplierLedger: 'SupplierLedger',
StockAvailableView: 'StockAvailableView'
} as const } as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName] export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -278,7 +279,8 @@ export const OrderScalarFieldEnum = {
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt', updatedAt: 'updatedAt',
deletedAt: 'deletedAt', deletedAt: 'deletedAt',
customerId: 'customerId' customerId: 'customerId',
posAccountId: 'posAccountId'
} as const } as const
export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum] export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum]
@@ -527,7 +529,6 @@ export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldE
export const StockReservationScalarFieldEnum = { export const StockReservationScalarFieldEnum = {
id: 'id', id: 'id',
quantity: 'quantity', quantity: 'quantity',
expiresAt: 'expiresAt',
createdAt: 'createdAt', createdAt: 'createdAt',
productId: 'productId', productId: 'productId',
inventoryId: 'inventoryId', inventoryId: 'inventoryId',
@@ -571,6 +572,17 @@ export const SupplierLedgerScalarFieldEnum = {
export type SupplierLedgerScalarFieldEnum = (typeof SupplierLedgerScalarFieldEnum)[keyof typeof SupplierLedgerScalarFieldEnum] export type SupplierLedgerScalarFieldEnum = (typeof SupplierLedgerScalarFieldEnum)[keyof typeof SupplierLedgerScalarFieldEnum]
export const StockAvailableViewScalarFieldEnum = {
productId: 'productId',
inventoryId: 'inventoryId',
physicalQuantity: 'physicalQuantity',
reservedQuantity: 'reservedQuantity',
availableQuantity: 'availableQuantity'
} as const
export type StockAvailableViewScalarFieldEnum = (typeof StockAvailableViewScalarFieldEnum)[keyof typeof StockAvailableViewScalarFieldEnum]
export const SortOrder = { export const SortOrder = {
asc: 'asc', asc: 'asc',
desc: 'desc' desc: 'desc'
+1
View File
@@ -41,4 +41,5 @@ export type * from './models/StockAdjustment.js'
export type * from './models/StockReservation.js' export type * from './models/StockReservation.js'
export type * from './models/Supplier.js' export type * from './models/Supplier.js'
export type * from './models/SupplierLedger.js' export type * from './models/SupplierLedger.js'
export type * from './models/StockAvailableView.js'
export type * from './commonInputTypes.js' export type * from './commonInputTypes.js'
+351 -20
View File
@@ -30,12 +30,14 @@ export type OrderAvgAggregateOutputType = {
id: number | null id: number | null
totalAmount: runtime.Decimal | null totalAmount: runtime.Decimal | null
customerId: number | null customerId: number | null
posAccountId: number | null
} }
export type OrderSumAggregateOutputType = { export type OrderSumAggregateOutputType = {
id: number | null id: number | null
totalAmount: runtime.Decimal | null totalAmount: runtime.Decimal | null
customerId: number | null customerId: number | null
posAccountId: number | null
} }
export type OrderMinAggregateOutputType = { export type OrderMinAggregateOutputType = {
@@ -48,6 +50,7 @@ export type OrderMinAggregateOutputType = {
updatedAt: Date | null updatedAt: Date | null
deletedAt: Date | null deletedAt: Date | null
customerId: number | null customerId: number | null
posAccountId: number | null
} }
export type OrderMaxAggregateOutputType = { export type OrderMaxAggregateOutputType = {
@@ -60,6 +63,7 @@ export type OrderMaxAggregateOutputType = {
updatedAt: Date | null updatedAt: Date | null
deletedAt: Date | null deletedAt: Date | null
customerId: number | null customerId: number | null
posAccountId: number | null
} }
export type OrderCountAggregateOutputType = { export type OrderCountAggregateOutputType = {
@@ -72,6 +76,7 @@ export type OrderCountAggregateOutputType = {
updatedAt: number updatedAt: number
deletedAt: number deletedAt: number
customerId: number customerId: number
posAccountId: number
_all: number _all: number
} }
@@ -80,12 +85,14 @@ export type OrderAvgAggregateInputType = {
id?: true id?: true
totalAmount?: true totalAmount?: true
customerId?: true customerId?: true
posAccountId?: true
} }
export type OrderSumAggregateInputType = { export type OrderSumAggregateInputType = {
id?: true id?: true
totalAmount?: true totalAmount?: true
customerId?: true customerId?: true
posAccountId?: true
} }
export type OrderMinAggregateInputType = { export type OrderMinAggregateInputType = {
@@ -98,6 +105,7 @@ export type OrderMinAggregateInputType = {
updatedAt?: true updatedAt?: true
deletedAt?: true deletedAt?: true
customerId?: true customerId?: true
posAccountId?: true
} }
export type OrderMaxAggregateInputType = { export type OrderMaxAggregateInputType = {
@@ -110,6 +118,7 @@ export type OrderMaxAggregateInputType = {
updatedAt?: true updatedAt?: true
deletedAt?: true deletedAt?: true
customerId?: true customerId?: true
posAccountId?: true
} }
export type OrderCountAggregateInputType = { export type OrderCountAggregateInputType = {
@@ -122,6 +131,7 @@ export type OrderCountAggregateInputType = {
updatedAt?: true updatedAt?: true
deletedAt?: true deletedAt?: true
customerId?: true customerId?: true
posAccountId?: true
_all?: true _all?: true
} }
@@ -221,6 +231,7 @@ export type OrderGroupByOutputType = {
updatedAt: Date updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
customerId: number | null customerId: number | null
posAccountId: number
_count: OrderCountAggregateOutputType | null _count: OrderCountAggregateOutputType | null
_avg: OrderAvgAggregateOutputType | null _avg: OrderAvgAggregateOutputType | null
_sum: OrderSumAggregateOutputType | null _sum: OrderSumAggregateOutputType | null
@@ -256,8 +267,11 @@ export type OrderWhereInput = {
updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null
customerId?: Prisma.IntNullableFilter<"Order"> | number | null customerId?: Prisma.IntNullableFilter<"Order"> | number | null
posAccountId?: Prisma.IntFilter<"Order"> | number
customer?: Prisma.XOR<Prisma.CustomerNullableScalarRelationFilter, Prisma.CustomerWhereInput> | null customer?: Prisma.XOR<Prisma.CustomerNullableScalarRelationFilter, Prisma.CustomerWhereInput> | null
posAccount?: Prisma.XOR<Prisma.PosAccountScalarRelationFilter, Prisma.PosAccountWhereInput>
orderItems?: Prisma.OrderItemListRelationFilter orderItems?: Prisma.OrderItemListRelationFilter
stockReservations?: Prisma.StockReservationListRelationFilter
} }
export type OrderOrderByWithRelationInput = { export type OrderOrderByWithRelationInput = {
@@ -270,8 +284,11 @@ export type OrderOrderByWithRelationInput = {
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
customerId?: Prisma.SortOrderInput | Prisma.SortOrder customerId?: Prisma.SortOrderInput | Prisma.SortOrder
posAccountId?: Prisma.SortOrder
customer?: Prisma.CustomerOrderByWithRelationInput customer?: Prisma.CustomerOrderByWithRelationInput
posAccount?: Prisma.PosAccountOrderByWithRelationInput
orderItems?: Prisma.OrderItemOrderByRelationAggregateInput orderItems?: Prisma.OrderItemOrderByRelationAggregateInput
stockReservations?: Prisma.StockReservationOrderByRelationAggregateInput
_relevance?: Prisma.OrderOrderByRelevanceInput _relevance?: Prisma.OrderOrderByRelevanceInput
} }
@@ -288,8 +305,11 @@ export type OrderWhereUniqueInput = Prisma.AtLeast<{
updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null
customerId?: Prisma.IntNullableFilter<"Order"> | number | null customerId?: Prisma.IntNullableFilter<"Order"> | number | null
posAccountId?: Prisma.IntFilter<"Order"> | number
customer?: Prisma.XOR<Prisma.CustomerNullableScalarRelationFilter, Prisma.CustomerWhereInput> | null customer?: Prisma.XOR<Prisma.CustomerNullableScalarRelationFilter, Prisma.CustomerWhereInput> | null
posAccount?: Prisma.XOR<Prisma.PosAccountScalarRelationFilter, Prisma.PosAccountWhereInput>
orderItems?: Prisma.OrderItemListRelationFilter orderItems?: Prisma.OrderItemListRelationFilter
stockReservations?: Prisma.StockReservationListRelationFilter
}, "id" | "orderNumber"> }, "id" | "orderNumber">
export type OrderOrderByWithAggregationInput = { export type OrderOrderByWithAggregationInput = {
@@ -302,6 +322,7 @@ export type OrderOrderByWithAggregationInput = {
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
customerId?: Prisma.SortOrderInput | Prisma.SortOrder customerId?: Prisma.SortOrderInput | Prisma.SortOrder
posAccountId?: Prisma.SortOrder
_count?: Prisma.OrderCountOrderByAggregateInput _count?: Prisma.OrderCountOrderByAggregateInput
_avg?: Prisma.OrderAvgOrderByAggregateInput _avg?: Prisma.OrderAvgOrderByAggregateInput
_max?: Prisma.OrderMaxOrderByAggregateInput _max?: Prisma.OrderMaxOrderByAggregateInput
@@ -322,6 +343,7 @@ export type OrderScalarWhereWithAggregatesInput = {
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Order"> | Date | string updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Order"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Order"> | Date | string | null deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Order"> | Date | string | null
customerId?: Prisma.IntNullableWithAggregatesFilter<"Order"> | number | null customerId?: Prisma.IntNullableWithAggregatesFilter<"Order"> | number | null
posAccountId?: Prisma.IntWithAggregatesFilter<"Order"> | number
} }
export type OrderCreateInput = { export type OrderCreateInput = {
@@ -333,7 +355,9 @@ export type OrderCreateInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput
posAccount: Prisma.PosAccountCreateNestedOneWithoutOrdersInput
orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationCreateNestedManyWithoutOrderInput
} }
export type OrderUncheckedCreateInput = { export type OrderUncheckedCreateInput = {
@@ -346,7 +370,9 @@ export type OrderUncheckedCreateInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
customerId?: number | null customerId?: number | null
posAccountId: number
orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutOrderInput
} }
export type OrderUpdateInput = { export type OrderUpdateInput = {
@@ -358,7 +384,9 @@ export type OrderUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput
posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutOrdersNestedInput
orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUpdateManyWithoutOrderNestedInput
} }
export type OrderUncheckedUpdateInput = { export type OrderUncheckedUpdateInput = {
@@ -371,7 +399,9 @@ export type OrderUncheckedUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutOrderNestedInput
} }
export type OrderCreateManyInput = { export type OrderCreateManyInput = {
@@ -384,6 +414,7 @@ export type OrderCreateManyInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
customerId?: number | null customerId?: number | null
posAccountId: number
} }
export type OrderUpdateManyMutationInput = { export type OrderUpdateManyMutationInput = {
@@ -406,6 +437,17 @@ export type OrderUncheckedUpdateManyInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
}
export type OrderListRelationFilter = {
every?: Prisma.OrderWhereInput
some?: Prisma.OrderWhereInput
none?: Prisma.OrderWhereInput
}
export type OrderOrderByRelationAggregateInput = {
_count?: Prisma.SortOrder
} }
export type OrderOrderByRelevanceInput = { export type OrderOrderByRelevanceInput = {
@@ -424,12 +466,14 @@ export type OrderCountOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder
customerId?: Prisma.SortOrder customerId?: Prisma.SortOrder
posAccountId?: Prisma.SortOrder
} }
export type OrderAvgOrderByAggregateInput = { export type OrderAvgOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
totalAmount?: Prisma.SortOrder totalAmount?: Prisma.SortOrder
customerId?: Prisma.SortOrder customerId?: Prisma.SortOrder
posAccountId?: Prisma.SortOrder
} }
export type OrderMaxOrderByAggregateInput = { export type OrderMaxOrderByAggregateInput = {
@@ -442,6 +486,7 @@ export type OrderMaxOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder
customerId?: Prisma.SortOrder customerId?: Prisma.SortOrder
posAccountId?: Prisma.SortOrder
} }
export type OrderMinOrderByAggregateInput = { export type OrderMinOrderByAggregateInput = {
@@ -454,12 +499,14 @@ export type OrderMinOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder
customerId?: Prisma.SortOrder customerId?: Prisma.SortOrder
posAccountId?: Prisma.SortOrder
} }
export type OrderSumOrderByAggregateInput = { export type OrderSumOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
totalAmount?: Prisma.SortOrder totalAmount?: Prisma.SortOrder
customerId?: Prisma.SortOrder customerId?: Prisma.SortOrder
posAccountId?: Prisma.SortOrder
} }
export type OrderScalarRelationFilter = { export type OrderScalarRelationFilter = {
@@ -467,14 +514,46 @@ export type OrderScalarRelationFilter = {
isNot?: Prisma.OrderWhereInput isNot?: Prisma.OrderWhereInput
} }
export type OrderListRelationFilter = { export type OrderCreateNestedManyWithoutPosAccountInput = {
every?: Prisma.OrderWhereInput create?: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput> | Prisma.OrderCreateWithoutPosAccountInput[] | Prisma.OrderUncheckedCreateWithoutPosAccountInput[]
some?: Prisma.OrderWhereInput connectOrCreate?: Prisma.OrderCreateOrConnectWithoutPosAccountInput | Prisma.OrderCreateOrConnectWithoutPosAccountInput[]
none?: Prisma.OrderWhereInput createMany?: Prisma.OrderCreateManyPosAccountInputEnvelope
connect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
} }
export type OrderOrderByRelationAggregateInput = { export type OrderUncheckedCreateNestedManyWithoutPosAccountInput = {
_count?: Prisma.SortOrder create?: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput> | Prisma.OrderCreateWithoutPosAccountInput[] | Prisma.OrderUncheckedCreateWithoutPosAccountInput[]
connectOrCreate?: Prisma.OrderCreateOrConnectWithoutPosAccountInput | Prisma.OrderCreateOrConnectWithoutPosAccountInput[]
createMany?: Prisma.OrderCreateManyPosAccountInputEnvelope
connect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
}
export type OrderUpdateManyWithoutPosAccountNestedInput = {
create?: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput> | Prisma.OrderCreateWithoutPosAccountInput[] | Prisma.OrderUncheckedCreateWithoutPosAccountInput[]
connectOrCreate?: Prisma.OrderCreateOrConnectWithoutPosAccountInput | Prisma.OrderCreateOrConnectWithoutPosAccountInput[]
upsert?: Prisma.OrderUpsertWithWhereUniqueWithoutPosAccountInput | Prisma.OrderUpsertWithWhereUniqueWithoutPosAccountInput[]
createMany?: Prisma.OrderCreateManyPosAccountInputEnvelope
set?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
disconnect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
delete?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
connect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
update?: Prisma.OrderUpdateWithWhereUniqueWithoutPosAccountInput | Prisma.OrderUpdateWithWhereUniqueWithoutPosAccountInput[]
updateMany?: Prisma.OrderUpdateManyWithWhereWithoutPosAccountInput | Prisma.OrderUpdateManyWithWhereWithoutPosAccountInput[]
deleteMany?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[]
}
export type OrderUncheckedUpdateManyWithoutPosAccountNestedInput = {
create?: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput> | Prisma.OrderCreateWithoutPosAccountInput[] | Prisma.OrderUncheckedCreateWithoutPosAccountInput[]
connectOrCreate?: Prisma.OrderCreateOrConnectWithoutPosAccountInput | Prisma.OrderCreateOrConnectWithoutPosAccountInput[]
upsert?: Prisma.OrderUpsertWithWhereUniqueWithoutPosAccountInput | Prisma.OrderUpsertWithWhereUniqueWithoutPosAccountInput[]
createMany?: Prisma.OrderCreateManyPosAccountInputEnvelope
set?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
disconnect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
delete?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
connect?: Prisma.OrderWhereUniqueInput | Prisma.OrderWhereUniqueInput[]
update?: Prisma.OrderUpdateWithWhereUniqueWithoutPosAccountInput | Prisma.OrderUpdateWithWhereUniqueWithoutPosAccountInput[]
updateMany?: Prisma.OrderUpdateManyWithWhereWithoutPosAccountInput | Prisma.OrderUpdateManyWithWhereWithoutPosAccountInput[]
deleteMany?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[]
} }
export type EnumOrderStatusFieldUpdateOperationsInput = { export type EnumOrderStatusFieldUpdateOperationsInput = {
@@ -545,6 +624,89 @@ export type OrderUncheckedUpdateManyWithoutCustomerNestedInput = {
deleteMany?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[] deleteMany?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[]
} }
export type OrderCreateNestedOneWithoutStockReservationsInput = {
create?: Prisma.XOR<Prisma.OrderCreateWithoutStockReservationsInput, Prisma.OrderUncheckedCreateWithoutStockReservationsInput>
connectOrCreate?: Prisma.OrderCreateOrConnectWithoutStockReservationsInput
connect?: Prisma.OrderWhereUniqueInput
}
export type OrderUpdateOneRequiredWithoutStockReservationsNestedInput = {
create?: Prisma.XOR<Prisma.OrderCreateWithoutStockReservationsInput, Prisma.OrderUncheckedCreateWithoutStockReservationsInput>
connectOrCreate?: Prisma.OrderCreateOrConnectWithoutStockReservationsInput
upsert?: Prisma.OrderUpsertWithoutStockReservationsInput
connect?: Prisma.OrderWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.OrderUpdateToOneWithWhereWithoutStockReservationsInput, Prisma.OrderUpdateWithoutStockReservationsInput>, Prisma.OrderUncheckedUpdateWithoutStockReservationsInput>
}
export type OrderCreateWithoutPosAccountInput = {
orderNumber: string
status?: $Enums.OrderStatus
totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string
description?: string | null
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput
orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationCreateNestedManyWithoutOrderInput
}
export type OrderUncheckedCreateWithoutPosAccountInput = {
id?: number
orderNumber: string
status?: $Enums.OrderStatus
totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string
description?: string | null
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
customerId?: number | null
orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutOrderInput
}
export type OrderCreateOrConnectWithoutPosAccountInput = {
where: Prisma.OrderWhereUniqueInput
create: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput>
}
export type OrderCreateManyPosAccountInputEnvelope = {
data: Prisma.OrderCreateManyPosAccountInput | Prisma.OrderCreateManyPosAccountInput[]
skipDuplicates?: boolean
}
export type OrderUpsertWithWhereUniqueWithoutPosAccountInput = {
where: Prisma.OrderWhereUniqueInput
update: Prisma.XOR<Prisma.OrderUpdateWithoutPosAccountInput, Prisma.OrderUncheckedUpdateWithoutPosAccountInput>
create: Prisma.XOR<Prisma.OrderCreateWithoutPosAccountInput, Prisma.OrderUncheckedCreateWithoutPosAccountInput>
}
export type OrderUpdateWithWhereUniqueWithoutPosAccountInput = {
where: Prisma.OrderWhereUniqueInput
data: Prisma.XOR<Prisma.OrderUpdateWithoutPosAccountInput, Prisma.OrderUncheckedUpdateWithoutPosAccountInput>
}
export type OrderUpdateManyWithWhereWithoutPosAccountInput = {
where: Prisma.OrderScalarWhereInput
data: Prisma.XOR<Prisma.OrderUpdateManyMutationInput, Prisma.OrderUncheckedUpdateManyWithoutPosAccountInput>
}
export type OrderScalarWhereInput = {
AND?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[]
OR?: Prisma.OrderScalarWhereInput[]
NOT?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[]
id?: Prisma.IntFilter<"Order"> | number
orderNumber?: Prisma.StringFilter<"Order"> | string
status?: Prisma.EnumOrderStatusFilter<"Order"> | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.StringNullableFilter<"Order"> | string | null
createdAt?: Prisma.DateTimeFilter<"Order"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null
customerId?: Prisma.IntNullableFilter<"Order"> | number | null
posAccountId?: Prisma.IntFilter<"Order"> | number
}
export type OrderCreateWithoutOrderItemsInput = { export type OrderCreateWithoutOrderItemsInput = {
orderNumber: string orderNumber: string
status?: $Enums.OrderStatus status?: $Enums.OrderStatus
@@ -554,6 +716,8 @@ export type OrderCreateWithoutOrderItemsInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput
posAccount: Prisma.PosAccountCreateNestedOneWithoutOrdersInput
stockReservations?: Prisma.StockReservationCreateNestedManyWithoutOrderInput
} }
export type OrderUncheckedCreateWithoutOrderItemsInput = { export type OrderUncheckedCreateWithoutOrderItemsInput = {
@@ -566,6 +730,8 @@ export type OrderUncheckedCreateWithoutOrderItemsInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
customerId?: number | null customerId?: number | null
posAccountId: number
stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutOrderInput
} }
export type OrderCreateOrConnectWithoutOrderItemsInput = { export type OrderCreateOrConnectWithoutOrderItemsInput = {
@@ -593,6 +759,8 @@ export type OrderUpdateWithoutOrderItemsInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput
posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutOrdersNestedInput
stockReservations?: Prisma.StockReservationUpdateManyWithoutOrderNestedInput
} }
export type OrderUncheckedUpdateWithoutOrderItemsInput = { export type OrderUncheckedUpdateWithoutOrderItemsInput = {
@@ -605,6 +773,8 @@ export type OrderUncheckedUpdateWithoutOrderItemsInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutOrderNestedInput
} }
export type OrderCreateWithoutCustomerInput = { export type OrderCreateWithoutCustomerInput = {
@@ -615,7 +785,9 @@ export type OrderCreateWithoutCustomerInput = {
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
posAccount: Prisma.PosAccountCreateNestedOneWithoutOrdersInput
orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationCreateNestedManyWithoutOrderInput
} }
export type OrderUncheckedCreateWithoutCustomerInput = { export type OrderUncheckedCreateWithoutCustomerInput = {
@@ -627,7 +799,9 @@ export type OrderUncheckedCreateWithoutCustomerInput = {
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
posAccountId: number
orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput
stockReservations?: Prisma.StockReservationUncheckedCreateNestedManyWithoutOrderInput
} }
export type OrderCreateOrConnectWithoutCustomerInput = { export type OrderCreateOrConnectWithoutCustomerInput = {
@@ -656,19 +830,125 @@ export type OrderUpdateManyWithWhereWithoutCustomerInput = {
data: Prisma.XOR<Prisma.OrderUpdateManyMutationInput, Prisma.OrderUncheckedUpdateManyWithoutCustomerInput> data: Prisma.XOR<Prisma.OrderUpdateManyMutationInput, Prisma.OrderUncheckedUpdateManyWithoutCustomerInput>
} }
export type OrderScalarWhereInput = { export type OrderCreateWithoutStockReservationsInput = {
AND?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[] orderNumber: string
OR?: Prisma.OrderScalarWhereInput[] status?: $Enums.OrderStatus
NOT?: Prisma.OrderScalarWhereInput | Prisma.OrderScalarWhereInput[] totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string
id?: Prisma.IntFilter<"Order"> | number description?: string | null
orderNumber?: Prisma.StringFilter<"Order"> | string createdAt?: Date | string
status?: Prisma.EnumOrderStatusFilter<"Order"> | $Enums.OrderStatus updatedAt?: Date | string
totalAmount?: Prisma.DecimalFilter<"Order"> | runtime.Decimal | runtime.DecimalJsLike | number | string deletedAt?: Date | string | null
description?: Prisma.StringNullableFilter<"Order"> | string | null customer?: Prisma.CustomerCreateNestedOneWithoutOrdersInput
createdAt?: Prisma.DateTimeFilter<"Order"> | Date | string posAccount: Prisma.PosAccountCreateNestedOneWithoutOrdersInput
updatedAt?: Prisma.DateTimeFilter<"Order"> | Date | string orderItems?: Prisma.OrderItemCreateNestedManyWithoutOrderInput
deletedAt?: Prisma.DateTimeNullableFilter<"Order"> | Date | string | null }
customerId?: Prisma.IntNullableFilter<"Order"> | number | null
export type OrderUncheckedCreateWithoutStockReservationsInput = {
id?: number
orderNumber: string
status?: $Enums.OrderStatus
totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string
description?: string | null
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
customerId?: number | null
posAccountId: number
orderItems?: Prisma.OrderItemUncheckedCreateNestedManyWithoutOrderInput
}
export type OrderCreateOrConnectWithoutStockReservationsInput = {
where: Prisma.OrderWhereUniqueInput
create: Prisma.XOR<Prisma.OrderCreateWithoutStockReservationsInput, Prisma.OrderUncheckedCreateWithoutStockReservationsInput>
}
export type OrderUpsertWithoutStockReservationsInput = {
update: Prisma.XOR<Prisma.OrderUpdateWithoutStockReservationsInput, Prisma.OrderUncheckedUpdateWithoutStockReservationsInput>
create: Prisma.XOR<Prisma.OrderCreateWithoutStockReservationsInput, Prisma.OrderUncheckedCreateWithoutStockReservationsInput>
where?: Prisma.OrderWhereInput
}
export type OrderUpdateToOneWithWhereWithoutStockReservationsInput = {
where?: Prisma.OrderWhereInput
data: Prisma.XOR<Prisma.OrderUpdateWithoutStockReservationsInput, Prisma.OrderUncheckedUpdateWithoutStockReservationsInput>
}
export type OrderUpdateWithoutStockReservationsInput = {
orderNumber?: Prisma.StringFieldUpdateOperationsInput | string
status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput
posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutOrdersNestedInput
orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput
}
export type OrderUncheckedUpdateWithoutStockReservationsInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
orderNumber?: Prisma.StringFieldUpdateOperationsInput | string
status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput
}
export type OrderCreateManyPosAccountInput = {
id?: number
orderNumber: string
status?: $Enums.OrderStatus
totalAmount: runtime.Decimal | runtime.DecimalJsLike | number | string
description?: string | null
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
customerId?: number | null
}
export type OrderUpdateWithoutPosAccountInput = {
orderNumber?: Prisma.StringFieldUpdateOperationsInput | string
status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customer?: Prisma.CustomerUpdateOneWithoutOrdersNestedInput
orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUpdateManyWithoutOrderNestedInput
}
export type OrderUncheckedUpdateWithoutPosAccountInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
orderNumber?: Prisma.StringFieldUpdateOperationsInput | string
status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutOrderNestedInput
}
export type OrderUncheckedUpdateManyWithoutPosAccountInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
orderNumber?: Prisma.StringFieldUpdateOperationsInput | string
status?: Prisma.EnumOrderStatusFieldUpdateOperationsInput | $Enums.OrderStatus
totalAmount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
customerId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
} }
export type OrderCreateManyCustomerInput = { export type OrderCreateManyCustomerInput = {
@@ -680,6 +960,7 @@ export type OrderCreateManyCustomerInput = {
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
posAccountId: number
} }
export type OrderUpdateWithoutCustomerInput = { export type OrderUpdateWithoutCustomerInput = {
@@ -690,7 +971,9 @@ export type OrderUpdateWithoutCustomerInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
posAccount?: Prisma.PosAccountUpdateOneRequiredWithoutOrdersNestedInput
orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput orderItems?: Prisma.OrderItemUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUpdateManyWithoutOrderNestedInput
} }
export type OrderUncheckedUpdateWithoutCustomerInput = { export type OrderUncheckedUpdateWithoutCustomerInput = {
@@ -702,7 +985,9 @@ export type OrderUncheckedUpdateWithoutCustomerInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput orderItems?: Prisma.OrderItemUncheckedUpdateManyWithoutOrderNestedInput
stockReservations?: Prisma.StockReservationUncheckedUpdateManyWithoutOrderNestedInput
} }
export type OrderUncheckedUpdateManyWithoutCustomerInput = { export type OrderUncheckedUpdateManyWithoutCustomerInput = {
@@ -714,6 +999,7 @@ export type OrderUncheckedUpdateManyWithoutCustomerInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
posAccountId?: Prisma.IntFieldUpdateOperationsInput | number
} }
@@ -723,10 +1009,12 @@ export type OrderUncheckedUpdateManyWithoutCustomerInput = {
export type OrderCountOutputType = { export type OrderCountOutputType = {
orderItems: number orderItems: number
stockReservations: number
} }
export type OrderCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type OrderCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
orderItems?: boolean | OrderCountOutputTypeCountOrderItemsArgs orderItems?: boolean | OrderCountOutputTypeCountOrderItemsArgs
stockReservations?: boolean | OrderCountOutputTypeCountStockReservationsArgs
} }
/** /**
@@ -746,6 +1034,13 @@ export type OrderCountOutputTypeCountOrderItemsArgs<ExtArgs extends runtime.Type
where?: Prisma.OrderItemWhereInput where?: Prisma.OrderItemWhereInput
} }
/**
* OrderCountOutputType without action
*/
export type OrderCountOutputTypeCountStockReservationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.StockReservationWhereInput
}
export type OrderSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type OrderSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
@@ -757,8 +1052,11 @@ export type OrderSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean deletedAt?: boolean
customerId?: boolean customerId?: boolean
posAccountId?: boolean
customer?: boolean | Prisma.Order$customerArgs<ExtArgs> customer?: boolean | Prisma.Order$customerArgs<ExtArgs>
posAccount?: boolean | Prisma.PosAccountDefaultArgs<ExtArgs>
orderItems?: boolean | Prisma.Order$orderItemsArgs<ExtArgs> orderItems?: boolean | Prisma.Order$orderItemsArgs<ExtArgs>
stockReservations?: boolean | Prisma.Order$stockReservationsArgs<ExtArgs>
_count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs<ExtArgs> _count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["order"]> }, ExtArgs["result"]["order"]>
@@ -774,12 +1072,15 @@ export type OrderSelectScalar = {
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean deletedAt?: boolean
customerId?: boolean customerId?: boolean
posAccountId?: boolean
} }
export type OrderOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "orderNumber" | "status" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "deletedAt" | "customerId", ExtArgs["result"]["order"]> export type OrderOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "orderNumber" | "status" | "totalAmount" | "description" | "createdAt" | "updatedAt" | "deletedAt" | "customerId" | "posAccountId", ExtArgs["result"]["order"]>
export type OrderInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type OrderInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
customer?: boolean | Prisma.Order$customerArgs<ExtArgs> customer?: boolean | Prisma.Order$customerArgs<ExtArgs>
posAccount?: boolean | Prisma.PosAccountDefaultArgs<ExtArgs>
orderItems?: boolean | Prisma.Order$orderItemsArgs<ExtArgs> orderItems?: boolean | Prisma.Order$orderItemsArgs<ExtArgs>
stockReservations?: boolean | Prisma.Order$stockReservationsArgs<ExtArgs>
_count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs<ExtArgs> _count?: boolean | Prisma.OrderCountOutputTypeDefaultArgs<ExtArgs>
} }
@@ -787,7 +1088,9 @@ export type $OrderPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
name: "Order" name: "Order"
objects: { objects: {
customer: Prisma.$CustomerPayload<ExtArgs> | null customer: Prisma.$CustomerPayload<ExtArgs> | null
posAccount: Prisma.$PosAccountPayload<ExtArgs>
orderItems: Prisma.$OrderItemPayload<ExtArgs>[] orderItems: Prisma.$OrderItemPayload<ExtArgs>[]
stockReservations: Prisma.$StockReservationPayload<ExtArgs>[]
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: number id: number
@@ -799,6 +1102,7 @@ export type $OrderPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
updatedAt: Date updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
customerId: number | null customerId: number | null
posAccountId: number
}, ExtArgs["result"]["order"]> }, ExtArgs["result"]["order"]>
composites: {} composites: {}
} }
@@ -1140,7 +1444,9 @@ readonly fields: OrderFieldRefs;
export interface Prisma__OrderClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> { export interface Prisma__OrderClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
readonly [Symbol.toStringTag]: "PrismaPromise" readonly [Symbol.toStringTag]: "PrismaPromise"
customer<T extends Prisma.Order$customerArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Order$customerArgs<ExtArgs>>): Prisma.Prisma__CustomerClient<runtime.Types.Result.GetResult<Prisma.$CustomerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> customer<T extends Prisma.Order$customerArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Order$customerArgs<ExtArgs>>): Prisma.Prisma__CustomerClient<runtime.Types.Result.GetResult<Prisma.$CustomerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
posAccount<T extends Prisma.PosAccountDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PosAccountDefaultArgs<ExtArgs>>): Prisma.Prisma__PosAccountClient<runtime.Types.Result.GetResult<Prisma.$PosAccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
orderItems<T extends Prisma.Order$orderItemsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Order$orderItemsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OrderItemPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null> orderItems<T extends Prisma.Order$orderItemsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Order$orderItemsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OrderItemPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
stockReservations<T extends Prisma.Order$stockReservationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Order$stockReservationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$StockReservationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/** /**
* Attaches callbacks for the resolution and/or rejection of the Promise. * Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved. * @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1179,6 +1485,7 @@ export interface OrderFieldRefs {
readonly updatedAt: Prisma.FieldRef<"Order", 'DateTime'> readonly updatedAt: Prisma.FieldRef<"Order", 'DateTime'>
readonly deletedAt: Prisma.FieldRef<"Order", 'DateTime'> readonly deletedAt: Prisma.FieldRef<"Order", 'DateTime'>
readonly customerId: Prisma.FieldRef<"Order", 'Int'> readonly customerId: Prisma.FieldRef<"Order", 'Int'>
readonly posAccountId: Prisma.FieldRef<"Order", 'Int'>
} }
@@ -1564,6 +1871,30 @@ export type Order$orderItemsArgs<ExtArgs extends runtime.Types.Extensions.Intern
distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[] distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[]
} }
/**
* Order.stockReservations
*/
export type Order$stockReservationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the StockReservation
*/
select?: Prisma.StockReservationSelect<ExtArgs> | null
/**
* Omit specific fields from the StockReservation
*/
omit?: Prisma.StockReservationOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.StockReservationInclude<ExtArgs> | null
where?: Prisma.StockReservationWhereInput
orderBy?: Prisma.StockReservationOrderByWithRelationInput | Prisma.StockReservationOrderByWithRelationInput[]
cursor?: Prisma.StockReservationWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.StockReservationScalarFieldEnum | Prisma.StockReservationScalarFieldEnum[]
}
/** /**
* Order without action * Order without action
*/ */
+130
View File
@@ -258,6 +258,7 @@ export type PosAccountWhereInput = {
deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null
inventoryBankAccount?: Prisma.XOR<Prisma.InventoryBankAccountScalarRelationFilter, Prisma.InventoryBankAccountWhereInput> inventoryBankAccount?: Prisma.XOR<Prisma.InventoryBankAccountScalarRelationFilter, Prisma.InventoryBankAccountWhereInput>
salesInvoices?: Prisma.SalesInvoiceListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter
orders?: Prisma.OrderListRelationFilter
} }
export type PosAccountOrderByWithRelationInput = { export type PosAccountOrderByWithRelationInput = {
@@ -272,6 +273,7 @@ export type PosAccountOrderByWithRelationInput = {
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
inventoryBankAccount?: Prisma.InventoryBankAccountOrderByWithRelationInput inventoryBankAccount?: Prisma.InventoryBankAccountOrderByWithRelationInput
salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput
orders?: Prisma.OrderOrderByRelationAggregateInput
_relevance?: Prisma.PosAccountOrderByRelevanceInput _relevance?: Prisma.PosAccountOrderByRelevanceInput
} }
@@ -290,6 +292,7 @@ export type PosAccountWhereUniqueInput = Prisma.AtLeast<{
deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null
inventoryBankAccount?: Prisma.XOR<Prisma.InventoryBankAccountScalarRelationFilter, Prisma.InventoryBankAccountWhereInput> inventoryBankAccount?: Prisma.XOR<Prisma.InventoryBankAccountScalarRelationFilter, Prisma.InventoryBankAccountWhereInput>
salesInvoices?: Prisma.SalesInvoiceListRelationFilter salesInvoices?: Prisma.SalesInvoiceListRelationFilter
orders?: Prisma.OrderListRelationFilter
}, "id" | "code"> }, "id" | "code">
export type PosAccountOrderByWithAggregationInput = { export type PosAccountOrderByWithAggregationInput = {
@@ -333,6 +336,7 @@ export type PosAccountCreateInput = {
deletedAt?: Date | string | null deletedAt?: Date | string | null
inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput
salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput
orders?: Prisma.OrderCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountUncheckedCreateInput = { export type PosAccountUncheckedCreateInput = {
@@ -346,6 +350,7 @@ export type PosAccountUncheckedCreateInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput
orders?: Prisma.OrderUncheckedCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountUpdateInput = { export type PosAccountUpdateInput = {
@@ -357,6 +362,7 @@ export type PosAccountUpdateInput = {
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput
salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput
orders?: Prisma.OrderUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountUncheckedUpdateInput = { export type PosAccountUncheckedUpdateInput = {
@@ -370,6 +376,7 @@ export type PosAccountUncheckedUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput
orders?: Prisma.OrderUncheckedUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountCreateManyInput = { export type PosAccountCreateManyInput = {
@@ -516,6 +523,20 @@ export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountNestedInput
deleteMany?: Prisma.PosAccountScalarWhereInput | Prisma.PosAccountScalarWhereInput[] deleteMany?: Prisma.PosAccountScalarWhereInput | Prisma.PosAccountScalarWhereInput[]
} }
export type PosAccountCreateNestedOneWithoutOrdersInput = {
create?: Prisma.XOR<Prisma.PosAccountCreateWithoutOrdersInput, Prisma.PosAccountUncheckedCreateWithoutOrdersInput>
connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutOrdersInput
connect?: Prisma.PosAccountWhereUniqueInput
}
export type PosAccountUpdateOneRequiredWithoutOrdersNestedInput = {
create?: Prisma.XOR<Prisma.PosAccountCreateWithoutOrdersInput, Prisma.PosAccountUncheckedCreateWithoutOrdersInput>
connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutOrdersInput
upsert?: Prisma.PosAccountUpsertWithoutOrdersInput
connect?: Prisma.PosAccountWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.PosAccountUpdateToOneWithWhereWithoutOrdersInput, Prisma.PosAccountUpdateWithoutOrdersInput>, Prisma.PosAccountUncheckedUpdateWithoutOrdersInput>
}
export type PosAccountCreateNestedOneWithoutSalesInvoicesInput = { export type PosAccountCreateNestedOneWithoutSalesInvoicesInput = {
create?: Prisma.XOR<Prisma.PosAccountCreateWithoutSalesInvoicesInput, Prisma.PosAccountUncheckedCreateWithoutSalesInvoicesInput> create?: Prisma.XOR<Prisma.PosAccountCreateWithoutSalesInvoicesInput, Prisma.PosAccountUncheckedCreateWithoutSalesInvoicesInput>
connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutSalesInvoicesInput connectOrCreate?: Prisma.PosAccountCreateOrConnectWithoutSalesInvoicesInput
@@ -538,6 +559,7 @@ export type PosAccountCreateWithoutInventoryBankAccountInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput
orders?: Prisma.OrderCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountUncheckedCreateWithoutInventoryBankAccountInput = { export type PosAccountUncheckedCreateWithoutInventoryBankAccountInput = {
@@ -549,6 +571,7 @@ export type PosAccountUncheckedCreateWithoutInventoryBankAccountInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput
orders?: Prisma.OrderUncheckedCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountCreateOrConnectWithoutInventoryBankAccountInput = { export type PosAccountCreateOrConnectWithoutInventoryBankAccountInput = {
@@ -592,6 +615,70 @@ export type PosAccountScalarWhereInput = {
deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"PosAccount"> | Date | string | null
} }
export type PosAccountCreateWithoutOrdersInput = {
name: string
code: string
description?: string | null
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput
salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosAccountInput
}
export type PosAccountUncheckedCreateWithoutOrdersInput = {
id?: number
name: string
code: string
description?: string | null
bankAccountId: number
inventoryId: number
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosAccountInput
}
export type PosAccountCreateOrConnectWithoutOrdersInput = {
where: Prisma.PosAccountWhereUniqueInput
create: Prisma.XOR<Prisma.PosAccountCreateWithoutOrdersInput, Prisma.PosAccountUncheckedCreateWithoutOrdersInput>
}
export type PosAccountUpsertWithoutOrdersInput = {
update: Prisma.XOR<Prisma.PosAccountUpdateWithoutOrdersInput, Prisma.PosAccountUncheckedUpdateWithoutOrdersInput>
create: Prisma.XOR<Prisma.PosAccountCreateWithoutOrdersInput, Prisma.PosAccountUncheckedCreateWithoutOrdersInput>
where?: Prisma.PosAccountWhereInput
}
export type PosAccountUpdateToOneWithWhereWithoutOrdersInput = {
where?: Prisma.PosAccountWhereInput
data: Prisma.XOR<Prisma.PosAccountUpdateWithoutOrdersInput, Prisma.PosAccountUncheckedUpdateWithoutOrdersInput>
}
export type PosAccountUpdateWithoutOrdersInput = {
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
salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput
}
export type PosAccountUncheckedUpdateWithoutOrdersInput = {
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
salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput
}
export type PosAccountCreateWithoutSalesInvoicesInput = { export type PosAccountCreateWithoutSalesInvoicesInput = {
name: string name: string
code: string code: string
@@ -600,6 +687,7 @@ export type PosAccountCreateWithoutSalesInvoicesInput = {
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput inventoryBankAccount: Prisma.InventoryBankAccountCreateNestedOneWithoutPosAccountsInput
orders?: Prisma.OrderCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountUncheckedCreateWithoutSalesInvoicesInput = { export type PosAccountUncheckedCreateWithoutSalesInvoicesInput = {
@@ -612,6 +700,7 @@ export type PosAccountUncheckedCreateWithoutSalesInvoicesInput = {
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
orders?: Prisma.OrderUncheckedCreateNestedManyWithoutPosAccountInput
} }
export type PosAccountCreateOrConnectWithoutSalesInvoicesInput = { export type PosAccountCreateOrConnectWithoutSalesInvoicesInput = {
@@ -638,6 +727,7 @@ export type PosAccountUpdateWithoutSalesInvoicesInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput inventoryBankAccount?: Prisma.InventoryBankAccountUpdateOneRequiredWithoutPosAccountsNestedInput
orders?: Prisma.OrderUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountUncheckedUpdateWithoutSalesInvoicesInput = { export type PosAccountUncheckedUpdateWithoutSalesInvoicesInput = {
@@ -650,6 +740,7 @@ export type PosAccountUncheckedUpdateWithoutSalesInvoicesInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
orders?: Prisma.OrderUncheckedUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountCreateManyInventoryBankAccountInput = { export type PosAccountCreateManyInventoryBankAccountInput = {
@@ -670,6 +761,7 @@ export type PosAccountUpdateWithoutInventoryBankAccountInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutPosAccountNestedInput
orders?: Prisma.OrderUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountUncheckedUpdateWithoutInventoryBankAccountInput = { export type PosAccountUncheckedUpdateWithoutInventoryBankAccountInput = {
@@ -681,6 +773,7 @@ export type PosAccountUncheckedUpdateWithoutInventoryBankAccountInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosAccountNestedInput
orders?: Prisma.OrderUncheckedUpdateManyWithoutPosAccountNestedInput
} }
export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountInput = { export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountInput = {
@@ -700,10 +793,12 @@ export type PosAccountUncheckedUpdateManyWithoutInventoryBankAccountInput = {
export type PosAccountCountOutputType = { export type PosAccountCountOutputType = {
salesInvoices: number salesInvoices: number
orders: number
} }
export type PosAccountCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type PosAccountCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
salesInvoices?: boolean | PosAccountCountOutputTypeCountSalesInvoicesArgs salesInvoices?: boolean | PosAccountCountOutputTypeCountSalesInvoicesArgs
orders?: boolean | PosAccountCountOutputTypeCountOrdersArgs
} }
/** /**
@@ -723,6 +818,13 @@ export type PosAccountCountOutputTypeCountSalesInvoicesArgs<ExtArgs extends runt
where?: Prisma.SalesInvoiceWhereInput where?: Prisma.SalesInvoiceWhereInput
} }
/**
* PosAccountCountOutputType without action
*/
export type PosAccountCountOutputTypeCountOrdersArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.OrderWhereInput
}
export type PosAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type PosAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
@@ -736,6 +838,7 @@ export type PosAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalAr
deletedAt?: boolean deletedAt?: boolean
inventoryBankAccount?: boolean | Prisma.InventoryBankAccountDefaultArgs<ExtArgs> inventoryBankAccount?: boolean | Prisma.InventoryBankAccountDefaultArgs<ExtArgs>
salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs<ExtArgs> salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs<ExtArgs>
orders?: boolean | Prisma.PosAccount$ordersArgs<ExtArgs>
_count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs<ExtArgs> _count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["posAccount"]> }, ExtArgs["result"]["posAccount"]>
@@ -757,6 +860,7 @@ export type PosAccountOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs
export type PosAccountInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type PosAccountInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
inventoryBankAccount?: boolean | Prisma.InventoryBankAccountDefaultArgs<ExtArgs> inventoryBankAccount?: boolean | Prisma.InventoryBankAccountDefaultArgs<ExtArgs>
salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs<ExtArgs> salesInvoices?: boolean | Prisma.PosAccount$salesInvoicesArgs<ExtArgs>
orders?: boolean | Prisma.PosAccount$ordersArgs<ExtArgs>
_count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs<ExtArgs> _count?: boolean | Prisma.PosAccountCountOutputTypeDefaultArgs<ExtArgs>
} }
@@ -765,6 +869,7 @@ export type $PosAccountPayload<ExtArgs extends runtime.Types.Extensions.Internal
objects: { objects: {
inventoryBankAccount: Prisma.$InventoryBankAccountPayload<ExtArgs> inventoryBankAccount: Prisma.$InventoryBankAccountPayload<ExtArgs>
salesInvoices: Prisma.$SalesInvoicePayload<ExtArgs>[] salesInvoices: Prisma.$SalesInvoicePayload<ExtArgs>[]
orders: Prisma.$OrderPayload<ExtArgs>[]
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: number id: number
@@ -1118,6 +1223,7 @@ export interface Prisma__PosAccountClient<T, Null = never, ExtArgs extends runti
readonly [Symbol.toStringTag]: "PrismaPromise" readonly [Symbol.toStringTag]: "PrismaPromise"
inventoryBankAccount<T extends Prisma.InventoryBankAccountDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.InventoryBankAccountDefaultArgs<ExtArgs>>): Prisma.Prisma__InventoryBankAccountClient<runtime.Types.Result.GetResult<Prisma.$InventoryBankAccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> inventoryBankAccount<T extends Prisma.InventoryBankAccountDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.InventoryBankAccountDefaultArgs<ExtArgs>>): Prisma.Prisma__InventoryBankAccountClient<runtime.Types.Result.GetResult<Prisma.$InventoryBankAccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
salesInvoices<T extends Prisma.PosAccount$salesInvoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PosAccount$salesInvoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null> salesInvoices<T extends Prisma.PosAccount$salesInvoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PosAccount$salesInvoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
orders<T extends Prisma.PosAccount$ordersArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PosAccount$ordersArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OrderPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/** /**
* Attaches callbacks for the resolution and/or rejection of the Promise. * Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved. * @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1522,6 +1628,30 @@ export type PosAccount$salesInvoicesArgs<ExtArgs extends runtime.Types.Extension
distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[] distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[]
} }
/**
* PosAccount.orders
*/
export type PosAccount$ordersArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the Order
*/
select?: Prisma.OrderSelect<ExtArgs> | null
/**
* Omit specific fields from the Order
*/
omit?: Prisma.OrderOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.OrderInclude<ExtArgs> | null
where?: Prisma.OrderWhereInput
orderBy?: Prisma.OrderOrderByWithRelationInput | Prisma.OrderOrderByWithRelationInput[]
cursor?: Prisma.OrderWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.OrderScalarFieldEnum | Prisma.OrderScalarFieldEnum[]
}
/** /**
* PosAccount without action * PosAccount without action
*/ */
@@ -0,0 +1,719 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `StockAvailableView` model and its related types.
*
* 🟢 You can import this file directly.
*/
import type * as runtime from "@prisma/client/runtime/client"
import type * as $Enums from "../enums.js"
import type * as Prisma from "../internal/prismaNamespace.js"
/**
* Model StockAvailableView
*
*/
export type StockAvailableViewModel = runtime.Types.Result.DefaultSelection<Prisma.$StockAvailableViewPayload>
export type AggregateStockAvailableView = {
_count: StockAvailableViewCountAggregateOutputType | null
_avg: StockAvailableViewAvgAggregateOutputType | null
_sum: StockAvailableViewSumAggregateOutputType | null
_min: StockAvailableViewMinAggregateOutputType | null
_max: StockAvailableViewMaxAggregateOutputType | null
}
export type StockAvailableViewAvgAggregateOutputType = {
productId: number | null
inventoryId: number | null
physicalQuantity: runtime.Decimal | null
reservedQuantity: runtime.Decimal | null
availableQuantity: runtime.Decimal | null
}
export type StockAvailableViewSumAggregateOutputType = {
productId: number | null
inventoryId: number | null
physicalQuantity: runtime.Decimal | null
reservedQuantity: runtime.Decimal | null
availableQuantity: runtime.Decimal | null
}
export type StockAvailableViewMinAggregateOutputType = {
productId: number | null
inventoryId: number | null
physicalQuantity: runtime.Decimal | null
reservedQuantity: runtime.Decimal | null
availableQuantity: runtime.Decimal | null
}
export type StockAvailableViewMaxAggregateOutputType = {
productId: number | null
inventoryId: number | null
physicalQuantity: runtime.Decimal | null
reservedQuantity: runtime.Decimal | null
availableQuantity: runtime.Decimal | null
}
export type StockAvailableViewCountAggregateOutputType = {
productId: number
inventoryId: number
physicalQuantity: number
reservedQuantity: number
availableQuantity: number
_all: number
}
export type StockAvailableViewAvgAggregateInputType = {
productId?: true
inventoryId?: true
physicalQuantity?: true
reservedQuantity?: true
availableQuantity?: true
}
export type StockAvailableViewSumAggregateInputType = {
productId?: true
inventoryId?: true
physicalQuantity?: true
reservedQuantity?: true
availableQuantity?: true
}
export type StockAvailableViewMinAggregateInputType = {
productId?: true
inventoryId?: true
physicalQuantity?: true
reservedQuantity?: true
availableQuantity?: true
}
export type StockAvailableViewMaxAggregateInputType = {
productId?: true
inventoryId?: true
physicalQuantity?: true
reservedQuantity?: true
availableQuantity?: true
}
export type StockAvailableViewCountAggregateInputType = {
productId?: true
inventoryId?: true
physicalQuantity?: true
reservedQuantity?: true
availableQuantity?: true
_all?: true
}
export type StockAvailableViewAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Filter which StockAvailableView to aggregate.
*/
where?: Prisma.StockAvailableViewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of StockAvailableViews to fetch.
*/
orderBy?: Prisma.StockAvailableViewOrderByWithRelationInput | Prisma.StockAvailableViewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` StockAvailableViews from the position of the cursor.
*/
take?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Skip the first `n` StockAvailableViews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Count returned StockAvailableViews
**/
_count?: true | StockAvailableViewCountAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to average
**/
_avg?: StockAvailableViewAvgAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to sum
**/
_sum?: StockAvailableViewSumAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the minimum value
**/
_min?: StockAvailableViewMinAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the maximum value
**/
_max?: StockAvailableViewMaxAggregateInputType
}
export type GetStockAvailableViewAggregateType<T extends StockAvailableViewAggregateArgs> = {
[P in keyof T & keyof AggregateStockAvailableView]: P extends '_count' | 'count'
? T[P] extends true
? number
: Prisma.GetScalarType<T[P], AggregateStockAvailableView[P]>
: Prisma.GetScalarType<T[P], AggregateStockAvailableView[P]>
}
export type StockAvailableViewGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.StockAvailableViewWhereInput
orderBy?: Prisma.StockAvailableViewOrderByWithAggregationInput | Prisma.StockAvailableViewOrderByWithAggregationInput[]
by: Prisma.StockAvailableViewScalarFieldEnum[] | Prisma.StockAvailableViewScalarFieldEnum
having?: Prisma.StockAvailableViewScalarWhereWithAggregatesInput
take?: number
skip?: number
_count?: StockAvailableViewCountAggregateInputType | true
_avg?: StockAvailableViewAvgAggregateInputType
_sum?: StockAvailableViewSumAggregateInputType
_min?: StockAvailableViewMinAggregateInputType
_max?: StockAvailableViewMaxAggregateInputType
}
export type StockAvailableViewGroupByOutputType = {
productId: number
inventoryId: number
physicalQuantity: runtime.Decimal
reservedQuantity: runtime.Decimal
availableQuantity: runtime.Decimal
_count: StockAvailableViewCountAggregateOutputType | null
_avg: StockAvailableViewAvgAggregateOutputType | null
_sum: StockAvailableViewSumAggregateOutputType | null
_min: StockAvailableViewMinAggregateOutputType | null
_max: StockAvailableViewMaxAggregateOutputType | null
}
type GetStockAvailableViewGroupByPayload<T extends StockAvailableViewGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<StockAvailableViewGroupByOutputType, T['by']> &
{
[P in ((keyof T) & (keyof StockAvailableViewGroupByOutputType))]: P extends '_count'
? T[P] extends boolean
? number
: Prisma.GetScalarType<T[P], StockAvailableViewGroupByOutputType[P]>
: Prisma.GetScalarType<T[P], StockAvailableViewGroupByOutputType[P]>
}
>
>
export type StockAvailableViewWhereInput = {
AND?: Prisma.StockAvailableViewWhereInput | Prisma.StockAvailableViewWhereInput[]
OR?: Prisma.StockAvailableViewWhereInput[]
NOT?: Prisma.StockAvailableViewWhereInput | Prisma.StockAvailableViewWhereInput[]
productId?: Prisma.IntFilter<"StockAvailableView"> | number
inventoryId?: Prisma.IntFilter<"StockAvailableView"> | number
physicalQuantity?: Prisma.DecimalFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
reservedQuantity?: Prisma.DecimalFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
availableQuantity?: Prisma.DecimalFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
}
export type StockAvailableViewOrderByWithRelationInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewOrderByWithAggregationInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
_count?: Prisma.StockAvailableViewCountOrderByAggregateInput
_avg?: Prisma.StockAvailableViewAvgOrderByAggregateInput
_max?: Prisma.StockAvailableViewMaxOrderByAggregateInput
_min?: Prisma.StockAvailableViewMinOrderByAggregateInput
_sum?: Prisma.StockAvailableViewSumOrderByAggregateInput
}
export type StockAvailableViewScalarWhereWithAggregatesInput = {
AND?: Prisma.StockAvailableViewScalarWhereWithAggregatesInput | Prisma.StockAvailableViewScalarWhereWithAggregatesInput[]
OR?: Prisma.StockAvailableViewScalarWhereWithAggregatesInput[]
NOT?: Prisma.StockAvailableViewScalarWhereWithAggregatesInput | Prisma.StockAvailableViewScalarWhereWithAggregatesInput[]
productId?: Prisma.IntWithAggregatesFilter<"StockAvailableView"> | number
inventoryId?: Prisma.IntWithAggregatesFilter<"StockAvailableView"> | number
physicalQuantity?: Prisma.DecimalWithAggregatesFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
reservedQuantity?: Prisma.DecimalWithAggregatesFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
availableQuantity?: Prisma.DecimalWithAggregatesFilter<"StockAvailableView"> | runtime.Decimal | runtime.DecimalJsLike | number | string
}
export type StockAvailableViewCountOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewAvgOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewMaxOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewMinOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewSumOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
physicalQuantity?: Prisma.SortOrder
reservedQuantity?: Prisma.SortOrder
availableQuantity?: Prisma.SortOrder
}
export type StockAvailableViewSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
productId?: boolean
inventoryId?: boolean
physicalQuantity?: boolean
reservedQuantity?: boolean
availableQuantity?: boolean
}, ExtArgs["result"]["stockAvailableView"]>
export type StockAvailableViewSelectScalar = {
productId?: boolean
inventoryId?: boolean
physicalQuantity?: boolean
reservedQuantity?: boolean
availableQuantity?: boolean
}
export type StockAvailableViewOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"productId" | "inventoryId" | "physicalQuantity" | "reservedQuantity" | "availableQuantity", ExtArgs["result"]["stockAvailableView"]>
export type $StockAvailableViewPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "StockAvailableView"
objects: {}
scalars: runtime.Types.Extensions.GetPayloadResult<{
productId: number
inventoryId: number
physicalQuantity: runtime.Decimal
reservedQuantity: runtime.Decimal
availableQuantity: runtime.Decimal
}, ExtArgs["result"]["stockAvailableView"]>
composites: {}
}
export type StockAvailableViewGetPayload<S extends boolean | null | undefined | StockAvailableViewDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$StockAvailableViewPayload, S>
export type StockAvailableViewCountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> =
Omit<StockAvailableViewFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {
select?: StockAvailableViewCountAggregateInputType | true
}
export interface StockAvailableViewDelegate<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> {
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['StockAvailableView'], meta: { name: 'StockAvailableView' } }
/**
* Find the first StockAvailableView that matches the filter.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewFindFirstArgs} args - Arguments to find a StockAvailableView
* @example
* // Get one StockAvailableView
* const stockAvailableView = await prisma.stockAvailableView.findFirst({
* where: {
* // ... provide filter here
* }
* })
*/
findFirst<T extends StockAvailableViewFindFirstArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, StockAvailableViewFindFirstArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__StockAvailableViewClient<runtime.Types.Result.GetResult<Prisma.$StockAvailableViewPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Find the first StockAvailableView that matches the filter or
* throw `PrismaKnownClientError` with `P2025` code if no matches were found.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewFindFirstOrThrowArgs} args - Arguments to find a StockAvailableView
* @example
* // Get one StockAvailableView
* const stockAvailableView = await prisma.stockAvailableView.findFirstOrThrow({
* where: {
* // ... provide filter here
* }
* })
*/
findFirstOrThrow<T extends StockAvailableViewFindFirstOrThrowArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, StockAvailableViewFindFirstOrThrowArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__StockAvailableViewClient<runtime.Types.Result.GetResult<Prisma.$StockAvailableViewPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>
/**
* Find zero or more StockAvailableViews that matches the filter.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewFindManyArgs} args - Arguments to filter and select certain fields only.
* @example
* // Get all StockAvailableViews
* const stockAvailableViews = await prisma.stockAvailableView.findMany()
*
* // Get first 10 StockAvailableViews
* const stockAvailableViews = await prisma.stockAvailableView.findMany({ take: 10 })
*
* // Only select the `productId`
* const stockAvailableViewWithProductIdOnly = await prisma.stockAvailableView.findMany({ select: { productId: true } })
*
*/
findMany<T extends StockAvailableViewFindManyArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, StockAvailableViewFindManyArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$StockAvailableViewPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
/**
* Count the number of StockAvailableViews.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewCountArgs} args - Arguments to filter StockAvailableViews to count.
* @example
* // Count the number of StockAvailableViews
* const count = await prisma.stockAvailableView.count({
* where: {
* // ... the filter for the StockAvailableViews we want to count
* }
* })
**/
count<T extends StockAvailableViewCountArgs>(
args?: Prisma.Subset<T, StockAvailableViewCountArgs>,
): Prisma.PrismaPromise<
T extends runtime.Types.Utils.Record<'select', any>
? T['select'] extends true
? number
: Prisma.GetScalarType<T['select'], StockAvailableViewCountAggregateOutputType>
: number
>
/**
* Allows you to perform aggregations operations on a StockAvailableView.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewAggregateArgs} args - Select which aggregations you would like to apply and on what fields.
* @example
* // Ordered by age ascending
* // Where email contains prisma.io
* // Limited to the 10 users
* const aggregations = await prisma.user.aggregate({
* _avg: {
* age: true,
* },
* where: {
* email: {
* contains: "prisma.io",
* },
* },
* orderBy: {
* age: "asc",
* },
* take: 10,
* })
**/
aggregate<T extends StockAvailableViewAggregateArgs>(args: Prisma.Subset<T, StockAvailableViewAggregateArgs>): Prisma.PrismaPromise<GetStockAvailableViewAggregateType<T>>
/**
* Group by StockAvailableView.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {StockAvailableViewGroupByArgs} args - Group by arguments.
* @example
* // Group by city, order by createdAt, get count
* const result = await prisma.user.groupBy({
* by: ['city', 'createdAt'],
* orderBy: {
* createdAt: true
* },
* _count: {
* _all: true
* },
* })
*
**/
groupBy<
T extends StockAvailableViewGroupByArgs,
HasSelectOrTake extends Prisma.Or<
Prisma.Extends<'skip', Prisma.Keys<T>>,
Prisma.Extends<'take', Prisma.Keys<T>>
>,
OrderByArg extends Prisma.True extends HasSelectOrTake
? { orderBy: StockAvailableViewGroupByArgs['orderBy'] }
: { orderBy?: StockAvailableViewGroupByArgs['orderBy'] },
OrderFields extends Prisma.ExcludeUnderscoreKeys<Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>>,
ByFields extends Prisma.MaybeTupleToUnion<T['by']>,
ByValid extends Prisma.Has<ByFields, OrderFields>,
HavingFields extends Prisma.GetHavingFields<T['having']>,
HavingValid extends Prisma.Has<ByFields, HavingFields>,
ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,
InputErrors extends ByEmpty extends Prisma.True
? `Error: "by" must not be empty.`
: HavingValid extends Prisma.False
? {
[P in HavingFields]: P extends ByFields
? never
: P extends string
? `Error: Field "${P}" used in "having" needs to be provided in "by".`
: [
Error,
'Field ',
P,
` in "having" needs to be provided in "by"`,
]
}[HavingFields]
: 'take' extends Prisma.Keys<T>
? 'orderBy' extends Prisma.Keys<T>
? ByValid extends Prisma.True
? {}
: {
[P in OrderFields]: P extends ByFields
? never
: `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
}[OrderFields]
: 'Error: If you provide "take", you also need to provide "orderBy"'
: 'skip' extends Prisma.Keys<T>
? 'orderBy' extends Prisma.Keys<T>
? ByValid extends Prisma.True
? {}
: {
[P in OrderFields]: P extends ByFields
? never
: `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
}[OrderFields]
: 'Error: If you provide "skip", you also need to provide "orderBy"'
: ByValid extends Prisma.True
? {}
: {
[P in OrderFields]: P extends ByFields
? never
: `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
}[OrderFields]
>(args: Prisma.SubsetIntersection<T, StockAvailableViewGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetStockAvailableViewGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
* Fields of the StockAvailableView model
*/
readonly fields: StockAvailableViewFieldRefs;
}
/**
* The delegate class that acts as a "Promise-like" for StockAvailableView.
* Why is this prefixed with `Prisma__`?
* Because we want to prevent naming conflicts as mentioned in
* https://github.com/prisma/prisma-client-js/issues/707
*/
export interface Prisma__StockAvailableViewClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
readonly [Symbol.toStringTag]: "PrismaPromise"
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): runtime.Types.Utils.JsPromise<TResult1 | TResult2>
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): runtime.Types.Utils.JsPromise<T | TResult>
/**
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
* resolved value cannot be modified from the callback.
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise<T>
}
/**
* Fields of the StockAvailableView model
*/
export interface StockAvailableViewFieldRefs {
readonly productId: Prisma.FieldRef<"StockAvailableView", 'Int'>
readonly inventoryId: Prisma.FieldRef<"StockAvailableView", 'Int'>
readonly physicalQuantity: Prisma.FieldRef<"StockAvailableView", 'Decimal'>
readonly reservedQuantity: Prisma.FieldRef<"StockAvailableView", 'Decimal'>
readonly availableQuantity: Prisma.FieldRef<"StockAvailableView", 'Decimal'>
}
// Custom InputTypes
/**
* StockAvailableView findFirst
*/
export type StockAvailableViewFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the StockAvailableView
*/
select?: Prisma.StockAvailableViewSelect<ExtArgs> | null
/**
* Omit specific fields from the StockAvailableView
*/
omit?: Prisma.StockAvailableViewOmit<ExtArgs> | null
/**
* Filter, which StockAvailableView to fetch.
*/
where?: Prisma.StockAvailableViewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of StockAvailableViews to fetch.
*/
orderBy?: Prisma.StockAvailableViewOrderByWithRelationInput | Prisma.StockAvailableViewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` StockAvailableViews from the position of the cursor.
*/
take?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Skip the first `n` StockAvailableViews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of StockAvailableViews.
*/
distinct?: Prisma.StockAvailableViewScalarFieldEnum | Prisma.StockAvailableViewScalarFieldEnum[]
}
/**
* StockAvailableView findFirstOrThrow
*/
export type StockAvailableViewFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the StockAvailableView
*/
select?: Prisma.StockAvailableViewSelect<ExtArgs> | null
/**
* Omit specific fields from the StockAvailableView
*/
omit?: Prisma.StockAvailableViewOmit<ExtArgs> | null
/**
* Filter, which StockAvailableView to fetch.
*/
where?: Prisma.StockAvailableViewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of StockAvailableViews to fetch.
*/
orderBy?: Prisma.StockAvailableViewOrderByWithRelationInput | Prisma.StockAvailableViewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` StockAvailableViews from the position of the cursor.
*/
take?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Skip the first `n` StockAvailableViews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of StockAvailableViews.
*/
distinct?: Prisma.StockAvailableViewScalarFieldEnum | Prisma.StockAvailableViewScalarFieldEnum[]
}
/**
* StockAvailableView findMany
*/
export type StockAvailableViewFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the StockAvailableView
*/
select?: Prisma.StockAvailableViewSelect<ExtArgs> | null
/**
* Omit specific fields from the StockAvailableView
*/
omit?: Prisma.StockAvailableViewOmit<ExtArgs> | null
/**
* Filter, which StockAvailableViews to fetch.
*/
where?: Prisma.StockAvailableViewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of StockAvailableViews to fetch.
*/
orderBy?: Prisma.StockAvailableViewOrderByWithRelationInput | Prisma.StockAvailableViewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` StockAvailableViews from the position of the cursor.
*/
take?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Skip the first `n` StockAvailableViews.
*/
skip?: number
distinct?: Prisma.StockAvailableViewScalarFieldEnum | Prisma.StockAvailableViewScalarFieldEnum[]
}
/**
* StockAvailableView without action
*/
export type StockAvailableViewDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the StockAvailableView
*/
select?: Prisma.StockAvailableViewSelect<ExtArgs> | null
/**
* Omit specific fields from the StockAvailableView
*/
omit?: Prisma.StockAvailableViewOmit<ExtArgs> | null
}
+128 -47
View File
@@ -45,7 +45,6 @@ export type StockReservationSumAggregateOutputType = {
export type StockReservationMinAggregateOutputType = { export type StockReservationMinAggregateOutputType = {
id: number | null id: number | null
quantity: runtime.Decimal | null quantity: runtime.Decimal | null
expiresAt: Date | null
createdAt: Date | null createdAt: Date | null
productId: number | null productId: number | null
inventoryId: number | null inventoryId: number | null
@@ -55,7 +54,6 @@ export type StockReservationMinAggregateOutputType = {
export type StockReservationMaxAggregateOutputType = { export type StockReservationMaxAggregateOutputType = {
id: number | null id: number | null
quantity: runtime.Decimal | null quantity: runtime.Decimal | null
expiresAt: Date | null
createdAt: Date | null createdAt: Date | null
productId: number | null productId: number | null
inventoryId: number | null inventoryId: number | null
@@ -65,7 +63,6 @@ export type StockReservationMaxAggregateOutputType = {
export type StockReservationCountAggregateOutputType = { export type StockReservationCountAggregateOutputType = {
id: number id: number
quantity: number quantity: number
expiresAt: number
createdAt: number createdAt: number
productId: number productId: number
inventoryId: number inventoryId: number
@@ -93,7 +90,6 @@ export type StockReservationSumAggregateInputType = {
export type StockReservationMinAggregateInputType = { export type StockReservationMinAggregateInputType = {
id?: true id?: true
quantity?: true quantity?: true
expiresAt?: true
createdAt?: true createdAt?: true
productId?: true productId?: true
inventoryId?: true inventoryId?: true
@@ -103,7 +99,6 @@ export type StockReservationMinAggregateInputType = {
export type StockReservationMaxAggregateInputType = { export type StockReservationMaxAggregateInputType = {
id?: true id?: true
quantity?: true quantity?: true
expiresAt?: true
createdAt?: true createdAt?: true
productId?: true productId?: true
inventoryId?: true inventoryId?: true
@@ -113,7 +108,6 @@ export type StockReservationMaxAggregateInputType = {
export type StockReservationCountAggregateInputType = { export type StockReservationCountAggregateInputType = {
id?: true id?: true
quantity?: true quantity?: true
expiresAt?: true
createdAt?: true createdAt?: true
productId?: true productId?: true
inventoryId?: true inventoryId?: true
@@ -210,7 +204,6 @@ export type StockReservationGroupByArgs<ExtArgs extends runtime.Types.Extensions
export type StockReservationGroupByOutputType = { export type StockReservationGroupByOutputType = {
id: number id: number
quantity: runtime.Decimal quantity: runtime.Decimal
expiresAt: Date
createdAt: Date createdAt: Date
productId: number productId: number
inventoryId: number inventoryId: number
@@ -243,25 +236,25 @@ export type StockReservationWhereInput = {
NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[]
id?: Prisma.IntFilter<"StockReservation"> | number id?: Prisma.IntFilter<"StockReservation"> | number
quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
productId?: Prisma.IntFilter<"StockReservation"> | number productId?: Prisma.IntFilter<"StockReservation"> | number
inventoryId?: Prisma.IntFilter<"StockReservation"> | number inventoryId?: Prisma.IntFilter<"StockReservation"> | number
orderId?: Prisma.IntFilter<"StockReservation"> | number orderId?: Prisma.IntFilter<"StockReservation"> | number
inventory?: Prisma.XOR<Prisma.InventoryScalarRelationFilter, Prisma.InventoryWhereInput> inventory?: Prisma.XOR<Prisma.InventoryScalarRelationFilter, Prisma.InventoryWhereInput>
product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput> product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput>
order?: Prisma.XOR<Prisma.OrderScalarRelationFilter, Prisma.OrderWhereInput>
} }
export type StockReservationOrderByWithRelationInput = { export type StockReservationOrderByWithRelationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
quantity?: Prisma.SortOrder quantity?: Prisma.SortOrder
expiresAt?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder
orderId?: Prisma.SortOrder orderId?: Prisma.SortOrder
inventory?: Prisma.InventoryOrderByWithRelationInput inventory?: Prisma.InventoryOrderByWithRelationInput
product?: Prisma.ProductOrderByWithRelationInput product?: Prisma.ProductOrderByWithRelationInput
order?: Prisma.OrderOrderByWithRelationInput
} }
export type StockReservationWhereUniqueInput = Prisma.AtLeast<{ export type StockReservationWhereUniqueInput = Prisma.AtLeast<{
@@ -270,19 +263,18 @@ export type StockReservationWhereUniqueInput = Prisma.AtLeast<{
OR?: Prisma.StockReservationWhereInput[] OR?: Prisma.StockReservationWhereInput[]
NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[] NOT?: Prisma.StockReservationWhereInput | Prisma.StockReservationWhereInput[]
quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
productId?: Prisma.IntFilter<"StockReservation"> | number productId?: Prisma.IntFilter<"StockReservation"> | number
inventoryId?: Prisma.IntFilter<"StockReservation"> | number inventoryId?: Prisma.IntFilter<"StockReservation"> | number
orderId?: Prisma.IntFilter<"StockReservation"> | number orderId?: Prisma.IntFilter<"StockReservation"> | number
inventory?: Prisma.XOR<Prisma.InventoryScalarRelationFilter, Prisma.InventoryWhereInput> inventory?: Prisma.XOR<Prisma.InventoryScalarRelationFilter, Prisma.InventoryWhereInput>
product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput> product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput>
order?: Prisma.XOR<Prisma.OrderScalarRelationFilter, Prisma.OrderWhereInput>
}, "id"> }, "id">
export type StockReservationOrderByWithAggregationInput = { export type StockReservationOrderByWithAggregationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
quantity?: Prisma.SortOrder quantity?: Prisma.SortOrder
expiresAt?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder
@@ -300,7 +292,6 @@ export type StockReservationScalarWhereWithAggregatesInput = {
NOT?: Prisma.StockReservationScalarWhereWithAggregatesInput | Prisma.StockReservationScalarWhereWithAggregatesInput[] NOT?: Prisma.StockReservationScalarWhereWithAggregatesInput | Prisma.StockReservationScalarWhereWithAggregatesInput[]
id?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number id?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number
quantity?: Prisma.DecimalWithAggregatesFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalWithAggregatesFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeWithAggregatesFilter<"StockReservation"> | Date | string
createdAt?: Prisma.DateTimeWithAggregatesFilter<"StockReservation"> | Date | string createdAt?: Prisma.DateTimeWithAggregatesFilter<"StockReservation"> | Date | string
productId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number productId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number
inventoryId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number inventoryId?: Prisma.IntWithAggregatesFilter<"StockReservation"> | number
@@ -309,17 +300,15 @@ export type StockReservationScalarWhereWithAggregatesInput = {
export type StockReservationCreateInput = { export type StockReservationCreateInput = {
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
orderId: number
inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput
product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput
order: Prisma.OrderCreateNestedOneWithoutStockReservationsInput
} }
export type StockReservationUncheckedCreateInput = { export type StockReservationUncheckedCreateInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
productId: number productId: number
inventoryId: number inventoryId: number
@@ -328,17 +317,15 @@ export type StockReservationUncheckedCreateInput = {
export type StockReservationUpdateInput = { export type StockReservationUpdateInput = {
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
orderId?: Prisma.IntFieldUpdateOperationsInput | number
inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput
product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput
order?: Prisma.OrderUpdateOneRequiredWithoutStockReservationsNestedInput
} }
export type StockReservationUncheckedUpdateInput = { export type StockReservationUncheckedUpdateInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
@@ -348,7 +335,6 @@ export type StockReservationUncheckedUpdateInput = {
export type StockReservationCreateManyInput = { export type StockReservationCreateManyInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
productId: number productId: number
inventoryId: number inventoryId: number
@@ -357,15 +343,12 @@ export type StockReservationCreateManyInput = {
export type StockReservationUpdateManyMutationInput = { export type StockReservationUpdateManyMutationInput = {
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
orderId?: Prisma.IntFieldUpdateOperationsInput | number
} }
export type StockReservationUncheckedUpdateManyInput = { export type StockReservationUncheckedUpdateManyInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
@@ -385,7 +368,6 @@ export type StockReservationOrderByRelationAggregateInput = {
export type StockReservationCountOrderByAggregateInput = { export type StockReservationCountOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
quantity?: Prisma.SortOrder quantity?: Prisma.SortOrder
expiresAt?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder
@@ -403,7 +385,6 @@ export type StockReservationAvgOrderByAggregateInput = {
export type StockReservationMaxOrderByAggregateInput = { export type StockReservationMaxOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
quantity?: Prisma.SortOrder quantity?: Prisma.SortOrder
expiresAt?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder
@@ -413,7 +394,6 @@ export type StockReservationMaxOrderByAggregateInput = {
export type StockReservationMinOrderByAggregateInput = { export type StockReservationMinOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
quantity?: Prisma.SortOrder quantity?: Prisma.SortOrder
expiresAt?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder inventoryId?: Prisma.SortOrder
@@ -470,6 +450,48 @@ export type StockReservationUncheckedUpdateManyWithoutInventoryNestedInput = {
deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[]
} }
export type StockReservationCreateNestedManyWithoutOrderInput = {
create?: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput> | Prisma.StockReservationCreateWithoutOrderInput[] | Prisma.StockReservationUncheckedCreateWithoutOrderInput[]
connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutOrderInput | Prisma.StockReservationCreateOrConnectWithoutOrderInput[]
createMany?: Prisma.StockReservationCreateManyOrderInputEnvelope
connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
}
export type StockReservationUncheckedCreateNestedManyWithoutOrderInput = {
create?: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput> | Prisma.StockReservationCreateWithoutOrderInput[] | Prisma.StockReservationUncheckedCreateWithoutOrderInput[]
connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutOrderInput | Prisma.StockReservationCreateOrConnectWithoutOrderInput[]
createMany?: Prisma.StockReservationCreateManyOrderInputEnvelope
connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
}
export type StockReservationUpdateManyWithoutOrderNestedInput = {
create?: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput> | Prisma.StockReservationCreateWithoutOrderInput[] | Prisma.StockReservationUncheckedCreateWithoutOrderInput[]
connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutOrderInput | Prisma.StockReservationCreateOrConnectWithoutOrderInput[]
upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutOrderInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutOrderInput[]
createMany?: Prisma.StockReservationCreateManyOrderInputEnvelope
set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutOrderInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutOrderInput[]
updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutOrderInput | Prisma.StockReservationUpdateManyWithWhereWithoutOrderInput[]
deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[]
}
export type StockReservationUncheckedUpdateManyWithoutOrderNestedInput = {
create?: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput> | Prisma.StockReservationCreateWithoutOrderInput[] | Prisma.StockReservationUncheckedCreateWithoutOrderInput[]
connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutOrderInput | Prisma.StockReservationCreateOrConnectWithoutOrderInput[]
upsert?: Prisma.StockReservationUpsertWithWhereUniqueWithoutOrderInput | Prisma.StockReservationUpsertWithWhereUniqueWithoutOrderInput[]
createMany?: Prisma.StockReservationCreateManyOrderInputEnvelope
set?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
disconnect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
delete?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
connect?: Prisma.StockReservationWhereUniqueInput | Prisma.StockReservationWhereUniqueInput[]
update?: Prisma.StockReservationUpdateWithWhereUniqueWithoutOrderInput | Prisma.StockReservationUpdateWithWhereUniqueWithoutOrderInput[]
updateMany?: Prisma.StockReservationUpdateManyWithWhereWithoutOrderInput | Prisma.StockReservationUpdateManyWithWhereWithoutOrderInput[]
deleteMany?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[]
}
export type StockReservationCreateNestedManyWithoutProductInput = { export type StockReservationCreateNestedManyWithoutProductInput = {
create?: Prisma.XOR<Prisma.StockReservationCreateWithoutProductInput, Prisma.StockReservationUncheckedCreateWithoutProductInput> | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[] create?: Prisma.XOR<Prisma.StockReservationCreateWithoutProductInput, Prisma.StockReservationUncheckedCreateWithoutProductInput> | Prisma.StockReservationCreateWithoutProductInput[] | Prisma.StockReservationUncheckedCreateWithoutProductInput[]
connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[] connectOrCreate?: Prisma.StockReservationCreateOrConnectWithoutProductInput | Prisma.StockReservationCreateOrConnectWithoutProductInput[]
@@ -514,16 +536,14 @@ export type StockReservationUncheckedUpdateManyWithoutProductNestedInput = {
export type StockReservationCreateWithoutInventoryInput = { export type StockReservationCreateWithoutInventoryInput = {
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
orderId: number
product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput
order: Prisma.OrderCreateNestedOneWithoutStockReservationsInput
} }
export type StockReservationUncheckedCreateWithoutInventoryInput = { export type StockReservationUncheckedCreateWithoutInventoryInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
productId: number productId: number
orderId: number orderId: number
@@ -561,25 +581,63 @@ export type StockReservationScalarWhereInput = {
NOT?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[] NOT?: Prisma.StockReservationScalarWhereInput | Prisma.StockReservationScalarWhereInput[]
id?: Prisma.IntFilter<"StockReservation"> | number id?: Prisma.IntFilter<"StockReservation"> | number
quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFilter<"StockReservation"> | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string createdAt?: Prisma.DateTimeFilter<"StockReservation"> | Date | string
productId?: Prisma.IntFilter<"StockReservation"> | number productId?: Prisma.IntFilter<"StockReservation"> | number
inventoryId?: Prisma.IntFilter<"StockReservation"> | number inventoryId?: Prisma.IntFilter<"StockReservation"> | number
orderId?: Prisma.IntFilter<"StockReservation"> | number orderId?: Prisma.IntFilter<"StockReservation"> | number
} }
export type StockReservationCreateWithoutOrderInput = {
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Date | string
inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput
product: Prisma.ProductCreateNestedOneWithoutStockReservationsInput
}
export type StockReservationUncheckedCreateWithoutOrderInput = {
id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Date | string
productId: number
inventoryId: number
}
export type StockReservationCreateOrConnectWithoutOrderInput = {
where: Prisma.StockReservationWhereUniqueInput
create: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput>
}
export type StockReservationCreateManyOrderInputEnvelope = {
data: Prisma.StockReservationCreateManyOrderInput | Prisma.StockReservationCreateManyOrderInput[]
skipDuplicates?: boolean
}
export type StockReservationUpsertWithWhereUniqueWithoutOrderInput = {
where: Prisma.StockReservationWhereUniqueInput
update: Prisma.XOR<Prisma.StockReservationUpdateWithoutOrderInput, Prisma.StockReservationUncheckedUpdateWithoutOrderInput>
create: Prisma.XOR<Prisma.StockReservationCreateWithoutOrderInput, Prisma.StockReservationUncheckedCreateWithoutOrderInput>
}
export type StockReservationUpdateWithWhereUniqueWithoutOrderInput = {
where: Prisma.StockReservationWhereUniqueInput
data: Prisma.XOR<Prisma.StockReservationUpdateWithoutOrderInput, Prisma.StockReservationUncheckedUpdateWithoutOrderInput>
}
export type StockReservationUpdateManyWithWhereWithoutOrderInput = {
where: Prisma.StockReservationScalarWhereInput
data: Prisma.XOR<Prisma.StockReservationUpdateManyMutationInput, Prisma.StockReservationUncheckedUpdateManyWithoutOrderInput>
}
export type StockReservationCreateWithoutProductInput = { export type StockReservationCreateWithoutProductInput = {
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
orderId: number
inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput inventory: Prisma.InventoryCreateNestedOneWithoutStockReservationsInput
order: Prisma.OrderCreateNestedOneWithoutStockReservationsInput
} }
export type StockReservationUncheckedCreateWithoutProductInput = { export type StockReservationUncheckedCreateWithoutProductInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
inventoryId: number inventoryId: number
orderId: number orderId: number
@@ -614,7 +672,6 @@ export type StockReservationUpdateManyWithWhereWithoutProductInput = {
export type StockReservationCreateManyInventoryInput = { export type StockReservationCreateManyInventoryInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
productId: number productId: number
orderId: number orderId: number
@@ -622,16 +679,14 @@ export type StockReservationCreateManyInventoryInput = {
export type StockReservationUpdateWithoutInventoryInput = { export type StockReservationUpdateWithoutInventoryInput = {
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
orderId?: Prisma.IntFieldUpdateOperationsInput | number
product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput
order?: Prisma.OrderUpdateOneRequiredWithoutStockReservationsNestedInput
} }
export type StockReservationUncheckedUpdateWithoutInventoryInput = { export type StockReservationUncheckedUpdateWithoutInventoryInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
orderId?: Prisma.IntFieldUpdateOperationsInput | number orderId?: Prisma.IntFieldUpdateOperationsInput | number
@@ -640,16 +695,45 @@ export type StockReservationUncheckedUpdateWithoutInventoryInput = {
export type StockReservationUncheckedUpdateManyWithoutInventoryInput = { export type StockReservationUncheckedUpdateManyWithoutInventoryInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
orderId?: Prisma.IntFieldUpdateOperationsInput | number orderId?: Prisma.IntFieldUpdateOperationsInput | number
} }
export type StockReservationCreateManyOrderInput = {
id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Date | string
productId: number
inventoryId: number
}
export type StockReservationUpdateWithoutOrderInput = {
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput
product?: Prisma.ProductUpdateOneRequiredWithoutStockReservationsNestedInput
}
export type StockReservationUncheckedUpdateWithoutOrderInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
}
export type StockReservationUncheckedUpdateManyWithoutOrderInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
productId?: Prisma.IntFieldUpdateOperationsInput | number
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
}
export type StockReservationCreateManyProductInput = { export type StockReservationCreateManyProductInput = {
id?: number id?: number
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt: Date | string
createdAt?: Date | string createdAt?: Date | string
inventoryId: number inventoryId: number
orderId: number orderId: number
@@ -657,16 +741,14 @@ export type StockReservationCreateManyProductInput = {
export type StockReservationUpdateWithoutProductInput = { export type StockReservationUpdateWithoutProductInput = {
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
orderId?: Prisma.IntFieldUpdateOperationsInput | number
inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput inventory?: Prisma.InventoryUpdateOneRequiredWithoutStockReservationsNestedInput
order?: Prisma.OrderUpdateOneRequiredWithoutStockReservationsNestedInput
} }
export type StockReservationUncheckedUpdateWithoutProductInput = { export type StockReservationUncheckedUpdateWithoutProductInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
orderId?: Prisma.IntFieldUpdateOperationsInput | number orderId?: Prisma.IntFieldUpdateOperationsInput | number
@@ -675,7 +757,6 @@ export type StockReservationUncheckedUpdateWithoutProductInput = {
export type StockReservationUncheckedUpdateManyWithoutProductInput = { export type StockReservationUncheckedUpdateManyWithoutProductInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number id?: Prisma.IntFieldUpdateOperationsInput | number
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
orderId?: Prisma.IntFieldUpdateOperationsInput | number orderId?: Prisma.IntFieldUpdateOperationsInput | number
@@ -686,13 +767,13 @@ export type StockReservationUncheckedUpdateManyWithoutProductInput = {
export type StockReservationSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type StockReservationSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
quantity?: boolean quantity?: boolean
expiresAt?: boolean
createdAt?: boolean createdAt?: boolean
productId?: boolean productId?: boolean
inventoryId?: boolean inventoryId?: boolean
orderId?: boolean orderId?: boolean
inventory?: boolean | Prisma.InventoryDefaultArgs<ExtArgs> inventory?: boolean | Prisma.InventoryDefaultArgs<ExtArgs>
product?: boolean | Prisma.ProductDefaultArgs<ExtArgs> product?: boolean | Prisma.ProductDefaultArgs<ExtArgs>
order?: boolean | Prisma.OrderDefaultArgs<ExtArgs>
}, ExtArgs["result"]["stockReservation"]> }, ExtArgs["result"]["stockReservation"]>
@@ -700,17 +781,17 @@ export type StockReservationSelect<ExtArgs extends runtime.Types.Extensions.Inte
export type StockReservationSelectScalar = { export type StockReservationSelectScalar = {
id?: boolean id?: boolean
quantity?: boolean quantity?: boolean
expiresAt?: boolean
createdAt?: boolean createdAt?: boolean
productId?: boolean productId?: boolean
inventoryId?: boolean inventoryId?: boolean
orderId?: boolean orderId?: boolean
} }
export type StockReservationOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "expiresAt" | "createdAt" | "productId" | "inventoryId" | "orderId", ExtArgs["result"]["stockReservation"]> export type StockReservationOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "createdAt" | "productId" | "inventoryId" | "orderId", ExtArgs["result"]["stockReservation"]>
export type StockReservationInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type StockReservationInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
inventory?: boolean | Prisma.InventoryDefaultArgs<ExtArgs> inventory?: boolean | Prisma.InventoryDefaultArgs<ExtArgs>
product?: boolean | Prisma.ProductDefaultArgs<ExtArgs> product?: boolean | Prisma.ProductDefaultArgs<ExtArgs>
order?: boolean | Prisma.OrderDefaultArgs<ExtArgs>
} }
export type $StockReservationPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type $StockReservationPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -718,11 +799,11 @@ export type $StockReservationPayload<ExtArgs extends runtime.Types.Extensions.In
objects: { objects: {
inventory: Prisma.$InventoryPayload<ExtArgs> inventory: Prisma.$InventoryPayload<ExtArgs>
product: Prisma.$ProductPayload<ExtArgs> product: Prisma.$ProductPayload<ExtArgs>
order: Prisma.$OrderPayload<ExtArgs>
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: number id: number
quantity: runtime.Decimal quantity: runtime.Decimal
expiresAt: Date
createdAt: Date createdAt: Date
productId: number productId: number
inventoryId: number inventoryId: number
@@ -1069,6 +1150,7 @@ export interface Prisma__StockReservationClient<T, Null = never, ExtArgs extends
readonly [Symbol.toStringTag]: "PrismaPromise" readonly [Symbol.toStringTag]: "PrismaPromise"
inventory<T extends Prisma.InventoryDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.InventoryDefaultArgs<ExtArgs>>): Prisma.Prisma__InventoryClient<runtime.Types.Result.GetResult<Prisma.$InventoryPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> inventory<T extends Prisma.InventoryDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.InventoryDefaultArgs<ExtArgs>>): Prisma.Prisma__InventoryClient<runtime.Types.Result.GetResult<Prisma.$InventoryPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
product<T extends Prisma.ProductDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductDefaultArgs<ExtArgs>>): Prisma.Prisma__ProductClient<runtime.Types.Result.GetResult<Prisma.$ProductPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> product<T extends Prisma.ProductDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductDefaultArgs<ExtArgs>>): Prisma.Prisma__ProductClient<runtime.Types.Result.GetResult<Prisma.$ProductPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
order<T extends Prisma.OrderDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.OrderDefaultArgs<ExtArgs>>): Prisma.Prisma__OrderClient<runtime.Types.Result.GetResult<Prisma.$OrderPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
/** /**
* Attaches callbacks for the resolution and/or rejection of the Promise. * Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved. * @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1100,7 +1182,6 @@ export interface Prisma__StockReservationClient<T, Null = never, ExtArgs extends
export interface StockReservationFieldRefs { export interface StockReservationFieldRefs {
readonly id: Prisma.FieldRef<"StockReservation", 'Int'> readonly id: Prisma.FieldRef<"StockReservation", 'Int'>
readonly quantity: Prisma.FieldRef<"StockReservation", 'Decimal'> readonly quantity: Prisma.FieldRef<"StockReservation", 'Decimal'>
readonly expiresAt: Prisma.FieldRef<"StockReservation", 'DateTime'>
readonly createdAt: Prisma.FieldRef<"StockReservation", 'DateTime'> readonly createdAt: Prisma.FieldRef<"StockReservation", 'DateTime'>
readonly productId: Prisma.FieldRef<"StockReservation", 'Int'> readonly productId: Prisma.FieldRef<"StockReservation", 'Int'>
readonly inventoryId: Prisma.FieldRef<"StockReservation", 'Int'> readonly inventoryId: Prisma.FieldRef<"StockReservation", 'Int'>
@@ -2,7 +2,7 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { Type } from 'class-transformer' import { Type } from 'class-transformer'
import { ArrayMinSize, IsInt, IsNumber, IsOptional, IsString } from 'class-validator' import { ArrayMinSize, IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
export class CreateSaleInvoiceDto { export class CreateOrderDto {
@ApiPropertyOptional() @ApiPropertyOptional()
@IsOptional() @IsOptional()
@IsInt() @IsInt()
@@ -0,0 +1,44 @@
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { OrderStatus } from '../../../generated/prisma/enums'
import { CreateOrderDto } from './dto/create-order-item.dto'
import { PosOrdersService } from './orders.service'
@Controller('pos/:posId/orders')
export class PosOrdersController {
constructor(private readonly posOrdersService: PosOrdersService) {}
@Get('')
get(@Param('posId') posId: string) {
return this.posOrdersService.getOrders(Number(posId))
}
@Get('/held')
getHeld(@Param('posId') posId: string) {
return this.posOrdersService.getOrders(Number(posId), OrderStatus.PENDING)
}
@Post('')
async createOrder(@Param('posId') posId: string, @Body() dto: CreateOrderDto) {
return this.posOrdersService.createOrder(Number(posId), dto)
}
@Get('/:orderId')
getOrderDetails(@Param('posId') posId: string, @Param('orderId') orderId: string) {
return this.posOrdersService.getOrderDetails(Number(posId), Number(orderId))
}
@Post('/:orderId/reject')
async rejectOrder(@Param('posId') posId: string, @Param('orderId') orderId: string) {
return this.posOrdersService.rejectOrder(Number(posId), Number(orderId))
}
@Post('/:orderId/done')
async completeOrder(@Param('posId') posId: string, @Param('orderId') orderId: string) {
return this.posOrdersService.completeOrder(Number(posId), Number(orderId))
}
@Post('/:orderId/cancel')
async cancelOrder(@Param('posId') posId: string, @Param('orderId') orderId: string) {
return this.posOrdersService.cancelOrder(Number(posId), Number(orderId))
}
}
+13
View File
@@ -0,0 +1,13 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../../../prisma/prisma.module'
import { SalesInvoicesModule } from '../../sales-invoices/sales-invoices.module'
import { PosOrdersController } from './orders.controller'
import { PosOrdersService } from './orders.service'
import { PosOrdersWorkflow } from './orders.workflow'
@Module({
imports: [PrismaModule, SalesInvoicesModule],
controllers: [PosOrdersController],
providers: [PosOrdersService, PosOrdersWorkflow],
})
export class PosOrdersModule {}
+145
View File
@@ -0,0 +1,145 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../../../common/response/response-mapper'
import { Prisma } from '../../../generated/prisma/client'
import { OrderStatus } from '../../../generated/prisma/enums'
import { OrderCreateInput } from '../../../generated/prisma/models'
import { PrismaService } from '../../../prisma/prisma.service'
import { CreateOrderDto } from './dto/create-order-item.dto'
import { PosOrdersWorkflow } from './orders.workflow'
@Injectable()
export class PosOrdersService {
constructor(
private prisma: PrismaService,
private posWorkflow: PosOrdersWorkflow,
) {}
async createOrder(posId: number, data: CreateOrderDto) {
const { customerId, items, ...rest } = data
const lastCode = await this.prisma.order
.findFirst({
where: { posAccountId: posId },
orderBy: { orderNumber: 'desc' },
select: { orderNumber: true },
})
.then(si => si?.orderNumber || '0')
const newCode = String(Number(lastCode) + 1)
const totalAmount = data.items.reduce(
(acc, item) => acc + item.count * item.unitPrice,
0,
)
const preparedOrder: OrderCreateInput = {
...rest,
orderNumber: newCode,
posAccount: { connect: { id: posId } },
customer: customerId ? { connect: { id: customerId } } : undefined,
totalAmount,
orderItems: {
create: items.map(item => ({
product: { connect: { id: Number(item.productId) } },
quantity: item.count,
unitPrice: item.unitPrice,
totalAmount: item.count * item.unitPrice,
})),
},
}
const item = await this.prisma.$transaction(async tx => {
const order = await tx.order.create({ data: preparedOrder })
await this.posWorkflow.onCreateOrder(tx, order.id, posId)
})
return ResponseMapper.create(item)
}
async createAndConfirmOrder(posId: number, data: CreateOrderDto) {}
async rejectOrder(posAccountId: number, orderId: number) {
const item = await this.prisma.$transaction(async tx => {
const order = await tx.order.update({
where: { id: orderId, posAccountId },
data: { status: OrderStatus.REJECTED },
})
await this.posWorkflow.onRejectOrder(tx, orderId)
return order
})
return ResponseMapper.single(item)
}
async completeOrder(posAccountId: number, orderId: number) {
const item = await this.prisma.$transaction(async tx => {
const order = await tx.order.update({
where: { id: orderId, posAccountId },
data: { status: OrderStatus.DONE },
})
await this.posWorkflow.onConfirmOrder(tx, orderId)
return order
})
return ResponseMapper.single(item)
}
async cancelOrder(posAccountId: number, orderId: number) {
const item = await this.prisma.$transaction(async tx => {
const order = await tx.order.update({
where: { id: orderId, posAccountId },
data: { status: OrderStatus.CANCELED },
})
await this.posWorkflow.onCancelOrder(tx, orderId)
return order
})
return ResponseMapper.single(item)
}
async getOrders(posId: number, status?: OrderStatus) {
const where: Prisma.OrderWhereInput = {
posAccountId: posId,
status,
}
if (status) {
where.status = status
}
const items = await this.prisma.order.findMany({
where,
include: {
customer: {
select: {
id: true,
firstName: true,
lastName: true,
},
},
orderItems: {
include: {
product: true,
},
},
},
orderBy: { createdAt: 'desc' },
})
return ResponseMapper.list(items)
}
async getOrderDetails(posAccountId: number, orderId: number) {
const item = await this.prisma.order.findUniqueOrThrow({
where: { id: orderId, posAccountId },
include: {
customer: {
select: {
id: true,
firstName: true,
lastName: true,
},
},
orderItems: {
include: {
product: true,
},
},
},
})
return ResponseMapper.single(item)
}
}
+87
View File
@@ -0,0 +1,87 @@
import { Injectable } from '@nestjs/common'
import { Prisma } from '../../../generated/prisma/client'
import { SalesInvoicesWorkflow } from '../../sales-invoices/sales-invoices.workflow'
@Injectable()
export class PosOrdersWorkflow {
constructor(private salesInvoicesWorkflow: SalesInvoicesWorkflow) {}
async onCreateOrder(tx: Prisma.TransactionClient, orderId: number, posId: number) {
const { inventoryId } = await tx.posAccount.findUniqueOrThrow({
where: { id: posId },
select: { inventoryId: true },
})
const orderItems = await tx.orderItem.findMany({
where: { orderId },
select: {
product: true,
quantity: true,
},
})
await tx.stockReservation.createMany({
data: orderItems.map(item => ({
orderId,
productId: item.product.id,
quantity: item.quantity,
inventoryId,
})),
})
}
async onRejectOrder(tx: Prisma.TransactionClient, orderId: number) {
const orderItemIds = await tx.orderItem
.findMany({
where: { orderId },
select: {
productId: true,
},
})
.then(items => items.map(i => i.productId))
await tx.stockReservation.deleteMany({
where: {
orderId,
productId: { in: orderItemIds },
},
})
}
async onConfirmOrder(tx: Prisma.TransactionClient, orderId: number) {
const orderItems = await tx.orderItem.findMany({
where: { orderId },
select: {
product: true,
quantity: true,
},
})
await tx.stockReservation.deleteMany({
where: {
orderId,
productId: { in: orderItems.map(i => i.product.id) },
},
})
await this.salesInvoicesWorkflow.onCreateByOrder(tx, orderId)
}
async onCancelOrder(tx: Prisma.TransactionClient, orderId: number) {
const orderItemIds = await tx.orderItem
.findMany({
where: { orderId },
select: {
productId: true,
},
})
.then(items => items.map(i => i.productId))
await tx.stockReservation.deleteMany({
where: {
orderId,
productId: { in: orderItemIds },
},
})
}
}
+1 -7
View File
@@ -1,5 +1,4 @@
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common' import { Controller, Get, Param, Query } from '@nestjs/common'
import { CreateSaleInvoiceDto } from './dto/create-pos.dto'
import { PosService } from './pos.service' import { PosService } from './pos.service'
@Controller('pos') @Controller('pos')
@@ -32,9 +31,4 @@ export class PosController {
async getProductCategories(@Param('posId') posId: string) { async getProductCategories(@Param('posId') posId: string) {
return this.posService.getProductCategories(Number(posId)) return this.posService.getProductCategories(Number(posId))
} }
@Post('/:posId/orders/create')
async createOrder(@Param('posId') posId: string, @Body() dto: CreateSaleInvoiceDto) {
return this.posService.createOrder(Number(posId), dto)
}
} }
+2 -1
View File
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common' import { Module } from '@nestjs/common'
import { PrismaModule } from '../../prisma/prisma.module' import { PrismaModule } from '../../prisma/prisma.module'
import { PosOrdersModule } from './orders/orders.module'
import { PosController } from './pos.controller' import { PosController } from './pos.controller'
import { PosService } from './pos.service' import { PosService } from './pos.service'
@Module({ @Module({
imports: [PrismaModule], imports: [PrismaModule, PosOrdersModule],
controllers: [PosController], controllers: [PosController],
providers: [PosService], providers: [PosService],
}) })
+44 -87
View File
@@ -1,9 +1,6 @@
import { Injectable } from '@nestjs/common' import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../../common/response/response-mapper' 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 { PrismaService } from '../../prisma/prisma.service'
import { CreateSaleInvoiceDto } from './dto/create-pos.dto'
@Injectable() @Injectable()
export class PosService { export class PosService {
@@ -53,67 +50,64 @@ export class PosService {
page?: number page?: number
pageSize?: number pageSize?: number
q?: string q?: string
productIds?: number[]
} = {}, } = {},
) { ) {
const { isAvailable, page = 1, pageSize = 50, q } = options const { isAvailable, page = 1, pageSize = 50, q, productIds } = options
const pos = await this.prisma.posAccount.findUniqueOrThrow({ const pos = await this.prisma.posAccount.findUniqueOrThrow({
where: { id: posId }, where: { id: posId },
select: { inventoryId: true }, select: { inventoryId: true },
}) })
const inventoryId = pos.inventoryId const inventoryId = pos.inventoryId
const query: Prisma.StockBalanceFindManyArgs = { let sql = `
where: { SELECT sb.productId, sb.quantity - COALESCE(SUM(sr.quantity), 0) as availableQuantity, p.id, p.name, p.sku, p.description, p.salePrice, p.categoryId
inventoryId, FROM Stock_Balance sb
quantity: LEFT JOIN Stock_Reservations sr ON sb.productId = sr.productId AND sb.inventoryId = sr.inventoryId
isAvailable === true LEFT JOIN Products p ON sb.productId = p.id
? { gt: 0 } WHERE sb.inventoryId = ?
: isAvailable === false `
? { lte: 0 } const params: any[] = [inventoryId]
: undefined,
...(q && { if (productIds && productIds.length > 0) {
product: { sql += ` AND sb.productId IN (${productIds.map(() => '?').join(',')})`
OR: [{ name: { contains: q } }, { sku: { contains: q } }], params.push(...productIds)
},
}),
},
orderBy: {
quantity: 'desc',
},
} }
const [items, count] = await this.prisma.$transaction([ if (q) {
this.prisma.stockBalance.findMany({ sql += ` AND (p.name LIKE ? OR p.sku LIKE ?)`
where: query.where, params.push(`%${q}%`, `%${q}%`)
include: { }
product: {
select: {
id: true,
name: true,
sku: true,
salePrice: true,
category: {
select: { id: true, name: true },
},
},
},
},
orderBy: {
quantity: 'desc',
},
skip: (page - 1) * pageSize,
take: pageSize,
}),
this.prisma.stockBalance.count({ where: query.where }),
])
const mapped = items.map(item => ({ sql += ` GROUP BY sb.productId`
if (isAvailable !== undefined) {
sql += isAvailable
? ` HAVING availableQuantity > 0`
: ` HAVING availableQuantity <= 0`
}
sql += ` ORDER BY sb.quantity DESC`
const items = await this.prisma.$queryRawUnsafe(sql, ...params)
const mapped = (items as any[]).map(item => ({
id: item.productId,
quantity: Number(item.availableQuantity),
product: {
id: item.id, id: item.id,
quantity: Number(item.quantity), name: item.name,
product: item.product, sku: item.sku,
description: item.description,
salePrice: item.salePrice,
categoryId: item.categoryId,
},
})) }))
return ResponseMapper.paginate(mapped, count, page, pageSize) const count = mapped.length
const paginated = mapped.slice((page - 1) * pageSize, page * pageSize)
return ResponseMapper.paginate(paginated, count, page, pageSize)
} }
async getProductCategories(posId: number) { async getProductCategories(posId: number) {
@@ -157,41 +151,4 @@ export class PosService {
const categories = Array.from(map.values()) const categories = Array.from(map.values())
return ResponseMapper.list(categories) return ResponseMapper.list(categories)
} }
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')
const newCode = String(Number(lastCode) + 1)
const totalAmount = data.items.reduce(
(acc, item) => acc + item.count * item.unitPrice,
0,
)
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,
unitPrice: item.unitPrice,
total: item.count * item.unitPrice,
})),
},
}
const item = await this.prisma.salesInvoice.create({ data: preparedOrder })
return ResponseMapper.create(item)
}
} }
@@ -15,7 +15,7 @@ export class UpdatePurchaseReceiptItemDto {
@IsOptional() @IsOptional()
@Type(() => Number) @Type(() => Number)
@IsNumber() @IsNumber()
total?: number totalAmount?: number
@IsOptional() @IsOptional()
@Type(() => Number) @Type(() => Number)
@@ -19,7 +19,7 @@ export class PurchaseReceiptItemsService {
} }
payload.unitPrice = String(payload.unitPrice) payload.unitPrice = String(payload.unitPrice)
payload.count = String(payload.count) payload.count = String(payload.count)
payload.total = String(payload.total) payload.totalAmount = String(payload.totalAmount)
const item = await this.prisma.purchaseReceiptItem.create({ data: payload }) const item = await this.prisma.purchaseReceiptItem.create({ data: payload })
return ResponseMapper.create(item) return ResponseMapper.create(item)
} }
@@ -1,16 +1,14 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common' import { Controller, Delete, Get, Param } from '@nestjs/common'
import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto'
import { UpdateSalesInvoiceDto } from './dto/update-sales-invoice.dto'
import { SalesInvoicesService } from './sales-invoices.service' import { SalesInvoicesService } from './sales-invoices.service'
@Controller('sales-invoices') @Controller('sales-invoices')
export class SalesInvoicesController { export class SalesInvoicesController {
constructor(private readonly service: SalesInvoicesService) {} constructor(private readonly service: SalesInvoicesService) {}
@Post() // @Post()
create(@Body() dto: CreateSalesInvoiceDto) { // create(@Body() dto: CreateSalesInvoiceDto) {
return this.service.create(dto) // return this.service.create(dto)
} // }
@Get() @Get()
findAll() { findAll() {
@@ -22,10 +20,10 @@ export class SalesInvoicesController {
return this.service.findOne(Number(id)) return this.service.findOne(Number(id))
} }
@Patch(':id') // @Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateSalesInvoiceDto) { // update(@Param('id') id: string, @Body() dto: UpdateSalesInvoiceDto) {
return this.service.update(Number(id), dto) // return this.service.update(Number(id), dto)
} // }
@Delete(':id') @Delete(':id')
remove(@Param('id') id: string) { remove(@Param('id') id: string) {
@@ -1,11 +1,13 @@
import { Module } from '@nestjs/common' import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module' import { PrismaModule } from '../../prisma/prisma.module'
import { SalesInvoicesController } from './sales-invoices.controller' import { SalesInvoicesController } from './sales-invoices.controller'
import { SalesInvoicesService } from './sales-invoices.service' import { SalesInvoicesService } from './sales-invoices.service'
import { SalesInvoicesWorkflow } from './sales-invoices.workflow'
@Module({ @Module({
imports: [PrismaModule], imports: [PrismaModule],
controllers: [SalesInvoicesController], controllers: [SalesInvoicesController],
providers: [SalesInvoicesService], providers: [SalesInvoicesService, SalesInvoicesWorkflow],
exports: [SalesInvoicesWorkflow],
}) })
export class SalesInvoicesModule {} export class SalesInvoicesModule {}
@@ -0,0 +1,49 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../../common/response/response-mapper'
import { PrismaService } from '../../prisma/prisma.service'
@Injectable()
export class SalesInvoicesService {
constructor(private prisma: PrismaService) {}
// async create(dto: CreateSalesInvoiceDto) {
// const payload: any = { ...dto }
// if (Object.prototype.hasOwnProperty.call(payload, 'customerId')) {
// payload.customer = { connect: { id: Number(payload.customerId) } }
// delete payload.customerId
// }
// const item = await this.prisma.salesInvoice.create({ data: payload })
// return ResponseMapper.create(item)
// }
async findAll() {
const items = await this.prisma.salesInvoice.findMany({ include: { customer: true } })
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.salesInvoice.findUnique({
where: { id },
include: { items: true, customer: true },
})
if (!item) return null
return ResponseMapper.single(item)
}
// async update(id: number, data: any) {
// const payload: any = { ...data }
// if (Object.prototype.hasOwnProperty.call(payload, 'customerId')) {
// if (payload.customerId === null) payload.customer = { disconnect: true }
// else payload.customer = { connect: { id: Number(payload.customerId) } }
// delete payload.customerId
// }
// const item = await this.prisma.salesInvoice.update({ where: { id }, data: payload })
// return ResponseMapper.update(item)
// }
async remove(id: number) {
const item = await this.prisma.salesInvoice.delete({ where: { id } })
return ResponseMapper.single(item)
}
}
@@ -0,0 +1,38 @@
import {
MovementReferenceType,
MovementType,
Prisma,
} from '../../generated/prisma/client'
export class SalesInvoicesWorkflow {
constructor() {}
async onCreateByOrder(tx: Prisma.TransactionClient, orderId: number) {
const { posAccount } = await tx.order.findUniqueOrThrow({
where: { id: orderId },
select: { posAccount: { select: { inventoryId: true, id: true } } },
})
const posInventoryId = posAccount.inventoryId
const orderItems = await tx.orderItem.findMany({
where: {
orderId,
},
})
await tx.stockMovement.createMany({
data: orderItems.map(item => ({
productId: item.productId,
orderId,
type: MovementType.OUT,
referenceType: MovementReferenceType.SALES,
referenceId: String(orderId),
quantity: item.quantity,
inventoryId: posInventoryId,
unitPrice: item.unitPrice,
totalCost: item.totalAmount,
avgCost: item.unitPrice,
})),
})
}
}
@@ -12,7 +12,7 @@ export class CreateSalesInvoiceItemDto {
@Type(() => Number) @Type(() => Number)
@IsNumber() @IsNumber()
total: number totalAmount: number
@Type(() => Number) @Type(() => Number)
@IsInt() @IsInt()
@@ -15,7 +15,7 @@ export class UpdateSalesInvoiceItemDto {
@IsOptional() @IsOptional()
@Type(() => Number) @Type(() => Number)
@IsNumber() @IsNumber()
total?: number totalAmount?: number
@IsOptional() @IsOptional()
@Type(() => Number) @Type(() => Number)
@@ -1,50 +0,0 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto'
@Injectable()
export class SalesInvoicesService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateSalesInvoiceDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'customerId')) {
payload.customer = { connect: { id: Number(payload.customerId) } }
delete payload.customerId
}
const item = await this.prisma.salesInvoice.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.salesInvoice.findMany({ include: { customer: true } })
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.salesInvoice.findUnique({
where: { id },
include: { items: true, customer: true },
})
if (!item) return null
return ResponseMapper.single(item)
}
async update(id: number, data: any) {
const payload: any = { ...data }
if (Object.prototype.hasOwnProperty.call(payload, 'customerId')) {
if (payload.customerId === null) payload.customer = { disconnect: true }
else payload.customer = { connect: { id: Number(payload.customerId) } }
delete payload.customerId
}
const item = await this.prisma.salesInvoice.update({ where: { id }, data: payload })
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.salesInvoice.delete({ where: { id } })
return ResponseMapper.single(item)
}
}