feat: implement purchase receipt items management with create, update, find, and delete functionalities

feat: add purchase receipts management with create, update, find, and delete functionalities

feat: implement sales invoice items management with create, update, find, and delete functionalities

feat: add sales invoices management with create, update, find, and delete functionalities

feat: implement stock adjustments management with create, update, find, and delete functionalities

feat: add stock balance retrieval functionality

feat: implement stock movements management with create, update, find, and delete functionalities
This commit is contained in:
2025-12-09 13:59:07 +03:30
parent a782d61890
commit 807f6c2087
98 changed files with 26109 additions and 501 deletions
+1
View File
@@ -11,5 +11,6 @@ export default defineConfig({
}, },
datasource: { datasource: {
url: env('DATABASE_URL'), url: env('DATABASE_URL'),
shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
}, },
}) })
@@ -0,0 +1,284 @@
/*
Warnings:
- Made the column `createdAt` on table `Customers` required. This step will fail if there are existing NULL values in that column.
- Made the column `updatedAt` on table `Customers` required. This step will fail if there are existing NULL values in that column.
- Made the column `createdAt` on table `Product_Variants` required. This step will fail if there are existing NULL values in that column.
- Made the column `updatedAt` on table `Product_Variants` required. This step will fail if there are existing NULL values in that column.
- Made the column `createdAt` on table `Suppliers` required. This step will fail if there are existing NULL values in that column.
- Made the column `updatedAt` on table `Suppliers` required. This step will fail if there are existing NULL values in that column.
- Added the required column `updatedAt` to the `Users` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Customers` MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` TIMESTAMP(0) NOT NULL;
-- AlterTable
ALTER TABLE `Inventories` ADD COLUMN `deletedAt` TIMESTAMP(0) NULL,
MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
-- AlterTable
ALTER TABLE `Product_Variants` MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` TIMESTAMP(0) NOT NULL;
-- AlterTable
ALTER TABLE `Stores` ADD COLUMN `deletedAt` TIMESTAMP(0) NULL,
MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
-- AlterTable
ALTER TABLE `Suppliers` MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` TIMESTAMP(0) NOT NULL;
-- AlterTable
ALTER TABLE `Users` ADD COLUMN `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
ADD COLUMN `deletedAt` TIMESTAMP(0) NULL,
ADD COLUMN `updatedAt` TIMESTAMP(0) NOT NULL;
-- CreateTable
CREATE TABLE `Product_Charges` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`count` DECIMAL(10, 2) NOT NULL,
`fee` DECIMAL(10, 2) NOT NULL,
`totalAmount` DECIMAL(10, 2) NOT NULL,
`isSettled` BOOLEAN NOT NULL DEFAULT false,
`buyAt` TIMESTAMP(0) NULL,
`description` TEXT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updatedAt` TIMESTAMP(0) NOT NULL,
`deletedAt` TIMESTAMP(0) NULL,
`productId` INTEGER NOT NULL,
`inventoryId` INTEGER NOT NULL,
`supplierId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Orders` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`orderNumber` VARCHAR(100) NOT NULL,
`status` ENUM('pending', 'reject', 'done') NOT NULL DEFAULT 'pending',
`paymentMethod` ENUM('cash', 'card') NOT NULL DEFAULT 'card',
`totalAmount` DECIMAL(10, 2) NOT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updatedAt` TIMESTAMP(0) NOT NULL,
`deletedAt` TIMESTAMP(0) NULL,
`customerId` INTEGER NOT NULL,
UNIQUE INDEX `Orders_orderNumber_key`(`orderNumber`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Purchase_Receipts` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(100) NOT NULL,
`totalAmount` DECIMAL(10, 2) NOT NULL,
`description` TEXT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updatedAt` TIMESTAMP(0) NOT NULL,
`supplierId` INTEGER NOT NULL,
`inventoryId` INTEGER NOT NULL,
UNIQUE INDEX `Purchase_Receipts_code_key`(`code`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Purchase_Receipt_Items` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`count` DECIMAL(10, 2) NOT NULL,
`fee` DECIMAL(10, 2) NOT NULL,
`total` DECIMAL(10, 2) NOT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`receiptId` INTEGER NOT NULL,
`productId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Sales_Invoices` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(100) NOT NULL,
`totalAmount` DECIMAL(10, 2) NOT NULL,
`description` TEXT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updatedAt` TIMESTAMP(0) NOT NULL,
`customerId` INTEGER NULL,
UNIQUE INDEX `Sales_Invoices_code_key`(`code`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Sales_Invoice_Items` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`count` DECIMAL(10, 2) NOT NULL,
`fee` DECIMAL(10, 2) NOT NULL,
`total` DECIMAL(10, 2) NOT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`invoiceId` INTEGER NOT NULL,
`productId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Stock_Movements` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`type` ENUM('IN', 'OUT', 'ADJUST') NOT NULL,
`quantity` DECIMAL(10, 2) NOT NULL,
`fee` DECIMAL(10, 2) NOT NULL,
`totalCost` DECIMAL(10, 2) NOT NULL,
`referenceType` ENUM('PURCHASE', 'SALES', 'ADJUSTMENT') NOT NULL,
`referenceId` VARCHAR(191) NOT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`productId` INTEGER NOT NULL,
`inventoryId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `stock_balance` (
`itemId` INTEGER NOT NULL,
`quantity` DECIMAL(65, 30) NOT NULL,
`totalCost` DECIMAL(65, 30) NOT NULL,
`updatedAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
PRIMARY KEY (`itemId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Inventory_Transfers` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`fromInventoryId` INTEGER NOT NULL,
`toInventoryId` INTEGER NOT NULL,
UNIQUE INDEX `Inventory_Transfers_code_key`(`code`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Inventory_Transfer_Items` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`count` DECIMAL(10, 2) NOT NULL,
`productId` INTEGER NOT NULL,
`transferId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `StockMovementsView` (
`id` INTEGER NULL,
`type` VARCHAR(191) NULL,
`productId` INTEGER NULL,
`quantity` DECIMAL(65, 30) NULL,
`fee` DECIMAL(65, 30) NULL,
`totalCost` DECIMAL(65, 30) NULL,
`referenceId` INTEGER NULL,
`referenceType` VARCHAR(191) NULL,
`createdAt` DATETIME(3) NULL
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Stock_Adjustments` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`adjustedQuantity` DECIMAL(10, 2) NOT NULL,
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`productId` INTEGER NOT NULL,
`inventoryId` INTEGER NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `stock_movements_view` (
`id` INTEGER NULL,
`productId` INTEGER NULL,
`type` VARCHAR(191) NULL,
`quantity` DECIMAL(65, 30) NULL,
`fee` DECIMAL(65, 30) NULL,
`totalCost` DECIMAL(65, 30) NULL,
`referenceId` VARCHAR(191) NULL,
`referenceType` VARCHAR(191) NULL,
`createdAt` DATETIME(3) NULL,
`currentStock` DECIMAL(65, 30) NULL,
`currentAvgCost` DECIMAL(65, 30) NULL
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Stock_View` (
`productId` INTEGER NULL,
`inventoryId` INTEGER NULL,
`stock` DECIMAL(65, 30) NULL
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Total_Stock_View` (
`productId` INTEGER NULL,
`stock` DECIMAL(65, 30) NULL
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `Product_Charges` ADD CONSTRAINT `Product_Charges_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Product_Charges` ADD CONSTRAINT `Product_Charges_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Product_Charges` ADD CONSTRAINT `Product_Charges_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Orders` ADD CONSTRAINT `Orders_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Purchase_Receipts` ADD CONSTRAINT `Purchase_Receipts_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Purchase_Receipts` ADD CONSTRAINT `Purchase_Receipts_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Purchase_Receipt_Items` ADD CONSTRAINT `Purchase_Receipt_Items_receiptId_fkey` FOREIGN KEY (`receiptId`) REFERENCES `Purchase_Receipts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Purchase_Receipt_Items` ADD CONSTRAINT `Purchase_Receipt_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Sales_Invoices` ADD CONSTRAINT `Sales_Invoices_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `Sales_Invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Sales_Invoice_Items` ADD CONSTRAINT `Sales_Invoice_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Stock_Movements` ADD CONSTRAINT `Stock_Movements_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Stock_Movements` ADD CONSTRAINT `Stock_Movements_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Inventory_Transfers` ADD CONSTRAINT `Inventory_Transfers_fromInventoryId_fkey` FOREIGN KEY (`fromInventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Inventory_Transfers` ADD CONSTRAINT `Inventory_Transfers_toInventoryId_fkey` FOREIGN KEY (`toInventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Inventory_Transfer_Items` ADD CONSTRAINT `Inventory_Transfer_Items_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Inventory_Transfer_Items` ADD CONSTRAINT `Inventory_Transfer_Items_transferId_fkey` FOREIGN KEY (`transferId`) REFERENCES `Inventory_Transfers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Stock_Adjustments` ADD CONSTRAINT `Stock_Adjustments_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Stock_Adjustments` ADD CONSTRAINT `Stock_Adjustments_inventoryId_fkey` FOREIGN KEY (`inventoryId`) REFERENCES `Inventories`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the `StockMovementsView` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `Stock_View` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `Total_Stock_View` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `stock_movements_view` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
DROP TABLE `StockMovementsView`;
-- DropTable
DROP TABLE `Stock_View`;
-- DropTable
DROP TABLE `Total_Stock_View`;
-- DropTable
DROP TABLE `stock_movements_view`;
@@ -0,0 +1,13 @@
/*
Warnings:
- The primary key for the `stock_balance` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `itemId` on the `stock_balance` table. All the data in the column will be lost.
- Added the required column `ProductId` to the `stock_balance` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `stock_balance` DROP PRIMARY KEY,
DROP COLUMN `itemId`,
ADD COLUMN `ProductId` INTEGER NOT NULL,
ADD PRIMARY KEY (`ProductId`);
@@ -0,0 +1,9 @@
/*
Warnings:
- Added the required column `avgCost` to the `Stock_Movements` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Stock_Movements` ADD COLUMN `avgCost` DECIMAL(10, 2) NOT NULL;
@@ -0,0 +1,9 @@
/*
Warnings:
- Added the required column `avgCost` to the `stock_balance` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `stock_balance` ADD COLUMN `avgCost` DECIMAL(65, 30) NOT NULL;
+308 -37
View File
@@ -1,23 +1,27 @@
datasource db {
provider = "mysql"
}
generator client { generator client {
provider = "prisma-client" provider = "prisma-client"
output = "../src/generated/prisma" output = "../src/generated/prisma"
previewFeatures = ["views"]
moduleFormat = "cjs" moduleFormat = "cjs"
} }
datasource db {
provider = "mysql"
}
model User { model User {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
mobileNumber String @unique @db.Char(11) mobileNumber String @unique @db.Char(11)
password String password String
firstName String firstName String
lastName String lastName String
roleId Int roleId Int
createdAt DateTime @default(now()) @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
role Role @relation("User_Role", fields: [roleId], references: [id], onUpdate: NoAction) role Role @relation("User_Role", fields: [roleId], references: [id], onUpdate: NoAction)
@@index([roleId], map: "Users_roleId_fkey")
@@map("Users") @@map("Users")
} }
@@ -29,7 +33,6 @@ model Role {
createdAt DateTime @default(now()) @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
users User[] @relation("User_Role") users User[] @relation("User_Role")
@@map("Roles") @@map("Roles")
@@ -48,43 +51,39 @@ model ProductVariant {
alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2) alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)
isActive Boolean @default(true) isActive Boolean @default(true)
isFeatured Boolean @default(false) isFeatured Boolean @default(false)
createdAt DateTime? @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime? @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
product Product @relation("Product_Variant", fields: [productId], references: [id], onUpdate: NoAction)
productId Int productId Int
// is_stock_managed Boolean @default(true) product Product @relation("Product_Variant", fields: [productId], references: [id], onUpdate: NoAction)
// created_by Int?
// collection_product collection_product[]
// product_batches product_batches[]
// product_stocks product_stocks[]
// attachments attachments? @relation(fields: [attachment_id], references: [id], onUpdate: NoAction, map: "products_attachment_id_foreign")
// purchase_items purchase_items[]
// sale_items sale_items[]
@@index([productId], map: "Product_Variants_productId_fkey")
@@map("Product_Variants") @@map("Product_Variants")
} }
model Product { model Product {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String @db.VarChar(255) name String @db.VarChar(255)
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
description String? @db.Text description String? @db.Text
// productType String? @default("simple") @db.VarChar(50) sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
createdAt DateTime @default(now()) @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
variants ProductVariant[] @relation("Product_Variant")
brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
brandId Int? brandId Int?
category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
categoryId Int? categoryId Int?
inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product")
productCharges ProductCharge[] @relation("Product_Charges")
variants ProductVariant[] @relation("Product_Variant")
brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
purchaseReceiptItems PurchaseReceiptItem[] @relation("Product_PurchaseReceiptItems")
salesInvoiceItems SalesInvoiceItem[] @relation("Product_SalesInvoiceItems")
stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments")
stockMovements StockMovement[] @relation("StockMovement_Product")
@@index([brandId], map: "Products_brandId_fkey")
@@index([categoryId], map: "Products_categoryId_fkey")
@@map("Products") @@map("Products")
} }
@@ -96,7 +95,6 @@ model ProductBrand {
createdAt DateTime @default(now()) @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
products Product[] @relation("Product_Brand") products Product[] @relation("Product_Brand")
@@map("Product_brands") @@map("Product_brands")
@@ -110,7 +108,6 @@ model ProductCategory {
createdAt DateTime @default(now()) @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
products Product[] @relation("Product_Category") products Product[] @relation("Product_Category")
@@map("Product_categories") @@map("Product_categories")
@@ -127,9 +124,11 @@ model Supplier {
state String? @db.VarChar(100) state String? @db.VarChar(100)
country String? @db.VarChar(100) country String? @db.VarChar(100)
isActive Boolean @default(true) isActive Boolean @default(true)
createdAt DateTime? @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime? @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
productCharges ProductCharge[] @relation("Supplier_Product_Charges")
purchaseReceipts PurchaseReceipt[]
@@map("Suppliers") @@map("Suppliers")
} }
@@ -145,9 +144,11 @@ model Customer {
state String? @db.VarChar(100) state String? @db.VarChar(100)
country String? @db.VarChar(100) country String? @db.VarChar(100)
isActive Boolean @default(true) isActive Boolean @default(true)
createdAt DateTime? @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime? @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0)
orders Order[] @relation("Customer_Orders")
salesInvoices SalesInvoice[] @relation("Customer_Sales_Invoices")
@@map("Customers") @@map("Customers")
} }
@@ -157,8 +158,15 @@ model Inventory {
name String @db.VarChar(255) name String @db.VarChar(255)
location String? @db.VarChar(255) location String? @db.VarChar(255)
isActive Boolean @default(true) isActive Boolean @default(true)
createdAt DateTime @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
inventoryTransfersFrom InventoryTransfer[] @relation("Inventory_From")
inventoryTransfersTo InventoryTransfer[] @relation("Inventory_To")
productCharges ProductCharge[] @relation("Inventory_Product_Charges")
purchaseReceipts PurchaseReceipt[]
stockAdjustments StockAdjustment[] @relation("Inventory_Stock_Adjustments")
stockMovements StockMovement[] @relation("StockMovement_Inventory")
@@map("Inventories") @@map("Inventories")
} }
@@ -168,8 +176,271 @@ model Store {
name String @db.VarChar(255) name String @db.VarChar(255)
location String? @db.VarChar(255) location String? @db.VarChar(255)
isActive Boolean @default(true) isActive Boolean @default(true)
createdAt DateTime @db.Timestamp(0) createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
@@map("Stores") @@map("Stores")
} }
model ProductCharge {
id Int @id @default(autoincrement())
count Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
totalAmount Decimal @db.Decimal(10, 2)
isSettled Boolean @default(false)
buyAt DateTime? @db.Timestamp(0)
description String? @db.Text
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
productId Int
inventoryId Int
supplierId Int
inventory Inventory @relation("Inventory_Product_Charges", fields: [inventoryId], references: [id], onUpdate: NoAction)
product Product @relation("Product_Charges", fields: [productId], references: [id], onUpdate: NoAction)
supplier Supplier @relation("Supplier_Product_Charges", fields: [supplierId], references: [id], onUpdate: NoAction)
@@index([inventoryId], map: "Product_Charges_inventoryId_fkey")
@@index([productId], map: "Product_Charges_productId_fkey")
@@index([supplierId], map: "Product_Charges_supplierId_fkey")
@@map("Product_Charges")
}
model Order {
id Int @id @default(autoincrement())
orderNumber String @unique @db.VarChar(100)
status OrderStatus @default(pending)
paymentMethod paymentMethod @default(card)
totalAmount Decimal @db.Decimal(10, 2)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
customerId Int
customer Customer @relation("Customer_Orders", fields: [customerId], references: [id], onUpdate: NoAction)
@@index([customerId], map: "Orders_customerId_fkey")
@@map("Orders")
}
model PurchaseReceipt {
id Int @id @default(autoincrement())
code String @unique @db.VarChar(100)
totalAmount Decimal @db.Decimal(10, 2)
description String? @db.Text
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
supplierId Int
inventoryId Int
items PurchaseReceiptItem[] @relation("PurchaseReceipt_Items")
inventory Inventory @relation(fields: [inventoryId], references: [id])
supplier Supplier @relation(fields: [supplierId], references: [id])
@@index([inventoryId], map: "Purchase_Receipts_inventoryId_fkey")
@@index([supplierId], map: "Purchase_Receipts_supplierId_fkey")
@@map("Purchase_Receipts")
}
model PurchaseReceiptItem {
id Int @id @default(autoincrement())
count Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
total Decimal @db.Decimal(10, 2)
createdAt DateTime @default(now()) @db.Timestamp(0)
receiptId Int
productId Int
product Product @relation("Product_PurchaseReceiptItems", fields: [productId], references: [id])
receipt PurchaseReceipt @relation("PurchaseReceipt_Items", fields: [receiptId], references: [id])
@@index([productId], map: "Purchase_Receipt_Items_productId_fkey")
@@index([receiptId], map: "Purchase_Receipt_Items_receiptId_fkey")
@@map("Purchase_Receipt_Items")
}
model SalesInvoice {
id Int @id @default(autoincrement())
code String @unique @db.VarChar(100)
totalAmount Decimal @db.Decimal(10, 2)
description String? @db.Text
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
customerId Int?
items SalesInvoiceItem[] @relation("SalesInvoice_Items")
customer Customer? @relation("Customer_Sales_Invoices", fields: [customerId], references: [id])
@@index([customerId], map: "Sales_Invoices_customerId_fkey")
@@map("Sales_Invoices")
}
model SalesInvoiceItem {
id Int @id @default(autoincrement())
count Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
total Decimal @db.Decimal(10, 2)
createdAt DateTime @default(now()) @db.Timestamp(0)
invoiceId Int
productId Int
invoice SalesInvoice @relation("SalesInvoice_Items", fields: [invoiceId], references: [id])
product Product @relation("Product_SalesInvoiceItems", fields: [productId], references: [id])
@@index([invoiceId], map: "Sales_Invoice_Items_invoiceId_fkey")
@@index([productId], map: "Sales_Invoice_Items_productId_fkey")
@@map("Sales_Invoice_Items")
}
model StockMovement {
id Int @id @default(autoincrement())
type MovementType
quantity Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
totalCost Decimal @db.Decimal(10, 2)
referenceType MovementReferenceType
referenceId String
createdAt DateTime @default(now()) @db.Timestamp(0)
productId Int
inventoryId Int
avgCost Decimal @db.Decimal(10, 2)
inventory Inventory @relation("StockMovement_Inventory", fields: [inventoryId], references: [id])
product Product @relation("StockMovement_Product", fields: [productId], references: [id])
@@index([inventoryId], map: "Stock_Movements_inventoryId_fkey")
@@index([productId], map: "Stock_Movements_productId_fkey")
@@map("Stock_Movements")
}
model StockBalance {
quantity Decimal
totalCost Decimal
updatedAt DateTime @default(now()) @updatedAt @db.Timestamp(0)
ProductId Int @id
avgCost Decimal
@@map("stock_balance")
}
model InventoryTransfer {
id Int @id @default(autoincrement())
code String @unique @db.VarChar(100)
description String? @db.Text
createdAt DateTime @default(now()) @db.Timestamp(0)
fromInventoryId Int
toInventoryId Int
items InventoryTransferItem[] @relation("InventoryTransfer_Items")
fromInventory Inventory @relation("Inventory_From", fields: [fromInventoryId], references: [id])
toInventory Inventory @relation("Inventory_To", fields: [toInventoryId], references: [id])
@@index([fromInventoryId], map: "Inventory_Transfers_fromInventoryId_fkey")
@@index([toInventoryId], map: "Inventory_Transfers_toInventoryId_fkey")
@@map("Inventory_Transfers")
}
model InventoryTransferItem {
id Int @id @default(autoincrement())
count Decimal @db.Decimal(10, 2)
productId Int
transferId Int
product Product @relation("InventoryTransferItem_Product", fields: [productId], references: [id])
transfer InventoryTransfer @relation("InventoryTransfer_Items", fields: [transferId], references: [id])
@@index([productId], map: "Inventory_Transfer_Items_productId_fkey")
@@index([transferId], map: "Inventory_Transfer_Items_transferId_fkey")
@@map("Inventory_Transfer_Items")
}
model StockAdjustment {
id Int @id @default(autoincrement())
adjustedQuantity Decimal @db.Decimal(10, 2)
createdAt DateTime @default(now()) @db.Timestamp(0)
productId Int
inventoryId Int
inventory Inventory @relation("Inventory_Stock_Adjustments", fields: [inventoryId], references: [id])
product Product @relation("Product_Stock_Adjustments", fields: [productId], references: [id])
@@index([inventoryId], map: "Stock_Adjustments_inventoryId_fkey")
@@index([productId], map: "Stock_Adjustments_productId_fkey")
@@map("Stock_Adjustments")
}
view StockMovements_View {
id Int @default(0)
productId Int
type stock_movements_view_type
quantity Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
totalCost Decimal @db.Decimal(10, 2)
referenceId String
referenceType stock_movements_view_referenceType
createdAt DateTime @default(now()) @db.Timestamp(0)
current_stock Decimal?
current_avg_cost Decimal?
@@map("stock_movements_view")
@@ignore
}
view inventory_overview {
ProductId Int
stock_quantity Decimal
avgCost Decimal
totalCost Decimal
updatedAt DateTime @default(now()) @db.Timestamp(0)
}
view stock_cardex {
productId Int
movement_id Int @default(0)
type stock_cardex_type
quantity Decimal @db.Decimal(10, 2)
fee Decimal @db.Decimal(10, 2)
totalCost Decimal @db.Decimal(10, 2)
balance_quantity Decimal?
balance_avg_cost Decimal?
createdAt DateTime @default(now()) @db.Timestamp(0)
}
view stock_view {
productId Int
inventoryId Int
stock Decimal? @db.Decimal(32, 2)
}
enum OrderStatus {
pending
reject
done
}
enum paymentMethod {
cash
card
}
enum MovementType {
IN
OUT
ADJUST
}
enum MovementReferenceType {
PURCHASE
SALES
ADJUSTMENT
}
enum stock_cardex_type {
IN
OUT
ADJUST
}
enum stock_movements_view_type {
IN
OUT
ADJUST
}
enum stock_movements_view_referenceType {
PURCHASE
SALES
ADJUSTMENT
}
+17
View File
@@ -0,0 +1,17 @@
SELECT
`sm`.`id` AS `id`,
`sm`.`productId` AS `productId`,
`sm`.`type` AS `type`,
`sm`.`quantity` AS `quantity`,
`sm`.`fee` AS `fee`,
`sm`.`totalCost` AS `totalCost`,
`sm`.`referenceId` AS `referenceId`,
`sm`.`referenceType` AS `referenceType`,
`sm`.`createdAt` AS `createdAt`,
`sb`.`quantity` AS `current_stock`,
`sb`.`avgCost` AS `current_avg_cost`
FROM
(
`pos`.`Stock_Movements` `sm`
LEFT JOIN `pos`.`stock_balance` `sb` ON((`sb`.`ProductId` = `sm`.`productId`))
)
+8
View File
@@ -0,0 +1,8 @@
SELECT
`pos`.`stock_balance`.`ProductId` AS `ProductId`,
`pos`.`stock_balance`.`quantity` AS `stock_quantity`,
`pos`.`stock_balance`.`avgCost` AS `avgCost`,
`pos`.`stock_balance`.`totalCost` AS `totalCost`,
`pos`.`stock_balance`.`updatedAt` AS `updatedAt`
FROM
`pos`.`stock_balance`
+18
View File
@@ -0,0 +1,18 @@
SELECT
`sm`.`productId` AS `productId`,
`sm`.`id` AS `movement_id`,
`sm`.`type` AS `type`,
`sm`.`quantity` AS `quantity`,
`sm`.`fee` AS `fee`,
`sm`.`totalCost` AS `totalCost`,
`sb`.`quantity` AS `balance_quantity`,
`sb`.`avgCost` AS `balance_avg_cost`,
`sm`.`createdAt` AS `createdAt`
FROM
(
`pos`.`Stock_Movements` `sm`
LEFT JOIN `pos`.`stock_balance` `sb` ON((`sb`.`ProductId` = `sm`.`productId`))
)
ORDER BY
`sm`.`productId`,
`sm`.`createdAt`
+18
View File
@@ -0,0 +1,18 @@
SELECT
`pos`.`Stock_Movements`.`productId` AS `productId`,
`pos`.`Stock_Movements`.`inventoryId` AS `inventoryId`,
sum(
(
CASE
WHEN (`pos`.`Stock_Movements`.`type` = 'IN') THEN `pos`.`Stock_Movements`.`quantity`
WHEN (`pos`.`Stock_Movements`.`type` = 'OUT') THEN -(`pos`.`Stock_Movements`.`quantity`)
WHEN (`pos`.`Stock_Movements`.`type` = 'ADJUST') THEN `pos`.`Stock_Movements`.`quantity`
ELSE 0
END
)
) AS `stock`
FROM
`pos`.`Stock_Movements`
GROUP BY
`pos`.`Stock_Movements`.`productId`,
`pos`.`Stock_Movements`.`inventoryId`
View File
+20
View File
@@ -3,12 +3,22 @@ import { AppController } from './app.controller'
import { AppService } from './app.service' import { AppService } from './app.service'
import { CustomersModule } from './customers/customers.module' import { CustomersModule } from './customers/customers.module'
import { InventoriesModule } from './inventories/inventories.module' import { InventoriesModule } from './inventories/inventories.module'
import { InventoryTransferItemsModule } from './inventory-transfer-items/inventory-transfer-items.module'
import { InventoryTransfersModule } from './inventory-transfers/inventory-transfers.module'
import { PrismaModule } from './prisma/prisma.module' import { PrismaModule } from './prisma/prisma.module'
import { ProductBrandsModule } from './product-brands/product-brands.module' import { ProductBrandsModule } from './product-brands/product-brands.module'
import { ProductCategoriesModule } from './product-categories/product-categories.module' import { ProductCategoriesModule } from './product-categories/product-categories.module'
import { ProductChargesModule } from './product-charges/product-charges.module'
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 { PurchaseReceiptItemsModule } from './purchase-receipt-items/purchase-receipt-items.module'
import { PurchaseReceiptsModule } from './purchase-receipts/purchase-receipts.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 { StockBalanceModule } from './stock-balance/stock-balance.module'
import { StockMovementsModule } from './stock-movements/stock-movements.module'
import { StoresModule } from './stores/stores.module' import { StoresModule } from './stores/stores.module'
import { SuppliersModule } from './suppliers/suppliers.module' import { SuppliersModule } from './suppliers/suppliers.module'
import { UsersModule } from './users/users.module' import { UsersModule } from './users/users.module'
@@ -22,10 +32,20 @@ import { UsersModule } from './users/users.module'
ProductVariantsModule, ProductVariantsModule,
ProductBrandsModule, ProductBrandsModule,
ProductCategoriesModule, ProductCategoriesModule,
ProductChargesModule,
SuppliersModule, SuppliersModule,
CustomersModule, CustomersModule,
InventoriesModule, InventoriesModule,
StoresModule, StoresModule,
PurchaseReceiptsModule,
PurchaseReceiptItemsModule,
SalesInvoicesModule,
SalesInvoiceItemsModule,
InventoryTransfersModule,
InventoryTransferItemsModule,
StockMovementsModule,
StockAdjustmentsModule,
StockBalanceModule,
], ],
controllers: [AppController], controllers: [AppController],
providers: [AppService], providers: [AppService],
+34
View File
@@ -0,0 +1,34 @@
export interface ShortEntity {
id: number
name: string
}
export interface PaginationMeta {
totalRecords: number
totalPages: number
page: number
perPage: number
}
export interface ResponseModel<T> {
data: T
meta?: PaginationMeta
}
export interface Envelope<T> {
statusCode: number
timestamp: string
path: string
data: T
meta?: PaginationMeta
errors?: string[]
}
// Generic GET response shapes used across modules
// - GetListResponse: response for `GET /resources` (returns array + optional meta)
// - GetSingleResponse: response for `GET /resources/:id` (returns single item)
export type GetListResponse<T> = ResponseModel<T[]>
export type GetSingleResponse<T> = ResponseModel<T>
// Paginated response where data is the items array and meta contains pagination info
export type PaginatedResponse<T> = ResponseModel<T[]>
+70
View File
@@ -67,3 +67,73 @@ export type Inventory = Prisma.InventoryModel
* *
*/ */
export type Store = Prisma.StoreModel export type Store = Prisma.StoreModel
/**
* Model ProductCharge
*
*/
export type ProductCharge = Prisma.ProductChargeModel
/**
* Model Order
*
*/
export type Order = Prisma.OrderModel
/**
* Model PurchaseReceipt
*
*/
export type PurchaseReceipt = Prisma.PurchaseReceiptModel
/**
* Model PurchaseReceiptItem
*
*/
export type PurchaseReceiptItem = Prisma.PurchaseReceiptItemModel
/**
* Model SalesInvoice
*
*/
export type SalesInvoice = Prisma.SalesInvoiceModel
/**
* Model SalesInvoiceItem
*
*/
export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel
/**
* Model StockMovement
*
*/
export type StockMovement = Prisma.StockMovementModel
/**
* Model StockBalance
*
*/
export type StockBalance = Prisma.StockBalanceModel
/**
* Model InventoryTransfer
*
*/
export type InventoryTransfer = Prisma.InventoryTransferModel
/**
* Model InventoryTransferItem
*
*/
export type InventoryTransferItem = Prisma.InventoryTransferItemModel
/**
* Model StockAdjustment
*
*/
export type StockAdjustment = Prisma.StockAdjustmentModel
/**
* Model inventory_overview
*
*/
export type inventory_overview = Prisma.inventory_overviewModel
/**
* Model stock_cardex
*
*/
export type stock_cardex = Prisma.stock_cardexModel
/**
* Model stock_view
*
*/
export type stock_view = Prisma.stock_viewModel
+70
View File
@@ -87,3 +87,73 @@ export type Inventory = Prisma.InventoryModel
* *
*/ */
export type Store = Prisma.StoreModel export type Store = Prisma.StoreModel
/**
* Model ProductCharge
*
*/
export type ProductCharge = Prisma.ProductChargeModel
/**
* Model Order
*
*/
export type Order = Prisma.OrderModel
/**
* Model PurchaseReceipt
*
*/
export type PurchaseReceipt = Prisma.PurchaseReceiptModel
/**
* Model PurchaseReceiptItem
*
*/
export type PurchaseReceiptItem = Prisma.PurchaseReceiptItemModel
/**
* Model SalesInvoice
*
*/
export type SalesInvoice = Prisma.SalesInvoiceModel
/**
* Model SalesInvoiceItem
*
*/
export type SalesInvoiceItem = Prisma.SalesInvoiceItemModel
/**
* Model StockMovement
*
*/
export type StockMovement = Prisma.StockMovementModel
/**
* Model StockBalance
*
*/
export type StockBalance = Prisma.StockBalanceModel
/**
* Model InventoryTransfer
*
*/
export type InventoryTransfer = Prisma.InventoryTransferModel
/**
* Model InventoryTransferItem
*
*/
export type InventoryTransferItem = Prisma.InventoryTransferItemModel
/**
* Model StockAdjustment
*
*/
export type StockAdjustment = Prisma.StockAdjustmentModel
/**
* Model inventory_overview
*
*/
export type inventory_overview = Prisma.inventory_overviewModel
/**
* Model stock_cardex
*
*/
export type stock_cardex = Prisma.stock_cardexModel
/**
* Model stock_view
*
*/
export type stock_view = Prisma.stock_viewModel
+315 -145
View File
@@ -40,6 +40,33 @@ export type StringFilter<$PrismaModel = never> = {
not?: Prisma.NestedStringFilter<$PrismaModel> | string not?: Prisma.NestedStringFilter<$PrismaModel> | string
} }
export type DateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string
}
export type DateTimeNullableFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
}
export type SortOrderInput = {
sort: Prisma.SortOrder
nulls?: Prisma.NullsOrder
}
export type IntWithAggregatesFilter<$PrismaModel = never> = { export type IntWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[] in?: number[]
@@ -74,6 +101,34 @@ export type StringWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedStringFilter<$PrismaModel> _max?: Prisma.NestedStringFilter<$PrismaModel>
} }
export type DateTimeWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedDateTimeFilter<$PrismaModel>
_max?: Prisma.NestedDateTimeFilter<$PrismaModel>
}
export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
}
export type StringNullableFilter<$PrismaModel = never> = { export type StringNullableFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null in?: string[] | null
@@ -113,33 +168,6 @@ export type JsonNullableFilterBase<$PrismaModel = never> = {
not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter
} }
export type DateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string
}
export type DateTimeNullableFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
}
export type SortOrderInput = {
sort: Prisma.SortOrder
nulls?: Prisma.NullsOrder
}
export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { export type StringNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null in?: string[] | null
@@ -185,34 +213,6 @@ export type JsonNullableWithAggregatesFilterBase<$PrismaModel = never> = {
_max?: Prisma.NestedJsonNullableFilter<$PrismaModel> _max?: Prisma.NestedJsonNullableFilter<$PrismaModel>
} }
export type DateTimeWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedDateTimeFilter<$PrismaModel>
_max?: Prisma.NestedDateTimeFilter<$PrismaModel>
}
export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
}
export type DecimalFilter<$PrismaModel = never> = { export type DecimalFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
@@ -307,6 +307,91 @@ export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedIntNullableFilter<$PrismaModel> _max?: Prisma.NestedIntNullableFilter<$PrismaModel>
} }
export type EnumOrderStatusFilter<$PrismaModel = never> = {
equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel>
in?: $Enums.OrderStatus[]
notIn?: $Enums.OrderStatus[]
not?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> | $Enums.OrderStatus
}
export type EnumpaymentMethodFilter<$PrismaModel = never> = {
equals?: $Enums.paymentMethod | Prisma.EnumpaymentMethodFieldRefInput<$PrismaModel>
in?: $Enums.paymentMethod[]
notIn?: $Enums.paymentMethod[]
not?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel> | $Enums.paymentMethod
}
export type EnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel>
in?: $Enums.OrderStatus[]
notIn?: $Enums.OrderStatus[]
not?: Prisma.NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel> | $Enums.OrderStatus
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel>
_max?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel>
}
export type EnumpaymentMethodWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.paymentMethod | Prisma.EnumpaymentMethodFieldRefInput<$PrismaModel>
in?: $Enums.paymentMethod[]
notIn?: $Enums.paymentMethod[]
not?: Prisma.NestedEnumpaymentMethodWithAggregatesFilter<$PrismaModel> | $Enums.paymentMethod
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel>
_max?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel>
}
export type EnumMovementTypeFilter<$PrismaModel = never> = {
equals?: $Enums.MovementType | Prisma.EnumMovementTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementType[]
notIn?: $Enums.MovementType[]
not?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel> | $Enums.MovementType
}
export type EnumMovementReferenceTypeFilter<$PrismaModel = never> = {
equals?: $Enums.MovementReferenceType | Prisma.EnumMovementReferenceTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementReferenceType[]
notIn?: $Enums.MovementReferenceType[]
not?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel> | $Enums.MovementReferenceType
}
export type EnumMovementTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.MovementType | Prisma.EnumMovementTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementType[]
notIn?: $Enums.MovementType[]
not?: Prisma.NestedEnumMovementTypeWithAggregatesFilter<$PrismaModel> | $Enums.MovementType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel>
}
export type EnumMovementReferenceTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.MovementReferenceType | Prisma.EnumMovementReferenceTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementReferenceType[]
notIn?: $Enums.MovementReferenceType[]
not?: Prisma.NestedEnumMovementReferenceTypeWithAggregatesFilter<$PrismaModel> | $Enums.MovementReferenceType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel>
}
export type Enumstock_cardex_typeFilter<$PrismaModel = never> = {
equals?: $Enums.stock_cardex_type | Prisma.Enumstock_cardex_typeFieldRefInput<$PrismaModel>
in?: $Enums.stock_cardex_type[]
notIn?: $Enums.stock_cardex_type[]
not?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel> | $Enums.stock_cardex_type
}
export type Enumstock_cardex_typeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.stock_cardex_type | Prisma.Enumstock_cardex_typeFieldRefInput<$PrismaModel>
in?: $Enums.stock_cardex_type[]
notIn?: $Enums.stock_cardex_type[]
not?: Prisma.NestedEnumstock_cardex_typeWithAggregatesFilter<$PrismaModel> | $Enums.stock_cardex_type
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel>
_max?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel>
}
export type NestedIntFilter<$PrismaModel = never> = { export type NestedIntFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[] in?: number[]
@@ -333,6 +418,28 @@ export type NestedStringFilter<$PrismaModel = never> = {
not?: Prisma.NestedStringFilter<$PrismaModel> | string not?: Prisma.NestedStringFilter<$PrismaModel> | string
} }
export type NestedDateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string
}
export type NestedDateTimeNullableFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
}
export type NestedIntWithAggregatesFilter<$PrismaModel = never> = { export type NestedIntWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[] in?: number[]
@@ -378,96 +485,6 @@ export type NestedStringWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedStringFilter<$PrismaModel> _max?: Prisma.NestedStringFilter<$PrismaModel>
} }
export type NestedStringNullableFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null
notIn?: string[] | null
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
search?: string
not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null
}
export type NestedDateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string
}
export type NestedDateTimeNullableFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
in?: Date[] | string[] | null
notIn?: Date[] | string[] | null
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
}
export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null
notIn?: string[] | null
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
search?: string
not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedStringNullableFilter<$PrismaModel>
_max?: Prisma.NestedStringNullableFilter<$PrismaModel>
}
export type NestedIntNullableFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
in?: number[] | null
notIn?: number[] | null
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null
}
export type NestedJsonNullableFilter<$PrismaModel = never> =
| Prisma.PatchUndefined<
Prisma.Either<Required<NestedJsonNullableFilterBase<$PrismaModel>>, Exclude<keyof Required<NestedJsonNullableFilterBase<$PrismaModel>>, 'path'>>,
Required<NestedJsonNullableFilterBase<$PrismaModel>>
>
| Prisma.OptionalFlat<Omit<Required<NestedJsonNullableFilterBase<$PrismaModel>>, 'path'>>
export type NestedJsonNullableFilterBase<$PrismaModel = never> = {
equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter
path?: string
mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel>
string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel>
string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel>
array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
array_contains?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
lt?: runtime.InputJsonValue
lte?: runtime.InputJsonValue
gt?: runtime.InputJsonValue
gte?: runtime.InputJsonValue
not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter
}
export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = { export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[] in?: Date[] | string[]
@@ -496,6 +513,74 @@ export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
} }
export type NestedIntNullableFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
in?: number[] | null
notIn?: number[] | null
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null
}
export type NestedStringNullableFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null
notIn?: string[] | null
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
search?: string
not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null
}
export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null
in?: string[] | null
notIn?: string[] | null
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
gte?: string | Prisma.StringFieldRefInput<$PrismaModel>
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
search?: string
not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedStringNullableFilter<$PrismaModel>
_max?: Prisma.NestedStringNullableFilter<$PrismaModel>
}
export type NestedJsonNullableFilter<$PrismaModel = never> =
| Prisma.PatchUndefined<
Prisma.Either<Required<NestedJsonNullableFilterBase<$PrismaModel>>, Exclude<keyof Required<NestedJsonNullableFilterBase<$PrismaModel>>, 'path'>>,
Required<NestedJsonNullableFilterBase<$PrismaModel>>
>
| Prisma.OptionalFlat<Omit<Required<NestedJsonNullableFilterBase<$PrismaModel>>, 'path'>>
export type NestedJsonNullableFilterBase<$PrismaModel = never> = {
equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter
path?: string
mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel>
string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel>
string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel>
array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
array_contains?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null
lt?: runtime.InputJsonValue
lte?: runtime.InputJsonValue
gt?: runtime.InputJsonValue
gte?: runtime.InputJsonValue
not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter
}
export type NestedDecimalFilter<$PrismaModel = never> = { export type NestedDecimalFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
@@ -590,4 +675,89 @@ export type NestedFloatNullableFilter<$PrismaModel = never> = {
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
} }
export type NestedEnumOrderStatusFilter<$PrismaModel = never> = {
equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel>
in?: $Enums.OrderStatus[]
notIn?: $Enums.OrderStatus[]
not?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel> | $Enums.OrderStatus
}
export type NestedEnumpaymentMethodFilter<$PrismaModel = never> = {
equals?: $Enums.paymentMethod | Prisma.EnumpaymentMethodFieldRefInput<$PrismaModel>
in?: $Enums.paymentMethod[]
notIn?: $Enums.paymentMethod[]
not?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel> | $Enums.paymentMethod
}
export type NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.OrderStatus | Prisma.EnumOrderStatusFieldRefInput<$PrismaModel>
in?: $Enums.OrderStatus[]
notIn?: $Enums.OrderStatus[]
not?: Prisma.NestedEnumOrderStatusWithAggregatesFilter<$PrismaModel> | $Enums.OrderStatus
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel>
_max?: Prisma.NestedEnumOrderStatusFilter<$PrismaModel>
}
export type NestedEnumpaymentMethodWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.paymentMethod | Prisma.EnumpaymentMethodFieldRefInput<$PrismaModel>
in?: $Enums.paymentMethod[]
notIn?: $Enums.paymentMethod[]
not?: Prisma.NestedEnumpaymentMethodWithAggregatesFilter<$PrismaModel> | $Enums.paymentMethod
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel>
_max?: Prisma.NestedEnumpaymentMethodFilter<$PrismaModel>
}
export type NestedEnumMovementTypeFilter<$PrismaModel = never> = {
equals?: $Enums.MovementType | Prisma.EnumMovementTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementType[]
notIn?: $Enums.MovementType[]
not?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel> | $Enums.MovementType
}
export type NestedEnumMovementReferenceTypeFilter<$PrismaModel = never> = {
equals?: $Enums.MovementReferenceType | Prisma.EnumMovementReferenceTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementReferenceType[]
notIn?: $Enums.MovementReferenceType[]
not?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel> | $Enums.MovementReferenceType
}
export type NestedEnumMovementTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.MovementType | Prisma.EnumMovementTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementType[]
notIn?: $Enums.MovementType[]
not?: Prisma.NestedEnumMovementTypeWithAggregatesFilter<$PrismaModel> | $Enums.MovementType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumMovementTypeFilter<$PrismaModel>
}
export type NestedEnumMovementReferenceTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.MovementReferenceType | Prisma.EnumMovementReferenceTypeFieldRefInput<$PrismaModel>
in?: $Enums.MovementReferenceType[]
notIn?: $Enums.MovementReferenceType[]
not?: Prisma.NestedEnumMovementReferenceTypeWithAggregatesFilter<$PrismaModel> | $Enums.MovementReferenceType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumMovementReferenceTypeFilter<$PrismaModel>
}
export type NestedEnumstock_cardex_typeFilter<$PrismaModel = never> = {
equals?: $Enums.stock_cardex_type | Prisma.Enumstock_cardex_typeFieldRefInput<$PrismaModel>
in?: $Enums.stock_cardex_type[]
notIn?: $Enums.stock_cardex_type[]
not?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel> | $Enums.stock_cardex_type
}
export type NestedEnumstock_cardex_typeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.stock_cardex_type | Prisma.Enumstock_cardex_typeFieldRefInput<$PrismaModel>
in?: $Enums.stock_cardex_type[]
notIn?: $Enums.stock_cardex_type[]
not?: Prisma.NestedEnumstock_cardex_typeWithAggregatesFilter<$PrismaModel> | $Enums.stock_cardex_type
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel>
_max?: Prisma.NestedEnumstock_cardex_typeFilter<$PrismaModel>
}
+58 -2
View File
@@ -9,7 +9,63 @@
* 🟢 You can import this file directly. * 🟢 You can import this file directly.
*/ */
export const OrderStatus = {
pending: 'pending',
reject: 'reject',
done: 'done'
} as const
export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus]
// This file is empty because there are no enums in the schema. export const paymentMethod = {
export {} cash: 'cash',
card: 'card'
} as const
export type paymentMethod = (typeof paymentMethod)[keyof typeof paymentMethod]
export const MovementType = {
IN: 'IN',
OUT: 'OUT',
ADJUST: 'ADJUST'
} as const
export type MovementType = (typeof MovementType)[keyof typeof MovementType]
export const MovementReferenceType = {
PURCHASE: 'PURCHASE',
SALES: 'SALES',
ADJUSTMENT: 'ADJUSTMENT'
} as const
export type MovementReferenceType = (typeof MovementReferenceType)[keyof typeof MovementReferenceType]
export const stock_cardex_type = {
IN: 'IN',
OUT: 'OUT',
ADJUST: 'ADJUST'
} as const
export type stock_cardex_type = (typeof stock_cardex_type)[keyof typeof stock_cardex_type]
export const stock_movements_view_type = {
IN: 'IN',
OUT: 'OUT',
ADJUST: 'ADJUST'
} as const
export type stock_movements_view_type = (typeof stock_movements_view_type)[keyof typeof stock_movements_view_type]
export const stock_movements_view_referenceType = {
PURCHASE: 'PURCHASE',
SALES: 'SALES',
ADJUSTMENT: 'ADJUSTMENT'
} as const
export type stock_movements_view_referenceType = (typeof stock_movements_view_referenceType)[keyof typeof stock_movements_view_referenceType]
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
@@ -60,7 +60,21 @@ export const ModelName = {
Supplier: 'Supplier', Supplier: 'Supplier',
Customer: 'Customer', Customer: 'Customer',
Inventory: 'Inventory', Inventory: 'Inventory',
Store: 'Store' Store: 'Store',
ProductCharge: 'ProductCharge',
Order: 'Order',
PurchaseReceipt: 'PurchaseReceipt',
PurchaseReceiptItem: 'PurchaseReceiptItem',
SalesInvoice: 'SalesInvoice',
SalesInvoiceItem: 'SalesInvoiceItem',
StockMovement: 'StockMovement',
StockBalance: 'StockBalance',
InventoryTransfer: 'InventoryTransfer',
InventoryTransferItem: 'InventoryTransferItem',
StockAdjustment: 'StockAdjustment',
inventory_overview: 'inventory_overview',
stock_cardex: 'stock_cardex',
stock_view: 'stock_view'
} as const } as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName] export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -85,7 +99,10 @@ export const UserScalarFieldEnum = {
password: 'password', password: 'password',
firstName: 'firstName', firstName: 'firstName',
lastName: 'lastName', lastName: 'lastName',
roleId: 'roleId' roleId: 'roleId',
createdAt: 'createdAt',
deletedAt: 'deletedAt',
updatedAt: 'updatedAt'
} as const } as const
export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]
@@ -129,9 +146,9 @@ export type ProductVariantScalarFieldEnum = (typeof ProductVariantScalarFieldEnu
export const ProductScalarFieldEnum = { export const ProductScalarFieldEnum = {
id: 'id', id: 'id',
name: 'name', name: 'name',
barcode: 'barcode',
sku: 'sku',
description: 'description', description: 'description',
sku: 'sku',
barcode: 'barcode',
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt', updatedAt: 'updatedAt',
deletedAt: 'deletedAt', deletedAt: 'deletedAt',
@@ -212,7 +229,8 @@ export const InventoryScalarFieldEnum = {
location: 'location', location: 'location',
isActive: 'isActive', isActive: 'isActive',
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt' updatedAt: 'updatedAt',
deletedAt: 'deletedAt'
} as const } as const
export type InventoryScalarFieldEnum = (typeof InventoryScalarFieldEnum)[keyof typeof InventoryScalarFieldEnum] export type InventoryScalarFieldEnum = (typeof InventoryScalarFieldEnum)[keyof typeof InventoryScalarFieldEnum]
@@ -224,12 +242,196 @@ export const StoreScalarFieldEnum = {
location: 'location', location: 'location',
isActive: 'isActive', isActive: 'isActive',
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt' updatedAt: 'updatedAt',
deletedAt: 'deletedAt'
} as const } as const
export type StoreScalarFieldEnum = (typeof StoreScalarFieldEnum)[keyof typeof StoreScalarFieldEnum] export type StoreScalarFieldEnum = (typeof StoreScalarFieldEnum)[keyof typeof StoreScalarFieldEnum]
export const ProductChargeScalarFieldEnum = {
id: 'id',
count: 'count',
fee: 'fee',
totalAmount: 'totalAmount',
isSettled: 'isSettled',
buyAt: 'buyAt',
description: 'description',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
deletedAt: 'deletedAt',
productId: 'productId',
inventoryId: 'inventoryId',
supplierId: 'supplierId'
} as const
export type ProductChargeScalarFieldEnum = (typeof ProductChargeScalarFieldEnum)[keyof typeof ProductChargeScalarFieldEnum]
export const OrderScalarFieldEnum = {
id: 'id',
orderNumber: 'orderNumber',
status: 'status',
paymentMethod: 'paymentMethod',
totalAmount: 'totalAmount',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
deletedAt: 'deletedAt',
customerId: 'customerId'
} as const
export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum]
export const PurchaseReceiptScalarFieldEnum = {
id: 'id',
code: 'code',
totalAmount: 'totalAmount',
description: 'description',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
supplierId: 'supplierId',
inventoryId: 'inventoryId'
} as const
export type PurchaseReceiptScalarFieldEnum = (typeof PurchaseReceiptScalarFieldEnum)[keyof typeof PurchaseReceiptScalarFieldEnum]
export const PurchaseReceiptItemScalarFieldEnum = {
id: 'id',
count: 'count',
fee: 'fee',
total: 'total',
createdAt: 'createdAt',
receiptId: 'receiptId',
productId: 'productId'
} as const
export type PurchaseReceiptItemScalarFieldEnum = (typeof PurchaseReceiptItemScalarFieldEnum)[keyof typeof PurchaseReceiptItemScalarFieldEnum]
export const SalesInvoiceScalarFieldEnum = {
id: 'id',
code: 'code',
totalAmount: 'totalAmount',
description: 'description',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
customerId: 'customerId'
} as const
export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum]
export const SalesInvoiceItemScalarFieldEnum = {
id: 'id',
count: 'count',
fee: 'fee',
total: 'total',
createdAt: 'createdAt',
invoiceId: 'invoiceId',
productId: 'productId'
} as const
export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum]
export const StockMovementScalarFieldEnum = {
id: 'id',
type: 'type',
quantity: 'quantity',
fee: 'fee',
totalCost: 'totalCost',
referenceType: 'referenceType',
referenceId: 'referenceId',
createdAt: 'createdAt',
productId: 'productId',
inventoryId: 'inventoryId',
avgCost: 'avgCost'
} as const
export type StockMovementScalarFieldEnum = (typeof StockMovementScalarFieldEnum)[keyof typeof StockMovementScalarFieldEnum]
export const StockBalanceScalarFieldEnum = {
quantity: 'quantity',
totalCost: 'totalCost',
updatedAt: 'updatedAt',
ProductId: 'ProductId',
avgCost: 'avgCost'
} as const
export type StockBalanceScalarFieldEnum = (typeof StockBalanceScalarFieldEnum)[keyof typeof StockBalanceScalarFieldEnum]
export const InventoryTransferScalarFieldEnum = {
id: 'id',
code: 'code',
description: 'description',
createdAt: 'createdAt',
fromInventoryId: 'fromInventoryId',
toInventoryId: 'toInventoryId'
} as const
export type InventoryTransferScalarFieldEnum = (typeof InventoryTransferScalarFieldEnum)[keyof typeof InventoryTransferScalarFieldEnum]
export const InventoryTransferItemScalarFieldEnum = {
id: 'id',
count: 'count',
productId: 'productId',
transferId: 'transferId'
} as const
export type InventoryTransferItemScalarFieldEnum = (typeof InventoryTransferItemScalarFieldEnum)[keyof typeof InventoryTransferItemScalarFieldEnum]
export const StockAdjustmentScalarFieldEnum = {
id: 'id',
adjustedQuantity: 'adjustedQuantity',
createdAt: 'createdAt',
productId: 'productId',
inventoryId: 'inventoryId'
} as const
export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldEnum)[keyof typeof StockAdjustmentScalarFieldEnum]
export const Inventory_overviewScalarFieldEnum = {
ProductId: 'ProductId',
stock_quantity: 'stock_quantity',
avgCost: 'avgCost',
totalCost: 'totalCost',
updatedAt: 'updatedAt'
} as const
export type Inventory_overviewScalarFieldEnum = (typeof Inventory_overviewScalarFieldEnum)[keyof typeof Inventory_overviewScalarFieldEnum]
export const Stock_cardexScalarFieldEnum = {
productId: 'productId',
movement_id: 'movement_id',
type: 'type',
quantity: 'quantity',
fee: 'fee',
totalCost: 'totalCost',
balance_quantity: 'balance_quantity',
balance_avg_cost: 'balance_avg_cost',
createdAt: 'createdAt'
} as const
export type Stock_cardexScalarFieldEnum = (typeof Stock_cardexScalarFieldEnum)[keyof typeof Stock_cardexScalarFieldEnum]
export const Stock_viewScalarFieldEnum = {
productId: 'productId',
inventoryId: 'inventoryId',
stock: 'stock'
} as const
export type Stock_viewScalarFieldEnum = (typeof Stock_viewScalarFieldEnum)[keyof typeof Stock_viewScalarFieldEnum]
export const SortOrder = { export const SortOrder = {
asc: 'asc', asc: 'asc',
desc: 'desc' desc: 'desc'
@@ -246,6 +448,14 @@ export const NullableJsonNullValueInput = {
export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput] export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput]
export const NullsOrder = {
first: 'first',
last: 'last'
} as const
export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder]
export const UserOrderByRelevanceFieldEnum = { export const UserOrderByRelevanceFieldEnum = {
mobileNumber: 'mobileNumber', mobileNumber: 'mobileNumber',
password: 'password', password: 'password',
@@ -273,14 +483,6 @@ export const QueryMode = {
export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode]
export const NullsOrder = {
first: 'first',
last: 'last'
} as const
export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder]
export const RoleOrderByRelevanceFieldEnum = { export const RoleOrderByRelevanceFieldEnum = {
name: 'name', name: 'name',
description: 'description' description: 'description'
@@ -302,9 +504,9 @@ export type ProductVariantOrderByRelevanceFieldEnum = (typeof ProductVariantOrde
export const ProductOrderByRelevanceFieldEnum = { export const ProductOrderByRelevanceFieldEnum = {
name: 'name', name: 'name',
barcode: 'barcode', description: 'description',
sku: 'sku', sku: 'sku',
description: 'description' barcode: 'barcode'
} as const } as const
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum] export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
@@ -371,3 +573,48 @@ export const StoreOrderByRelevanceFieldEnum = {
export type StoreOrderByRelevanceFieldEnum = (typeof StoreOrderByRelevanceFieldEnum)[keyof typeof StoreOrderByRelevanceFieldEnum] export type StoreOrderByRelevanceFieldEnum = (typeof StoreOrderByRelevanceFieldEnum)[keyof typeof StoreOrderByRelevanceFieldEnum]
export const ProductChargeOrderByRelevanceFieldEnum = {
description: 'description'
} as const
export type ProductChargeOrderByRelevanceFieldEnum = (typeof ProductChargeOrderByRelevanceFieldEnum)[keyof typeof ProductChargeOrderByRelevanceFieldEnum]
export const OrderOrderByRelevanceFieldEnum = {
orderNumber: 'orderNumber'
} as const
export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum]
export const PurchaseReceiptOrderByRelevanceFieldEnum = {
code: 'code',
description: 'description'
} as const
export type PurchaseReceiptOrderByRelevanceFieldEnum = (typeof PurchaseReceiptOrderByRelevanceFieldEnum)[keyof typeof PurchaseReceiptOrderByRelevanceFieldEnum]
export const SalesInvoiceOrderByRelevanceFieldEnum = {
code: 'code',
description: 'description'
} as const
export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum]
export const StockMovementOrderByRelevanceFieldEnum = {
referenceId: 'referenceId'
} as const
export type StockMovementOrderByRelevanceFieldEnum = (typeof StockMovementOrderByRelevanceFieldEnum)[keyof typeof StockMovementOrderByRelevanceFieldEnum]
export const InventoryTransferOrderByRelevanceFieldEnum = {
code: 'code',
description: 'description'
} as const
export type InventoryTransferOrderByRelevanceFieldEnum = (typeof InventoryTransferOrderByRelevanceFieldEnum)[keyof typeof InventoryTransferOrderByRelevanceFieldEnum]
+14
View File
@@ -18,4 +18,18 @@ export type * from './models/Supplier.js'
export type * from './models/Customer.js' export type * from './models/Customer.js'
export type * from './models/Inventory.js' export type * from './models/Inventory.js'
export type * from './models/Store.js' export type * from './models/Store.js'
export type * from './models/ProductCharge.js'
export type * from './models/Order.js'
export type * from './models/PurchaseReceipt.js'
export type * from './models/PurchaseReceiptItem.js'
export type * from './models/SalesInvoice.js'
export type * from './models/SalesInvoiceItem.js'
export type * from './models/StockMovement.js'
export type * from './models/StockBalance.js'
export type * from './models/InventoryTransfer.js'
export type * from './models/InventoryTransferItem.js'
export type * from './models/StockAdjustment.js'
export type * from './models/inventory_overview.js'
export type * from './models/stock_cardex.js'
export type * from './models/stock_view.js'
export type * from './commonInputTypes.js' export type * from './commonInputTypes.js'
+386 -29
View File
@@ -238,8 +238,8 @@ export type CustomerGroupByOutputType = {
state: string | null state: string | null
country: string | null country: string | null
isActive: boolean isActive: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
_count: CustomerCountAggregateOutputType | null _count: CustomerCountAggregateOutputType | null
_avg: CustomerAvgAggregateOutputType | null _avg: CustomerAvgAggregateOutputType | null
@@ -277,9 +277,11 @@ export type CustomerWhereInput = {
state?: Prisma.StringNullableFilter<"Customer"> | string | null state?: Prisma.StringNullableFilter<"Customer"> | string | null
country?: Prisma.StringNullableFilter<"Customer"> | string | null country?: Prisma.StringNullableFilter<"Customer"> | string | null
isActive?: Prisma.BoolFilter<"Customer"> | boolean isActive?: Prisma.BoolFilter<"Customer"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"Customer"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"Customer"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null
orders?: Prisma.OrderListRelationFilter
salesInvoices?: Prisma.SalesInvoiceListRelationFilter
} }
export type CustomerOrderByWithRelationInput = { export type CustomerOrderByWithRelationInput = {
@@ -293,9 +295,11 @@ export type CustomerOrderByWithRelationInput = {
state?: Prisma.SortOrderInput | Prisma.SortOrder state?: Prisma.SortOrderInput | Prisma.SortOrder
country?: Prisma.SortOrderInput | Prisma.SortOrder country?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
orders?: Prisma.OrderOrderByRelationAggregateInput
salesInvoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput
_relevance?: Prisma.CustomerOrderByRelevanceInput _relevance?: Prisma.CustomerOrderByRelevanceInput
} }
@@ -313,9 +317,11 @@ export type CustomerWhereUniqueInput = Prisma.AtLeast<{
state?: Prisma.StringNullableFilter<"Customer"> | string | null state?: Prisma.StringNullableFilter<"Customer"> | string | null
country?: Prisma.StringNullableFilter<"Customer"> | string | null country?: Prisma.StringNullableFilter<"Customer"> | string | null
isActive?: Prisma.BoolFilter<"Customer"> | boolean isActive?: Prisma.BoolFilter<"Customer"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"Customer"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"Customer"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null
orders?: Prisma.OrderListRelationFilter
salesInvoices?: Prisma.SalesInvoiceListRelationFilter
}, "id" | "mobileNumber"> }, "id" | "mobileNumber">
export type CustomerOrderByWithAggregationInput = { export type CustomerOrderByWithAggregationInput = {
@@ -329,8 +335,8 @@ export type CustomerOrderByWithAggregationInput = {
state?: Prisma.SortOrderInput | Prisma.SortOrder state?: Prisma.SortOrderInput | Prisma.SortOrder
country?: Prisma.SortOrderInput | Prisma.SortOrder country?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.CustomerCountOrderByAggregateInput _count?: Prisma.CustomerCountOrderByAggregateInput
_avg?: Prisma.CustomerAvgOrderByAggregateInput _avg?: Prisma.CustomerAvgOrderByAggregateInput
@@ -353,8 +359,8 @@ export type CustomerScalarWhereWithAggregatesInput = {
state?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null state?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null
country?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null country?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null
isActive?: Prisma.BoolWithAggregatesFilter<"Customer"> | boolean isActive?: Prisma.BoolWithAggregatesFilter<"Customer"> | boolean
createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Customer"> | Date | string | null createdAt?: Prisma.DateTimeWithAggregatesFilter<"Customer"> | Date | string
updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Customer"> | Date | string | null updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Customer"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Customer"> | Date | string | null deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Customer"> | Date | string | null
} }
@@ -368,9 +374,11 @@ export type CustomerCreateInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput
salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput
} }
export type CustomerUncheckedCreateInput = { export type CustomerUncheckedCreateInput = {
@@ -384,9 +392,11 @@ export type CustomerUncheckedCreateInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput
salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput
} }
export type CustomerUpdateInput = { export type CustomerUpdateInput = {
@@ -399,9 +409,11 @@ export type CustomerUpdateInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput
salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput
} }
export type CustomerUncheckedUpdateInput = { export type CustomerUncheckedUpdateInput = {
@@ -415,9 +427,11 @@ export type CustomerUncheckedUpdateInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput
salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput
} }
export type CustomerCreateManyInput = { export type CustomerCreateManyInput = {
@@ -431,8 +445,8 @@ export type CustomerCreateManyInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
} }
@@ -446,8 +460,8 @@ export type CustomerUpdateManyMutationInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -462,8 +476,8 @@ export type CustomerUncheckedUpdateManyInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -529,6 +543,248 @@ export type CustomerSumOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
} }
export type CustomerScalarRelationFilter = {
is?: Prisma.CustomerWhereInput
isNot?: Prisma.CustomerWhereInput
}
export type CustomerNullableScalarRelationFilter = {
is?: Prisma.CustomerWhereInput | null
isNot?: Prisma.CustomerWhereInput | null
}
export type CustomerCreateNestedOneWithoutOrdersInput = {
create?: Prisma.XOR<Prisma.CustomerCreateWithoutOrdersInput, Prisma.CustomerUncheckedCreateWithoutOrdersInput>
connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutOrdersInput
connect?: Prisma.CustomerWhereUniqueInput
}
export type CustomerUpdateOneRequiredWithoutOrdersNestedInput = {
create?: Prisma.XOR<Prisma.CustomerCreateWithoutOrdersInput, Prisma.CustomerUncheckedCreateWithoutOrdersInput>
connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutOrdersInput
upsert?: Prisma.CustomerUpsertWithoutOrdersInput
connect?: Prisma.CustomerWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.CustomerUpdateToOneWithWhereWithoutOrdersInput, Prisma.CustomerUpdateWithoutOrdersInput>, Prisma.CustomerUncheckedUpdateWithoutOrdersInput>
}
export type CustomerCreateNestedOneWithoutSalesInvoicesInput = {
create?: Prisma.XOR<Prisma.CustomerCreateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedCreateWithoutSalesInvoicesInput>
connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutSalesInvoicesInput
connect?: Prisma.CustomerWhereUniqueInput
}
export type CustomerUpdateOneWithoutSalesInvoicesNestedInput = {
create?: Prisma.XOR<Prisma.CustomerCreateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedCreateWithoutSalesInvoicesInput>
connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutSalesInvoicesInput
upsert?: Prisma.CustomerUpsertWithoutSalesInvoicesInput
disconnect?: Prisma.CustomerWhereInput | boolean
delete?: Prisma.CustomerWhereInput | boolean
connect?: Prisma.CustomerWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.CustomerUpdateToOneWithWhereWithoutSalesInvoicesInput, Prisma.CustomerUpdateWithoutSalesInvoicesInput>, Prisma.CustomerUncheckedUpdateWithoutSalesInvoicesInput>
}
export type CustomerCreateWithoutOrdersInput = {
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput
}
export type CustomerUncheckedCreateWithoutOrdersInput = {
id?: number
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput
}
export type CustomerCreateOrConnectWithoutOrdersInput = {
where: Prisma.CustomerWhereUniqueInput
create: Prisma.XOR<Prisma.CustomerCreateWithoutOrdersInput, Prisma.CustomerUncheckedCreateWithoutOrdersInput>
}
export type CustomerUpsertWithoutOrdersInput = {
update: Prisma.XOR<Prisma.CustomerUpdateWithoutOrdersInput, Prisma.CustomerUncheckedUpdateWithoutOrdersInput>
create: Prisma.XOR<Prisma.CustomerCreateWithoutOrdersInput, Prisma.CustomerUncheckedCreateWithoutOrdersInput>
where?: Prisma.CustomerWhereInput
}
export type CustomerUpdateToOneWithWhereWithoutOrdersInput = {
where?: Prisma.CustomerWhereInput
data: Prisma.XOR<Prisma.CustomerUpdateWithoutOrdersInput, Prisma.CustomerUncheckedUpdateWithoutOrdersInput>
}
export type CustomerUpdateWithoutOrdersInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
salesInvoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput
}
export type CustomerUncheckedUpdateWithoutOrdersInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
salesInvoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput
}
export type CustomerCreateWithoutSalesInvoicesInput = {
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
orders?: Prisma.OrderCreateNestedManyWithoutCustomerInput
}
export type CustomerUncheckedCreateWithoutSalesInvoicesInput = {
id?: number
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
orders?: Prisma.OrderUncheckedCreateNestedManyWithoutCustomerInput
}
export type CustomerCreateOrConnectWithoutSalesInvoicesInput = {
where: Prisma.CustomerWhereUniqueInput
create: Prisma.XOR<Prisma.CustomerCreateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedCreateWithoutSalesInvoicesInput>
}
export type CustomerUpsertWithoutSalesInvoicesInput = {
update: Prisma.XOR<Prisma.CustomerUpdateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedUpdateWithoutSalesInvoicesInput>
create: Prisma.XOR<Prisma.CustomerCreateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedCreateWithoutSalesInvoicesInput>
where?: Prisma.CustomerWhereInput
}
export type CustomerUpdateToOneWithWhereWithoutSalesInvoicesInput = {
where?: Prisma.CustomerWhereInput
data: Prisma.XOR<Prisma.CustomerUpdateWithoutSalesInvoicesInput, Prisma.CustomerUncheckedUpdateWithoutSalesInvoicesInput>
}
export type CustomerUpdateWithoutSalesInvoicesInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
orders?: Prisma.OrderUpdateManyWithoutCustomerNestedInput
}
export type CustomerUncheckedUpdateWithoutSalesInvoicesInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
orders?: Prisma.OrderUncheckedUpdateManyWithoutCustomerNestedInput
}
/**
* Count Type CustomerCountOutputType
*/
export type CustomerCountOutputType = {
orders: number
salesInvoices: number
}
export type CustomerCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
orders?: boolean | CustomerCountOutputTypeCountOrdersArgs
salesInvoices?: boolean | CustomerCountOutputTypeCountSalesInvoicesArgs
}
/**
* CustomerCountOutputType without action
*/
export type CustomerCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the CustomerCountOutputType
*/
select?: Prisma.CustomerCountOutputTypeSelect<ExtArgs> | null
}
/**
* CustomerCountOutputType without action
*/
export type CustomerCountOutputTypeCountOrdersArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.OrderWhereInput
}
/**
* CustomerCountOutputType without action
*/
export type CustomerCountOutputTypeCountSalesInvoicesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.SalesInvoiceWhereInput
}
export type CustomerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type CustomerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
@@ -545,6 +801,9 @@ export type CustomerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean deletedAt?: boolean
orders?: boolean | Prisma.Customer$ordersArgs<ExtArgs>
salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs<ExtArgs>
_count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["customer"]> }, ExtArgs["result"]["customer"]>
@@ -566,10 +825,18 @@ export type CustomerSelectScalar = {
} }
export type CustomerOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["customer"]> export type CustomerOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["customer"]>
export type CustomerInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
orders?: boolean | Prisma.Customer$ordersArgs<ExtArgs>
salesInvoices?: boolean | Prisma.Customer$salesInvoicesArgs<ExtArgs>
_count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs<ExtArgs>
}
export type $CustomerPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type $CustomerPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "Customer" name: "Customer"
objects: {} objects: {
orders: Prisma.$OrderPayload<ExtArgs>[]
salesInvoices: Prisma.$SalesInvoicePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: number id: number
firstName: string firstName: string
@@ -581,8 +848,8 @@ export type $CustomerPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
state: string | null state: string | null
country: string | null country: string | null
isActive: boolean isActive: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
}, ExtArgs["result"]["customer"]> }, ExtArgs["result"]["customer"]>
composites: {} composites: {}
@@ -924,6 +1191,8 @@ readonly fields: CustomerFieldRefs;
*/ */
export interface Prisma__CustomerClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> { export interface Prisma__CustomerClient<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"
orders<T extends Prisma.Customer$ordersArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Customer$ordersArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OrderPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
salesInvoices<T extends Prisma.Customer$salesInvoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Customer$salesInvoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<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.
@@ -982,6 +1251,10 @@ export type CustomerFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.Inte
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter, which Customer to fetch. * Filter, which Customer to fetch.
*/ */
@@ -1000,6 +1273,10 @@ export type CustomerFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Extensio
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter, which Customer to fetch. * Filter, which Customer to fetch.
*/ */
@@ -1018,6 +1295,10 @@ export type CustomerFindFirstArgs<ExtArgs extends runtime.Types.Extensions.Inter
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter, which Customer to fetch. * Filter, which Customer to fetch.
*/ */
@@ -1066,6 +1347,10 @@ export type CustomerFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extension
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter, which Customer to fetch. * Filter, which Customer to fetch.
*/ */
@@ -1114,6 +1399,10 @@ export type CustomerFindManyArgs<ExtArgs extends runtime.Types.Extensions.Intern
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter, which Customers to fetch. * Filter, which Customers to fetch.
*/ */
@@ -1157,6 +1446,10 @@ export type CustomerCreateArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* The data needed to create a Customer. * The data needed to create a Customer.
*/ */
@@ -1186,6 +1479,10 @@ export type CustomerUpdateArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* The data needed to update a Customer. * The data needed to update a Customer.
*/ */
@@ -1226,6 +1523,10 @@ export type CustomerUpsertArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* The filter to search for the Customer to update in case it exists. * The filter to search for the Customer to update in case it exists.
*/ */
@@ -1252,6 +1553,10 @@ export type CustomerDeleteArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
/** /**
* Filter which Customer to delete. * Filter which Customer to delete.
*/ */
@@ -1272,6 +1577,54 @@ export type CustomerDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inte
limit?: number limit?: number
} }
/**
* Customer.orders
*/
export type Customer$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[]
}
/**
* Customer.salesInvoices
*/
export type Customer$salesInvoicesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the SalesInvoice
*/
select?: Prisma.SalesInvoiceSelect<ExtArgs> | null
/**
* Omit specific fields from the SalesInvoice
*/
omit?: Prisma.SalesInvoiceOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SalesInvoiceInclude<ExtArgs> | null
where?: Prisma.SalesInvoiceWhereInput
orderBy?: Prisma.SalesInvoiceOrderByWithRelationInput | Prisma.SalesInvoiceOrderByWithRelationInput[]
cursor?: Prisma.SalesInvoiceWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.SalesInvoiceScalarFieldEnum | Prisma.SalesInvoiceScalarFieldEnum[]
}
/** /**
* Customer without action * Customer without action
*/ */
@@ -1284,4 +1637,8 @@ export type CustomerDefaultArgs<ExtArgs extends runtime.Types.Extensions.Interna
* Omit specific fields from the Customer * Omit specific fields from the Customer
*/ */
omit?: Prisma.CustomerOmit<ExtArgs> | null omit?: Prisma.CustomerOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.CustomerInclude<ExtArgs> | null
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+42 -42
View File
@@ -278,8 +278,8 @@ export type ProductVariantGroupByOutputType = {
alertQuantity: runtime.Decimal | null alertQuantity: runtime.Decimal | null
isActive: boolean isActive: boolean
isFeatured: boolean isFeatured: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
productId: number productId: number
_count: ProductVariantCountAggregateOutputType | null _count: ProductVariantCountAggregateOutputType | null
@@ -320,8 +320,8 @@ export type ProductVariantWhereInput = {
alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean
isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null
productId?: Prisma.IntFilter<"ProductVariant"> | number productId?: Prisma.IntFilter<"ProductVariant"> | number
product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput> product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput>
@@ -340,8 +340,8 @@ export type ProductVariantOrderByWithRelationInput = {
alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
isFeatured?: Prisma.SortOrder isFeatured?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
product?: Prisma.ProductOrderByWithRelationInput product?: Prisma.ProductOrderByWithRelationInput
@@ -364,8 +364,8 @@ export type ProductVariantWhereUniqueInput = Prisma.AtLeast<{
alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean
isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null
productId?: Prisma.IntFilter<"ProductVariant"> | number productId?: Prisma.IntFilter<"ProductVariant"> | number
product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput> product?: Prisma.XOR<Prisma.ProductScalarRelationFilter, Prisma.ProductWhereInput>
@@ -384,8 +384,8 @@ export type ProductVariantOrderByWithAggregationInput = {
alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
isFeatured?: Prisma.SortOrder isFeatured?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
productId?: Prisma.SortOrder productId?: Prisma.SortOrder
_count?: Prisma.ProductVariantCountOrderByAggregateInput _count?: Prisma.ProductVariantCountOrderByAggregateInput
@@ -411,8 +411,8 @@ export type ProductVariantScalarWhereWithAggregatesInput = {
alertQuantity?: Prisma.DecimalNullableWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.DecimalNullableWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean isActive?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean
isFeatured?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean isFeatured?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean
createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null createdAt?: Prisma.DateTimeWithAggregatesFilter<"ProductVariant"> | Date | string
updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null updatedAt?: Prisma.DateTimeWithAggregatesFilter<"ProductVariant"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null
productId?: Prisma.IntWithAggregatesFilter<"ProductVariant"> | number productId?: Prisma.IntWithAggregatesFilter<"ProductVariant"> | number
} }
@@ -429,8 +429,8 @@ export type ProductVariantCreateInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
product: Prisma.ProductCreateNestedOneWithoutVariantsInput product: Prisma.ProductCreateNestedOneWithoutVariantsInput
} }
@@ -448,8 +448,8 @@ export type ProductVariantUncheckedCreateInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
productId: number productId: number
} }
@@ -466,8 +466,8 @@ export type ProductVariantUpdateInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
product?: Prisma.ProductUpdateOneRequiredWithoutVariantsNestedInput product?: Prisma.ProductUpdateOneRequiredWithoutVariantsNestedInput
} }
@@ -485,8 +485,8 @@ export type ProductVariantUncheckedUpdateInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
} }
@@ -504,8 +504,8 @@ export type ProductVariantCreateManyInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
productId: number productId: number
} }
@@ -522,8 +522,8 @@ export type ProductVariantUpdateManyMutationInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -540,8 +540,8 @@ export type ProductVariantUncheckedUpdateManyInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productId?: Prisma.IntFieldUpdateOperationsInput | number productId?: Prisma.IntFieldUpdateOperationsInput | number
} }
@@ -711,8 +711,8 @@ export type ProductVariantCreateWithoutProductInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
} }
@@ -729,8 +729,8 @@ export type ProductVariantUncheckedCreateWithoutProductInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
} }
@@ -776,8 +776,8 @@ export type ProductVariantScalarWhereInput = {
alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean
isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"ProductVariant"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null
productId?: Prisma.IntFilter<"ProductVariant"> | number productId?: Prisma.IntFilter<"ProductVariant"> | number
} }
@@ -795,8 +795,8 @@ export type ProductVariantCreateManyProductInput = {
alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: boolean isActive?: boolean
isFeatured?: boolean isFeatured?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
} }
@@ -812,8 +812,8 @@ export type ProductVariantUpdateWithoutProductInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -830,8 +830,8 @@ export type ProductVariantUncheckedUpdateWithoutProductInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -848,8 +848,8 @@ export type ProductVariantUncheckedUpdateManyWithoutProductInput = {
alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -919,8 +919,8 @@ export type $ProductVariantPayload<ExtArgs extends runtime.Types.Extensions.Inte
alertQuantity: runtime.Decimal | null alertQuantity: runtime.Decimal | null
isActive: boolean isActive: boolean
isFeatured: boolean isFeatured: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
productId: number productId: number
}, ExtArgs["result"]["productVariant"]> }, ExtArgs["result"]["productVariant"]>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-8
View File
@@ -421,14 +421,6 @@ export type NullableStringFieldUpdateOperationsInput = {
set?: string | null set?: string | null
} }
export type DateTimeFieldUpdateOperationsInput = {
set?: Date | string
}
export type NullableDateTimeFieldUpdateOperationsInput = {
set?: Date | string | null
}
export type RoleCreateWithoutUsersInput = { export type RoleCreateWithoutUsersInput = {
name: string name: string
description?: string | null description?: string | null
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+33 -7
View File
@@ -41,6 +41,7 @@ export type StoreMinAggregateOutputType = {
isActive: boolean | null isActive: boolean | null
createdAt: Date | null createdAt: Date | null
updatedAt: Date | null updatedAt: Date | null
deletedAt: Date | null
} }
export type StoreMaxAggregateOutputType = { export type StoreMaxAggregateOutputType = {
@@ -50,6 +51,7 @@ export type StoreMaxAggregateOutputType = {
isActive: boolean | null isActive: boolean | null
createdAt: Date | null createdAt: Date | null
updatedAt: Date | null updatedAt: Date | null
deletedAt: Date | null
} }
export type StoreCountAggregateOutputType = { export type StoreCountAggregateOutputType = {
@@ -59,6 +61,7 @@ export type StoreCountAggregateOutputType = {
isActive: number isActive: number
createdAt: number createdAt: number
updatedAt: number updatedAt: number
deletedAt: number
_all: number _all: number
} }
@@ -78,6 +81,7 @@ export type StoreMinAggregateInputType = {
isActive?: true isActive?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
deletedAt?: true
} }
export type StoreMaxAggregateInputType = { export type StoreMaxAggregateInputType = {
@@ -87,6 +91,7 @@ export type StoreMaxAggregateInputType = {
isActive?: true isActive?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
deletedAt?: true
} }
export type StoreCountAggregateInputType = { export type StoreCountAggregateInputType = {
@@ -96,6 +101,7 @@ export type StoreCountAggregateInputType = {
isActive?: true isActive?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
deletedAt?: true
_all?: true _all?: true
} }
@@ -192,6 +198,7 @@ export type StoreGroupByOutputType = {
isActive: boolean isActive: boolean
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
deletedAt: Date | null
_count: StoreCountAggregateOutputType | null _count: StoreCountAggregateOutputType | null
_avg: StoreAvgAggregateOutputType | null _avg: StoreAvgAggregateOutputType | null
_sum: StoreSumAggregateOutputType | null _sum: StoreSumAggregateOutputType | null
@@ -224,6 +231,7 @@ export type StoreWhereInput = {
isActive?: Prisma.BoolFilter<"Store"> | boolean isActive?: Prisma.BoolFilter<"Store"> | boolean
createdAt?: Prisma.DateTimeFilter<"Store"> | Date | string createdAt?: Prisma.DateTimeFilter<"Store"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Store"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Store"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Store"> | Date | string | null
} }
export type StoreOrderByWithRelationInput = { export type StoreOrderByWithRelationInput = {
@@ -233,6 +241,7 @@ export type StoreOrderByWithRelationInput = {
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
_relevance?: Prisma.StoreOrderByRelevanceInput _relevance?: Prisma.StoreOrderByRelevanceInput
} }
@@ -246,6 +255,7 @@ export type StoreWhereUniqueInput = Prisma.AtLeast<{
isActive?: Prisma.BoolFilter<"Store"> | boolean isActive?: Prisma.BoolFilter<"Store"> | boolean
createdAt?: Prisma.DateTimeFilter<"Store"> | Date | string createdAt?: Prisma.DateTimeFilter<"Store"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Store"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Store"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Store"> | Date | string | null
}, "id"> }, "id">
export type StoreOrderByWithAggregationInput = { export type StoreOrderByWithAggregationInput = {
@@ -255,6 +265,7 @@ export type StoreOrderByWithAggregationInput = {
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.StoreCountOrderByAggregateInput _count?: Prisma.StoreCountOrderByAggregateInput
_avg?: Prisma.StoreAvgOrderByAggregateInput _avg?: Prisma.StoreAvgOrderByAggregateInput
_max?: Prisma.StoreMaxOrderByAggregateInput _max?: Prisma.StoreMaxOrderByAggregateInput
@@ -272,14 +283,16 @@ export type StoreScalarWhereWithAggregatesInput = {
isActive?: Prisma.BoolWithAggregatesFilter<"Store"> | boolean isActive?: Prisma.BoolWithAggregatesFilter<"Store"> | boolean
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Store"> | Date | string createdAt?: Prisma.DateTimeWithAggregatesFilter<"Store"> | Date | string
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Store"> | Date | string updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Store"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Store"> | Date | string | null
} }
export type StoreCreateInput = { export type StoreCreateInput = {
name: string name: string
location?: string | null location?: string | null
isActive?: boolean isActive?: boolean
createdAt: Date | string createdAt?: Date | string
updatedAt: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null
} }
export type StoreUncheckedCreateInput = { export type StoreUncheckedCreateInput = {
@@ -287,8 +300,9 @@ export type StoreUncheckedCreateInput = {
name: string name: string
location?: string | null location?: string | null
isActive?: boolean isActive?: boolean
createdAt: Date | string createdAt?: Date | string
updatedAt: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null
} }
export type StoreUpdateInput = { export type StoreUpdateInput = {
@@ -297,6 +311,7 @@ export type StoreUpdateInput = {
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
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
} }
export type StoreUncheckedUpdateInput = { export type StoreUncheckedUpdateInput = {
@@ -306,6 +321,7 @@ export type StoreUncheckedUpdateInput = {
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
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
} }
export type StoreCreateManyInput = { export type StoreCreateManyInput = {
@@ -313,8 +329,9 @@ export type StoreCreateManyInput = {
name: string name: string
location?: string | null location?: string | null
isActive?: boolean isActive?: boolean
createdAt: Date | string createdAt?: Date | string
updatedAt: Date | string updatedAt?: Date | string
deletedAt?: Date | string | null
} }
export type StoreUpdateManyMutationInput = { export type StoreUpdateManyMutationInput = {
@@ -323,6 +340,7 @@ export type StoreUpdateManyMutationInput = {
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
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
} }
export type StoreUncheckedUpdateManyInput = { export type StoreUncheckedUpdateManyInput = {
@@ -332,6 +350,7 @@ export type StoreUncheckedUpdateManyInput = {
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
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
} }
export type StoreOrderByRelevanceInput = { export type StoreOrderByRelevanceInput = {
@@ -347,6 +366,7 @@ export type StoreCountOrderByAggregateInput = {
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
} }
export type StoreAvgOrderByAggregateInput = { export type StoreAvgOrderByAggregateInput = {
@@ -360,6 +380,7 @@ export type StoreMaxOrderByAggregateInput = {
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
} }
export type StoreMinOrderByAggregateInput = { export type StoreMinOrderByAggregateInput = {
@@ -369,6 +390,7 @@ export type StoreMinOrderByAggregateInput = {
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
} }
export type StoreSumOrderByAggregateInput = { export type StoreSumOrderByAggregateInput = {
@@ -384,6 +406,7 @@ export type StoreSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
isActive?: boolean isActive?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean
}, ExtArgs["result"]["store"]> }, ExtArgs["result"]["store"]>
@@ -395,9 +418,10 @@ export type StoreSelectScalar = {
isActive?: boolean isActive?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean
} }
export type StoreOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "location" | "isActive" | "createdAt" | "updatedAt", ExtArgs["result"]["store"]> export type StoreOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "location" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["store"]>
export type $StorePayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type $StorePayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "Store" name: "Store"
@@ -409,6 +433,7 @@ export type $StorePayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
isActive: boolean isActive: boolean
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
deletedAt: Date | null
}, ExtArgs["result"]["store"]> }, ExtArgs["result"]["store"]>
composites: {} composites: {}
} }
@@ -784,6 +809,7 @@ export interface StoreFieldRefs {
readonly isActive: Prisma.FieldRef<"Store", 'Boolean'> readonly isActive: Prisma.FieldRef<"Store", 'Boolean'>
readonly createdAt: Prisma.FieldRef<"Store", 'DateTime'> readonly createdAt: Prisma.FieldRef<"Store", 'DateTime'>
readonly updatedAt: Prisma.FieldRef<"Store", 'DateTime'> readonly updatedAt: Prisma.FieldRef<"Store", 'DateTime'>
readonly deletedAt: Prisma.FieldRef<"Store", 'DateTime'>
} }
+379 -29
View File
@@ -238,8 +238,8 @@ export type SupplierGroupByOutputType = {
state: string | null state: string | null
country: string | null country: string | null
isActive: boolean isActive: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
_count: SupplierCountAggregateOutputType | null _count: SupplierCountAggregateOutputType | null
_avg: SupplierAvgAggregateOutputType | null _avg: SupplierAvgAggregateOutputType | null
@@ -277,9 +277,11 @@ export type SupplierWhereInput = {
state?: Prisma.StringNullableFilter<"Supplier"> | string | null state?: Prisma.StringNullableFilter<"Supplier"> | string | null
country?: Prisma.StringNullableFilter<"Supplier"> | string | null country?: Prisma.StringNullableFilter<"Supplier"> | string | null
isActive?: Prisma.BoolFilter<"Supplier"> | boolean isActive?: Prisma.BoolFilter<"Supplier"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"Supplier"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"Supplier"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
productCharges?: Prisma.ProductChargeListRelationFilter
purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter
} }
export type SupplierOrderByWithRelationInput = { export type SupplierOrderByWithRelationInput = {
@@ -293,9 +295,11 @@ export type SupplierOrderByWithRelationInput = {
state?: Prisma.SortOrderInput | Prisma.SortOrder state?: Prisma.SortOrderInput | Prisma.SortOrder
country?: Prisma.SortOrderInput | Prisma.SortOrder country?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
productCharges?: Prisma.ProductChargeOrderByRelationAggregateInput
purchaseReceipts?: Prisma.PurchaseReceiptOrderByRelationAggregateInput
_relevance?: Prisma.SupplierOrderByRelevanceInput _relevance?: Prisma.SupplierOrderByRelevanceInput
} }
@@ -313,9 +317,11 @@ export type SupplierWhereUniqueInput = Prisma.AtLeast<{
state?: Prisma.StringNullableFilter<"Supplier"> | string | null state?: Prisma.StringNullableFilter<"Supplier"> | string | null
country?: Prisma.StringNullableFilter<"Supplier"> | string | null country?: Prisma.StringNullableFilter<"Supplier"> | string | null
isActive?: Prisma.BoolFilter<"Supplier"> | boolean isActive?: Prisma.BoolFilter<"Supplier"> | boolean
createdAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null createdAt?: Prisma.DateTimeFilter<"Supplier"> | Date | string
updatedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null updatedAt?: Prisma.DateTimeFilter<"Supplier"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
productCharges?: Prisma.ProductChargeListRelationFilter
purchaseReceipts?: Prisma.PurchaseReceiptListRelationFilter
}, "id" | "mobileNumber"> }, "id" | "mobileNumber">
export type SupplierOrderByWithAggregationInput = { export type SupplierOrderByWithAggregationInput = {
@@ -329,8 +335,8 @@ export type SupplierOrderByWithAggregationInput = {
state?: Prisma.SortOrderInput | Prisma.SortOrder state?: Prisma.SortOrderInput | Prisma.SortOrder
country?: Prisma.SortOrderInput | Prisma.SortOrder country?: Prisma.SortOrderInput | Prisma.SortOrder
isActive?: Prisma.SortOrder isActive?: Prisma.SortOrder
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder updatedAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.SupplierCountOrderByAggregateInput _count?: Prisma.SupplierCountOrderByAggregateInput
_avg?: Prisma.SupplierAvgOrderByAggregateInput _avg?: Prisma.SupplierAvgOrderByAggregateInput
@@ -353,8 +359,8 @@ export type SupplierScalarWhereWithAggregatesInput = {
state?: Prisma.StringNullableWithAggregatesFilter<"Supplier"> | string | null state?: Prisma.StringNullableWithAggregatesFilter<"Supplier"> | string | null
country?: Prisma.StringNullableWithAggregatesFilter<"Supplier"> | string | null country?: Prisma.StringNullableWithAggregatesFilter<"Supplier"> | string | null
isActive?: Prisma.BoolWithAggregatesFilter<"Supplier"> | boolean isActive?: Prisma.BoolWithAggregatesFilter<"Supplier"> | boolean
createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Supplier"> | Date | string | null createdAt?: Prisma.DateTimeWithAggregatesFilter<"Supplier"> | Date | string
updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Supplier"> | Date | string | null updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Supplier"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Supplier"> | Date | string | null deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Supplier"> | Date | string | null
} }
@@ -368,9 +374,11 @@ export type SupplierCreateInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
productCharges?: Prisma.ProductChargeCreateNestedManyWithoutSupplierInput
purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutSupplierInput
} }
export type SupplierUncheckedCreateInput = { export type SupplierUncheckedCreateInput = {
@@ -384,9 +392,11 @@ export type SupplierUncheckedCreateInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutSupplierInput
purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutSupplierInput
} }
export type SupplierUpdateInput = { export type SupplierUpdateInput = {
@@ -399,9 +409,11 @@ export type SupplierUpdateInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productCharges?: Prisma.ProductChargeUpdateManyWithoutSupplierNestedInput
purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutSupplierNestedInput
} }
export type SupplierUncheckedUpdateInput = { export type SupplierUncheckedUpdateInput = {
@@ -415,9 +427,11 @@ export type SupplierUncheckedUpdateInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutSupplierNestedInput
purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutSupplierNestedInput
} }
export type SupplierCreateManyInput = { export type SupplierCreateManyInput = {
@@ -431,8 +445,8 @@ export type SupplierCreateManyInput = {
state?: string | null state?: string | null
country?: string | null country?: string | null
isActive?: boolean isActive?: boolean
createdAt?: Date | string | null createdAt?: Date | string
updatedAt?: Date | string | null updatedAt?: Date | string
deletedAt?: Date | string | null deletedAt?: Date | string | null
} }
@@ -446,8 +460,8 @@ export type SupplierUpdateManyMutationInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -462,8 +476,8 @@ export type SupplierUncheckedUpdateManyInput = {
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
} }
@@ -529,6 +543,241 @@ export type SupplierSumOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
} }
export type SupplierScalarRelationFilter = {
is?: Prisma.SupplierWhereInput
isNot?: Prisma.SupplierWhereInput
}
export type SupplierCreateNestedOneWithoutProductChargesInput = {
create?: Prisma.XOR<Prisma.SupplierCreateWithoutProductChargesInput, Prisma.SupplierUncheckedCreateWithoutProductChargesInput>
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductChargesInput
connect?: Prisma.SupplierWhereUniqueInput
}
export type SupplierUpdateOneRequiredWithoutProductChargesNestedInput = {
create?: Prisma.XOR<Prisma.SupplierCreateWithoutProductChargesInput, Prisma.SupplierUncheckedCreateWithoutProductChargesInput>
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductChargesInput
upsert?: Prisma.SupplierUpsertWithoutProductChargesInput
connect?: Prisma.SupplierWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.SupplierUpdateToOneWithWhereWithoutProductChargesInput, Prisma.SupplierUpdateWithoutProductChargesInput>, Prisma.SupplierUncheckedUpdateWithoutProductChargesInput>
}
export type SupplierCreateNestedOneWithoutPurchaseReceiptsInput = {
create?: Prisma.XOR<Prisma.SupplierCreateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedCreateWithoutPurchaseReceiptsInput>
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutPurchaseReceiptsInput
connect?: Prisma.SupplierWhereUniqueInput
}
export type SupplierUpdateOneRequiredWithoutPurchaseReceiptsNestedInput = {
create?: Prisma.XOR<Prisma.SupplierCreateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedCreateWithoutPurchaseReceiptsInput>
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutPurchaseReceiptsInput
upsert?: Prisma.SupplierUpsertWithoutPurchaseReceiptsInput
connect?: Prisma.SupplierWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.SupplierUpdateToOneWithWhereWithoutPurchaseReceiptsInput, Prisma.SupplierUpdateWithoutPurchaseReceiptsInput>, Prisma.SupplierUncheckedUpdateWithoutPurchaseReceiptsInput>
}
export type SupplierCreateWithoutProductChargesInput = {
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
purchaseReceipts?: Prisma.PurchaseReceiptCreateNestedManyWithoutSupplierInput
}
export type SupplierUncheckedCreateWithoutProductChargesInput = {
id?: number
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
purchaseReceipts?: Prisma.PurchaseReceiptUncheckedCreateNestedManyWithoutSupplierInput
}
export type SupplierCreateOrConnectWithoutProductChargesInput = {
where: Prisma.SupplierWhereUniqueInput
create: Prisma.XOR<Prisma.SupplierCreateWithoutProductChargesInput, Prisma.SupplierUncheckedCreateWithoutProductChargesInput>
}
export type SupplierUpsertWithoutProductChargesInput = {
update: Prisma.XOR<Prisma.SupplierUpdateWithoutProductChargesInput, Prisma.SupplierUncheckedUpdateWithoutProductChargesInput>
create: Prisma.XOR<Prisma.SupplierCreateWithoutProductChargesInput, Prisma.SupplierUncheckedCreateWithoutProductChargesInput>
where?: Prisma.SupplierWhereInput
}
export type SupplierUpdateToOneWithWhereWithoutProductChargesInput = {
where?: Prisma.SupplierWhereInput
data: Prisma.XOR<Prisma.SupplierUpdateWithoutProductChargesInput, Prisma.SupplierUncheckedUpdateWithoutProductChargesInput>
}
export type SupplierUpdateWithoutProductChargesInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
purchaseReceipts?: Prisma.PurchaseReceiptUpdateManyWithoutSupplierNestedInput
}
export type SupplierUncheckedUpdateWithoutProductChargesInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
purchaseReceipts?: Prisma.PurchaseReceiptUncheckedUpdateManyWithoutSupplierNestedInput
}
export type SupplierCreateWithoutPurchaseReceiptsInput = {
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
productCharges?: Prisma.ProductChargeCreateNestedManyWithoutSupplierInput
}
export type SupplierUncheckedCreateWithoutPurchaseReceiptsInput = {
id?: number
firstName: string
lastName: string
email?: string | null
mobileNumber: string
address?: string | null
city?: string | null
state?: string | null
country?: string | null
isActive?: boolean
createdAt?: Date | string
updatedAt?: Date | string
deletedAt?: Date | string | null
productCharges?: Prisma.ProductChargeUncheckedCreateNestedManyWithoutSupplierInput
}
export type SupplierCreateOrConnectWithoutPurchaseReceiptsInput = {
where: Prisma.SupplierWhereUniqueInput
create: Prisma.XOR<Prisma.SupplierCreateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedCreateWithoutPurchaseReceiptsInput>
}
export type SupplierUpsertWithoutPurchaseReceiptsInput = {
update: Prisma.XOR<Prisma.SupplierUpdateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedUpdateWithoutPurchaseReceiptsInput>
create: Prisma.XOR<Prisma.SupplierCreateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedCreateWithoutPurchaseReceiptsInput>
where?: Prisma.SupplierWhereInput
}
export type SupplierUpdateToOneWithWhereWithoutPurchaseReceiptsInput = {
where?: Prisma.SupplierWhereInput
data: Prisma.XOR<Prisma.SupplierUpdateWithoutPurchaseReceiptsInput, Prisma.SupplierUncheckedUpdateWithoutPurchaseReceiptsInput>
}
export type SupplierUpdateWithoutPurchaseReceiptsInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productCharges?: Prisma.ProductChargeUpdateManyWithoutSupplierNestedInput
}
export type SupplierUncheckedUpdateWithoutPurchaseReceiptsInput = {
id?: Prisma.IntFieldUpdateOperationsInput | number
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
productCharges?: Prisma.ProductChargeUncheckedUpdateManyWithoutSupplierNestedInput
}
/**
* Count Type SupplierCountOutputType
*/
export type SupplierCountOutputType = {
productCharges: number
purchaseReceipts: number
}
export type SupplierCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
productCharges?: boolean | SupplierCountOutputTypeCountProductChargesArgs
purchaseReceipts?: boolean | SupplierCountOutputTypeCountPurchaseReceiptsArgs
}
/**
* SupplierCountOutputType without action
*/
export type SupplierCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the SupplierCountOutputType
*/
select?: Prisma.SupplierCountOutputTypeSelect<ExtArgs> | null
}
/**
* SupplierCountOutputType without action
*/
export type SupplierCountOutputTypeCountProductChargesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.ProductChargeWhereInput
}
/**
* SupplierCountOutputType without action
*/
export type SupplierCountOutputTypeCountPurchaseReceiptsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.PurchaseReceiptWhereInput
}
export type SupplierSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type SupplierSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
@@ -545,6 +794,9 @@ export type SupplierSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
deletedAt?: boolean deletedAt?: boolean
productCharges?: boolean | Prisma.Supplier$productChargesArgs<ExtArgs>
purchaseReceipts?: boolean | Prisma.Supplier$purchaseReceiptsArgs<ExtArgs>
_count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["supplier"]> }, ExtArgs["result"]["supplier"]>
@@ -566,10 +818,18 @@ export type SupplierSelectScalar = {
} }
export type SupplierOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["supplier"]> export type SupplierOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["supplier"]>
export type SupplierInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
productCharges?: boolean | Prisma.Supplier$productChargesArgs<ExtArgs>
purchaseReceipts?: boolean | Prisma.Supplier$purchaseReceiptsArgs<ExtArgs>
_count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs<ExtArgs>
}
export type $SupplierPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type $SupplierPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "Supplier" name: "Supplier"
objects: {} objects: {
productCharges: Prisma.$ProductChargePayload<ExtArgs>[]
purchaseReceipts: Prisma.$PurchaseReceiptPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: number id: number
firstName: string firstName: string
@@ -581,8 +841,8 @@ export type $SupplierPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
state: string | null state: string | null
country: string | null country: string | null
isActive: boolean isActive: boolean
createdAt: Date | null createdAt: Date
updatedAt: Date | null updatedAt: Date
deletedAt: Date | null deletedAt: Date | null
}, ExtArgs["result"]["supplier"]> }, ExtArgs["result"]["supplier"]>
composites: {} composites: {}
@@ -924,6 +1184,8 @@ readonly fields: SupplierFieldRefs;
*/ */
export interface Prisma__SupplierClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> { export interface Prisma__SupplierClient<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"
productCharges<T extends Prisma.Supplier$productChargesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Supplier$productChargesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductChargePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
purchaseReceipts<T extends Prisma.Supplier$purchaseReceiptsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Supplier$purchaseReceiptsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PurchaseReceiptPayload<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.
@@ -982,6 +1244,10 @@ export type SupplierFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.Inte
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter, which Supplier to fetch. * Filter, which Supplier to fetch.
*/ */
@@ -1000,6 +1266,10 @@ export type SupplierFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Extensio
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter, which Supplier to fetch. * Filter, which Supplier to fetch.
*/ */
@@ -1018,6 +1288,10 @@ export type SupplierFindFirstArgs<ExtArgs extends runtime.Types.Extensions.Inter
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter, which Supplier to fetch. * Filter, which Supplier to fetch.
*/ */
@@ -1066,6 +1340,10 @@ export type SupplierFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extension
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter, which Supplier to fetch. * Filter, which Supplier to fetch.
*/ */
@@ -1114,6 +1392,10 @@ export type SupplierFindManyArgs<ExtArgs extends runtime.Types.Extensions.Intern
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter, which Suppliers to fetch. * Filter, which Suppliers to fetch.
*/ */
@@ -1157,6 +1439,10 @@ export type SupplierCreateArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* The data needed to create a Supplier. * The data needed to create a Supplier.
*/ */
@@ -1186,6 +1472,10 @@ export type SupplierUpdateArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* The data needed to update a Supplier. * The data needed to update a Supplier.
*/ */
@@ -1226,6 +1516,10 @@ export type SupplierUpsertArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* The filter to search for the Supplier to update in case it exists. * The filter to search for the Supplier to update in case it exists.
*/ */
@@ -1252,6 +1546,10 @@ export type SupplierDeleteArgs<ExtArgs extends runtime.Types.Extensions.Internal
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
/** /**
* Filter which Supplier to delete. * Filter which Supplier to delete.
*/ */
@@ -1272,6 +1570,54 @@ export type SupplierDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inte
limit?: number limit?: number
} }
/**
* Supplier.productCharges
*/
export type Supplier$productChargesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the ProductCharge
*/
select?: Prisma.ProductChargeSelect<ExtArgs> | null
/**
* Omit specific fields from the ProductCharge
*/
omit?: Prisma.ProductChargeOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.ProductChargeInclude<ExtArgs> | null
where?: Prisma.ProductChargeWhereInput
orderBy?: Prisma.ProductChargeOrderByWithRelationInput | Prisma.ProductChargeOrderByWithRelationInput[]
cursor?: Prisma.ProductChargeWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.ProductChargeScalarFieldEnum | Prisma.ProductChargeScalarFieldEnum[]
}
/**
* Supplier.purchaseReceipts
*/
export type Supplier$purchaseReceiptsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the PurchaseReceipt
*/
select?: Prisma.PurchaseReceiptSelect<ExtArgs> | null
/**
* Omit specific fields from the PurchaseReceipt
*/
omit?: Prisma.PurchaseReceiptOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.PurchaseReceiptInclude<ExtArgs> | null
where?: Prisma.PurchaseReceiptWhereInput
orderBy?: Prisma.PurchaseReceiptOrderByWithRelationInput | Prisma.PurchaseReceiptOrderByWithRelationInput[]
cursor?: Prisma.PurchaseReceiptWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.PurchaseReceiptScalarFieldEnum | Prisma.PurchaseReceiptScalarFieldEnum[]
}
/** /**
* Supplier without action * Supplier without action
*/ */
@@ -1284,4 +1630,8 @@ export type SupplierDefaultArgs<ExtArgs extends runtime.Types.Extensions.Interna
* Omit specific fields from the Supplier * Omit specific fields from the Supplier
*/ */
omit?: Prisma.SupplierOmit<ExtArgs> | null omit?: Prisma.SupplierOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.SupplierInclude<ExtArgs> | null
} }
+108 -1
View File
@@ -43,6 +43,9 @@ export type UserMinAggregateOutputType = {
firstName: string | null firstName: string | null
lastName: string | null lastName: string | null
roleId: number | null roleId: number | null
createdAt: Date | null
deletedAt: Date | null
updatedAt: Date | null
} }
export type UserMaxAggregateOutputType = { export type UserMaxAggregateOutputType = {
@@ -52,6 +55,9 @@ export type UserMaxAggregateOutputType = {
firstName: string | null firstName: string | null
lastName: string | null lastName: string | null
roleId: number | null roleId: number | null
createdAt: Date | null
deletedAt: Date | null
updatedAt: Date | null
} }
export type UserCountAggregateOutputType = { export type UserCountAggregateOutputType = {
@@ -61,6 +67,9 @@ export type UserCountAggregateOutputType = {
firstName: number firstName: number
lastName: number lastName: number
roleId: number roleId: number
createdAt: number
deletedAt: number
updatedAt: number
_all: number _all: number
} }
@@ -82,6 +91,9 @@ export type UserMinAggregateInputType = {
firstName?: true firstName?: true
lastName?: true lastName?: true
roleId?: true roleId?: true
createdAt?: true
deletedAt?: true
updatedAt?: true
} }
export type UserMaxAggregateInputType = { export type UserMaxAggregateInputType = {
@@ -91,6 +103,9 @@ export type UserMaxAggregateInputType = {
firstName?: true firstName?: true
lastName?: true lastName?: true
roleId?: true roleId?: true
createdAt?: true
deletedAt?: true
updatedAt?: true
} }
export type UserCountAggregateInputType = { export type UserCountAggregateInputType = {
@@ -100,6 +115,9 @@ export type UserCountAggregateInputType = {
firstName?: true firstName?: true
lastName?: true lastName?: true
roleId?: true roleId?: true
createdAt?: true
deletedAt?: true
updatedAt?: true
_all?: true _all?: true
} }
@@ -196,6 +214,9 @@ export type UserGroupByOutputType = {
firstName: string firstName: string
lastName: string lastName: string
roleId: number roleId: number
createdAt: Date
deletedAt: Date | null
updatedAt: Date
_count: UserCountAggregateOutputType | null _count: UserCountAggregateOutputType | null
_avg: UserAvgAggregateOutputType | null _avg: UserAvgAggregateOutputType | null
_sum: UserSumAggregateOutputType | null _sum: UserSumAggregateOutputType | null
@@ -228,6 +249,9 @@ export type UserWhereInput = {
firstName?: Prisma.StringFilter<"User"> | string firstName?: Prisma.StringFilter<"User"> | string
lastName?: Prisma.StringFilter<"User"> | string lastName?: Prisma.StringFilter<"User"> | string
roleId?: Prisma.IntFilter<"User"> | number roleId?: Prisma.IntFilter<"User"> | number
createdAt?: Prisma.DateTimeFilter<"User"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"User"> | Date | string | null
updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string
role?: Prisma.XOR<Prisma.RoleScalarRelationFilter, Prisma.RoleWhereInput> role?: Prisma.XOR<Prisma.RoleScalarRelationFilter, Prisma.RoleWhereInput>
} }
@@ -238,6 +262,9 @@ export type UserOrderByWithRelationInput = {
firstName?: Prisma.SortOrder firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder lastName?: Prisma.SortOrder
roleId?: Prisma.SortOrder roleId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
updatedAt?: Prisma.SortOrder
role?: Prisma.RoleOrderByWithRelationInput role?: Prisma.RoleOrderByWithRelationInput
_relevance?: Prisma.UserOrderByRelevanceInput _relevance?: Prisma.UserOrderByRelevanceInput
} }
@@ -252,6 +279,9 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
firstName?: Prisma.StringFilter<"User"> | string firstName?: Prisma.StringFilter<"User"> | string
lastName?: Prisma.StringFilter<"User"> | string lastName?: Prisma.StringFilter<"User"> | string
roleId?: Prisma.IntFilter<"User"> | number roleId?: Prisma.IntFilter<"User"> | number
createdAt?: Prisma.DateTimeFilter<"User"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"User"> | Date | string | null
updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string
role?: Prisma.XOR<Prisma.RoleScalarRelationFilter, Prisma.RoleWhereInput> role?: Prisma.XOR<Prisma.RoleScalarRelationFilter, Prisma.RoleWhereInput>
}, "id" | "mobileNumber"> }, "id" | "mobileNumber">
@@ -262,6 +292,9 @@ export type UserOrderByWithAggregationInput = {
firstName?: Prisma.SortOrder firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder lastName?: Prisma.SortOrder
roleId?: Prisma.SortOrder roleId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
updatedAt?: Prisma.SortOrder
_count?: Prisma.UserCountOrderByAggregateInput _count?: Prisma.UserCountOrderByAggregateInput
_avg?: Prisma.UserAvgOrderByAggregateInput _avg?: Prisma.UserAvgOrderByAggregateInput
_max?: Prisma.UserMaxOrderByAggregateInput _max?: Prisma.UserMaxOrderByAggregateInput
@@ -279,6 +312,9 @@ export type UserScalarWhereWithAggregatesInput = {
firstName?: Prisma.StringWithAggregatesFilter<"User"> | string firstName?: Prisma.StringWithAggregatesFilter<"User"> | string
lastName?: Prisma.StringWithAggregatesFilter<"User"> | string lastName?: Prisma.StringWithAggregatesFilter<"User"> | string
roleId?: Prisma.IntWithAggregatesFilter<"User"> | number roleId?: Prisma.IntWithAggregatesFilter<"User"> | number
createdAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"User"> | Date | string | null
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string
} }
export type UserCreateInput = { export type UserCreateInput = {
@@ -286,6 +322,9 @@ export type UserCreateInput = {
password: string password: string
firstName: string firstName: string
lastName: string lastName: string
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
role: Prisma.RoleCreateNestedOneWithoutUsersInput role: Prisma.RoleCreateNestedOneWithoutUsersInput
} }
@@ -296,6 +335,9 @@ export type UserUncheckedCreateInput = {
firstName: string firstName: string
lastName: string lastName: string
roleId: number roleId: number
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
} }
export type UserUpdateInput = { export type UserUpdateInput = {
@@ -303,6 +345,9 @@ export type UserUpdateInput = {
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
role?: Prisma.RoleUpdateOneRequiredWithoutUsersNestedInput role?: Prisma.RoleUpdateOneRequiredWithoutUsersNestedInput
} }
@@ -313,6 +358,9 @@ export type UserUncheckedUpdateInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
roleId?: Prisma.IntFieldUpdateOperationsInput | number roleId?: Prisma.IntFieldUpdateOperationsInput | number
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
export type UserCreateManyInput = { export type UserCreateManyInput = {
@@ -322,6 +370,9 @@ export type UserCreateManyInput = {
firstName: string firstName: string
lastName: string lastName: string
roleId: number roleId: number
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
} }
export type UserUpdateManyMutationInput = { export type UserUpdateManyMutationInput = {
@@ -329,6 +380,9 @@ export type UserUpdateManyMutationInput = {
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
export type UserUncheckedUpdateManyInput = { export type UserUncheckedUpdateManyInput = {
@@ -338,6 +392,9 @@ export type UserUncheckedUpdateManyInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
roleId?: Prisma.IntFieldUpdateOperationsInput | number roleId?: Prisma.IntFieldUpdateOperationsInput | number
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
export type UserOrderByRelevanceInput = { export type UserOrderByRelevanceInput = {
@@ -353,6 +410,9 @@ export type UserCountOrderByAggregateInput = {
firstName?: Prisma.SortOrder firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder lastName?: Prisma.SortOrder
roleId?: Prisma.SortOrder roleId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
} }
export type UserAvgOrderByAggregateInput = { export type UserAvgOrderByAggregateInput = {
@@ -367,6 +427,9 @@ export type UserMaxOrderByAggregateInput = {
firstName?: Prisma.SortOrder firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder lastName?: Prisma.SortOrder
roleId?: Prisma.SortOrder roleId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
} }
export type UserMinOrderByAggregateInput = { export type UserMinOrderByAggregateInput = {
@@ -376,6 +439,9 @@ export type UserMinOrderByAggregateInput = {
firstName?: Prisma.SortOrder firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder lastName?: Prisma.SortOrder
roleId?: Prisma.SortOrder roleId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
deletedAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
} }
export type UserSumOrderByAggregateInput = { export type UserSumOrderByAggregateInput = {
@@ -397,6 +463,14 @@ export type StringFieldUpdateOperationsInput = {
set?: string set?: string
} }
export type DateTimeFieldUpdateOperationsInput = {
set?: Date | string
}
export type NullableDateTimeFieldUpdateOperationsInput = {
set?: Date | string | null
}
export type IntFieldUpdateOperationsInput = { export type IntFieldUpdateOperationsInput = {
set?: number set?: number
increment?: number increment?: number
@@ -452,6 +526,9 @@ export type UserCreateWithoutRoleInput = {
password: string password: string
firstName: string firstName: string
lastName: string lastName: string
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
} }
export type UserUncheckedCreateWithoutRoleInput = { export type UserUncheckedCreateWithoutRoleInput = {
@@ -460,6 +537,9 @@ export type UserUncheckedCreateWithoutRoleInput = {
password: string password: string
firstName: string firstName: string
lastName: string lastName: string
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
} }
export type UserCreateOrConnectWithoutRoleInput = { export type UserCreateOrConnectWithoutRoleInput = {
@@ -498,6 +578,9 @@ export type UserScalarWhereInput = {
firstName?: Prisma.StringFilter<"User"> | string firstName?: Prisma.StringFilter<"User"> | string
lastName?: Prisma.StringFilter<"User"> | string lastName?: Prisma.StringFilter<"User"> | string
roleId?: Prisma.IntFilter<"User"> | number roleId?: Prisma.IntFilter<"User"> | number
createdAt?: Prisma.DateTimeFilter<"User"> | Date | string
deletedAt?: Prisma.DateTimeNullableFilter<"User"> | Date | string | null
updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string
} }
export type UserCreateManyRoleInput = { export type UserCreateManyRoleInput = {
@@ -506,6 +589,9 @@ export type UserCreateManyRoleInput = {
password: string password: string
firstName: string firstName: string
lastName: string lastName: string
createdAt?: Date | string
deletedAt?: Date | string | null
updatedAt?: Date | string
} }
export type UserUpdateWithoutRoleInput = { export type UserUpdateWithoutRoleInput = {
@@ -513,6 +599,9 @@ export type UserUpdateWithoutRoleInput = {
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
export type UserUncheckedUpdateWithoutRoleInput = { export type UserUncheckedUpdateWithoutRoleInput = {
@@ -521,6 +610,9 @@ export type UserUncheckedUpdateWithoutRoleInput = {
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
export type UserUncheckedUpdateManyWithoutRoleInput = { export type UserUncheckedUpdateManyWithoutRoleInput = {
@@ -529,6 +621,9 @@ export type UserUncheckedUpdateManyWithoutRoleInput = {
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
firstName?: Prisma.StringFieldUpdateOperationsInput | string firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string lastName?: Prisma.StringFieldUpdateOperationsInput | string
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
@@ -540,6 +635,9 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
firstName?: boolean firstName?: boolean
lastName?: boolean lastName?: boolean
roleId?: boolean roleId?: boolean
createdAt?: boolean
deletedAt?: boolean
updatedAt?: boolean
role?: boolean | Prisma.RoleDefaultArgs<ExtArgs> role?: boolean | Prisma.RoleDefaultArgs<ExtArgs>
}, ExtArgs["result"]["user"]> }, ExtArgs["result"]["user"]>
@@ -552,9 +650,12 @@ export type UserSelectScalar = {
firstName?: boolean firstName?: boolean
lastName?: boolean lastName?: boolean
roleId?: boolean roleId?: boolean
createdAt?: boolean
deletedAt?: boolean
updatedAt?: boolean
} }
export type UserOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "mobileNumber" | "password" | "firstName" | "lastName" | "roleId", ExtArgs["result"]["user"]> export type UserOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "mobileNumber" | "password" | "firstName" | "lastName" | "roleId" | "createdAt" | "deletedAt" | "updatedAt", ExtArgs["result"]["user"]>
export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
role?: boolean | Prisma.RoleDefaultArgs<ExtArgs> role?: boolean | Prisma.RoleDefaultArgs<ExtArgs>
} }
@@ -571,6 +672,9 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
firstName: string firstName: string
lastName: string lastName: string
roleId: number roleId: number
createdAt: Date
deletedAt: Date | null
updatedAt: Date
}, ExtArgs["result"]["user"]> }, ExtArgs["result"]["user"]>
composites: {} composites: {}
} }
@@ -947,6 +1051,9 @@ export interface UserFieldRefs {
readonly firstName: Prisma.FieldRef<"User", 'String'> readonly firstName: Prisma.FieldRef<"User", 'String'>
readonly lastName: Prisma.FieldRef<"User", 'String'> readonly lastName: Prisma.FieldRef<"User", 'String'>
readonly roleId: Prisma.FieldRef<"User", 'Int'> readonly roleId: Prisma.FieldRef<"User", 'Int'>
readonly createdAt: Prisma.FieldRef<"User", 'DateTime'>
readonly deletedAt: Prisma.FieldRef<"User", 'DateTime'>
readonly updatedAt: Prisma.FieldRef<"User", 'DateTime'>
} }
@@ -0,0 +1,713 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `inventory_overview` 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 inventory_overview
*
*/
export type inventory_overviewModel = runtime.Types.Result.DefaultSelection<Prisma.$inventory_overviewPayload>
export type AggregateInventory_overview = {
_count: Inventory_overviewCountAggregateOutputType | null
_avg: Inventory_overviewAvgAggregateOutputType | null
_sum: Inventory_overviewSumAggregateOutputType | null
_min: Inventory_overviewMinAggregateOutputType | null
_max: Inventory_overviewMaxAggregateOutputType | null
}
export type Inventory_overviewAvgAggregateOutputType = {
ProductId: number | null
stock_quantity: runtime.Decimal | null
avgCost: runtime.Decimal | null
totalCost: runtime.Decimal | null
}
export type Inventory_overviewSumAggregateOutputType = {
ProductId: number | null
stock_quantity: runtime.Decimal | null
avgCost: runtime.Decimal | null
totalCost: runtime.Decimal | null
}
export type Inventory_overviewMinAggregateOutputType = {
ProductId: number | null
stock_quantity: runtime.Decimal | null
avgCost: runtime.Decimal | null
totalCost: runtime.Decimal | null
updatedAt: Date | null
}
export type Inventory_overviewMaxAggregateOutputType = {
ProductId: number | null
stock_quantity: runtime.Decimal | null
avgCost: runtime.Decimal | null
totalCost: runtime.Decimal | null
updatedAt: Date | null
}
export type Inventory_overviewCountAggregateOutputType = {
ProductId: number
stock_quantity: number
avgCost: number
totalCost: number
updatedAt: number
_all: number
}
export type Inventory_overviewAvgAggregateInputType = {
ProductId?: true
stock_quantity?: true
avgCost?: true
totalCost?: true
}
export type Inventory_overviewSumAggregateInputType = {
ProductId?: true
stock_quantity?: true
avgCost?: true
totalCost?: true
}
export type Inventory_overviewMinAggregateInputType = {
ProductId?: true
stock_quantity?: true
avgCost?: true
totalCost?: true
updatedAt?: true
}
export type Inventory_overviewMaxAggregateInputType = {
ProductId?: true
stock_quantity?: true
avgCost?: true
totalCost?: true
updatedAt?: true
}
export type Inventory_overviewCountAggregateInputType = {
ProductId?: true
stock_quantity?: true
avgCost?: true
totalCost?: true
updatedAt?: true
_all?: true
}
export type Inventory_overviewAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Filter which inventory_overview to aggregate.
*/
where?: Prisma.inventory_overviewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of inventory_overviews to fetch.
*/
orderBy?: Prisma.inventory_overviewOrderByWithRelationInput | Prisma.inventory_overviewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` inventory_overviews 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` inventory_overviews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Count returned inventory_overviews
**/
_count?: true | Inventory_overviewCountAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to average
**/
_avg?: Inventory_overviewAvgAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to sum
**/
_sum?: Inventory_overviewSumAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the minimum value
**/
_min?: Inventory_overviewMinAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the maximum value
**/
_max?: Inventory_overviewMaxAggregateInputType
}
export type GetInventory_overviewAggregateType<T extends Inventory_overviewAggregateArgs> = {
[P in keyof T & keyof AggregateInventory_overview]: P extends '_count' | 'count'
? T[P] extends true
? number
: Prisma.GetScalarType<T[P], AggregateInventory_overview[P]>
: Prisma.GetScalarType<T[P], AggregateInventory_overview[P]>
}
export type inventory_overviewGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.inventory_overviewWhereInput
orderBy?: Prisma.inventory_overviewOrderByWithAggregationInput | Prisma.inventory_overviewOrderByWithAggregationInput[]
by: Prisma.Inventory_overviewScalarFieldEnum[] | Prisma.Inventory_overviewScalarFieldEnum
having?: Prisma.inventory_overviewScalarWhereWithAggregatesInput
take?: number
skip?: number
_count?: Inventory_overviewCountAggregateInputType | true
_avg?: Inventory_overviewAvgAggregateInputType
_sum?: Inventory_overviewSumAggregateInputType
_min?: Inventory_overviewMinAggregateInputType
_max?: Inventory_overviewMaxAggregateInputType
}
export type Inventory_overviewGroupByOutputType = {
ProductId: number
stock_quantity: runtime.Decimal
avgCost: runtime.Decimal
totalCost: runtime.Decimal
updatedAt: Date
_count: Inventory_overviewCountAggregateOutputType | null
_avg: Inventory_overviewAvgAggregateOutputType | null
_sum: Inventory_overviewSumAggregateOutputType | null
_min: Inventory_overviewMinAggregateOutputType | null
_max: Inventory_overviewMaxAggregateOutputType | null
}
type GetInventory_overviewGroupByPayload<T extends inventory_overviewGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<Inventory_overviewGroupByOutputType, T['by']> &
{
[P in ((keyof T) & (keyof Inventory_overviewGroupByOutputType))]: P extends '_count'
? T[P] extends boolean
? number
: Prisma.GetScalarType<T[P], Inventory_overviewGroupByOutputType[P]>
: Prisma.GetScalarType<T[P], Inventory_overviewGroupByOutputType[P]>
}
>
>
export type inventory_overviewWhereInput = {
AND?: Prisma.inventory_overviewWhereInput | Prisma.inventory_overviewWhereInput[]
OR?: Prisma.inventory_overviewWhereInput[]
NOT?: Prisma.inventory_overviewWhereInput | Prisma.inventory_overviewWhereInput[]
ProductId?: Prisma.IntFilter<"inventory_overview"> | number
stock_quantity?: Prisma.DecimalFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
avgCost?: Prisma.DecimalFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
totalCost?: Prisma.DecimalFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
updatedAt?: Prisma.DateTimeFilter<"inventory_overview"> | Date | string
}
export type inventory_overviewOrderByWithRelationInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
}
export type inventory_overviewOrderByWithAggregationInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
_count?: Prisma.inventory_overviewCountOrderByAggregateInput
_avg?: Prisma.inventory_overviewAvgOrderByAggregateInput
_max?: Prisma.inventory_overviewMaxOrderByAggregateInput
_min?: Prisma.inventory_overviewMinOrderByAggregateInput
_sum?: Prisma.inventory_overviewSumOrderByAggregateInput
}
export type inventory_overviewScalarWhereWithAggregatesInput = {
AND?: Prisma.inventory_overviewScalarWhereWithAggregatesInput | Prisma.inventory_overviewScalarWhereWithAggregatesInput[]
OR?: Prisma.inventory_overviewScalarWhereWithAggregatesInput[]
NOT?: Prisma.inventory_overviewScalarWhereWithAggregatesInput | Prisma.inventory_overviewScalarWhereWithAggregatesInput[]
ProductId?: Prisma.IntWithAggregatesFilter<"inventory_overview"> | number
stock_quantity?: Prisma.DecimalWithAggregatesFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
avgCost?: Prisma.DecimalWithAggregatesFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
totalCost?: Prisma.DecimalWithAggregatesFilter<"inventory_overview"> | runtime.Decimal | runtime.DecimalJsLike | number | string
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"inventory_overview"> | Date | string
}
export type inventory_overviewCountOrderByAggregateInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
}
export type inventory_overviewAvgOrderByAggregateInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
}
export type inventory_overviewMaxOrderByAggregateInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
}
export type inventory_overviewMinOrderByAggregateInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder
}
export type inventory_overviewSumOrderByAggregateInput = {
ProductId?: Prisma.SortOrder
stock_quantity?: Prisma.SortOrder
avgCost?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
}
export type inventory_overviewSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
ProductId?: boolean
stock_quantity?: boolean
avgCost?: boolean
totalCost?: boolean
updatedAt?: boolean
}, ExtArgs["result"]["inventory_overview"]>
export type inventory_overviewSelectScalar = {
ProductId?: boolean
stock_quantity?: boolean
avgCost?: boolean
totalCost?: boolean
updatedAt?: boolean
}
export type inventory_overviewOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"ProductId" | "stock_quantity" | "avgCost" | "totalCost" | "updatedAt", ExtArgs["result"]["inventory_overview"]>
export type $inventory_overviewPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "inventory_overview"
objects: {}
scalars: runtime.Types.Extensions.GetPayloadResult<{
ProductId: number
stock_quantity: runtime.Decimal
avgCost: runtime.Decimal
totalCost: runtime.Decimal
updatedAt: Date
}, ExtArgs["result"]["inventory_overview"]>
composites: {}
}
export type inventory_overviewGetPayload<S extends boolean | null | undefined | inventory_overviewDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$inventory_overviewPayload, S>
export type inventory_overviewCountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> =
Omit<inventory_overviewFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {
select?: Inventory_overviewCountAggregateInputType | true
}
export interface inventory_overviewDelegate<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> {
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['inventory_overview'], meta: { name: 'inventory_overview' } }
/**
* Find the first Inventory_overview 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 {inventory_overviewFindFirstArgs} args - Arguments to find a Inventory_overview
* @example
* // Get one Inventory_overview
* const inventory_overview = await prisma.inventory_overview.findFirst({
* where: {
* // ... provide filter here
* }
* })
*/
findFirst<T extends inventory_overviewFindFirstArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, inventory_overviewFindFirstArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__inventory_overviewClient<runtime.Types.Result.GetResult<Prisma.$inventory_overviewPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Find the first Inventory_overview 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 {inventory_overviewFindFirstOrThrowArgs} args - Arguments to find a Inventory_overview
* @example
* // Get one Inventory_overview
* const inventory_overview = await prisma.inventory_overview.findFirstOrThrow({
* where: {
* // ... provide filter here
* }
* })
*/
findFirstOrThrow<T extends inventory_overviewFindFirstOrThrowArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, inventory_overviewFindFirstOrThrowArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__inventory_overviewClient<runtime.Types.Result.GetResult<Prisma.$inventory_overviewPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>
/**
* Find zero or more Inventory_overviews 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 {inventory_overviewFindManyArgs} args - Arguments to filter and select certain fields only.
* @example
* // Get all Inventory_overviews
* const inventory_overviews = await prisma.inventory_overview.findMany()
*
* // Get first 10 Inventory_overviews
* const inventory_overviews = await prisma.inventory_overview.findMany({ take: 10 })
*
* // Only select the `ProductId`
* const inventory_overviewWithProductIdOnly = await prisma.inventory_overview.findMany({ select: { ProductId: true } })
*
*/
findMany<T extends inventory_overviewFindManyArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, inventory_overviewFindManyArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$inventory_overviewPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
/**
* Count the number of Inventory_overviews.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {inventory_overviewCountArgs} args - Arguments to filter Inventory_overviews to count.
* @example
* // Count the number of Inventory_overviews
* const count = await prisma.inventory_overview.count({
* where: {
* // ... the filter for the Inventory_overviews we want to count
* }
* })
**/
count<T extends inventory_overviewCountArgs>(
args?: Prisma.Subset<T, inventory_overviewCountArgs>,
): Prisma.PrismaPromise<
T extends runtime.Types.Utils.Record<'select', any>
? T['select'] extends true
? number
: Prisma.GetScalarType<T['select'], Inventory_overviewCountAggregateOutputType>
: number
>
/**
* Allows you to perform aggregations operations on a Inventory_overview.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {Inventory_overviewAggregateArgs} 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 Inventory_overviewAggregateArgs>(args: Prisma.Subset<T, Inventory_overviewAggregateArgs>): Prisma.PrismaPromise<GetInventory_overviewAggregateType<T>>
/**
* Group by Inventory_overview.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {inventory_overviewGroupByArgs} 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 inventory_overviewGroupByArgs,
HasSelectOrTake extends Prisma.Or<
Prisma.Extends<'skip', Prisma.Keys<T>>,
Prisma.Extends<'take', Prisma.Keys<T>>
>,
OrderByArg extends Prisma.True extends HasSelectOrTake
? { orderBy: inventory_overviewGroupByArgs['orderBy'] }
: { orderBy?: inventory_overviewGroupByArgs['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, inventory_overviewGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetInventory_overviewGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
* Fields of the inventory_overview model
*/
readonly fields: inventory_overviewFieldRefs;
}
/**
* The delegate class that acts as a "Promise-like" for inventory_overview.
* 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__inventory_overviewClient<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 inventory_overview model
*/
export interface inventory_overviewFieldRefs {
readonly ProductId: Prisma.FieldRef<"inventory_overview", 'Int'>
readonly stock_quantity: Prisma.FieldRef<"inventory_overview", 'Decimal'>
readonly avgCost: Prisma.FieldRef<"inventory_overview", 'Decimal'>
readonly totalCost: Prisma.FieldRef<"inventory_overview", 'Decimal'>
readonly updatedAt: Prisma.FieldRef<"inventory_overview", 'DateTime'>
}
// Custom InputTypes
/**
* inventory_overview findFirst
*/
export type inventory_overviewFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the inventory_overview
*/
select?: Prisma.inventory_overviewSelect<ExtArgs> | null
/**
* Omit specific fields from the inventory_overview
*/
omit?: Prisma.inventory_overviewOmit<ExtArgs> | null
/**
* Filter, which inventory_overview to fetch.
*/
where?: Prisma.inventory_overviewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of inventory_overviews to fetch.
*/
orderBy?: Prisma.inventory_overviewOrderByWithRelationInput | Prisma.inventory_overviewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` inventory_overviews 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` inventory_overviews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of inventory_overviews.
*/
distinct?: Prisma.Inventory_overviewScalarFieldEnum | Prisma.Inventory_overviewScalarFieldEnum[]
}
/**
* inventory_overview findFirstOrThrow
*/
export type inventory_overviewFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the inventory_overview
*/
select?: Prisma.inventory_overviewSelect<ExtArgs> | null
/**
* Omit specific fields from the inventory_overview
*/
omit?: Prisma.inventory_overviewOmit<ExtArgs> | null
/**
* Filter, which inventory_overview to fetch.
*/
where?: Prisma.inventory_overviewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of inventory_overviews to fetch.
*/
orderBy?: Prisma.inventory_overviewOrderByWithRelationInput | Prisma.inventory_overviewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` inventory_overviews 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` inventory_overviews.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of inventory_overviews.
*/
distinct?: Prisma.Inventory_overviewScalarFieldEnum | Prisma.Inventory_overviewScalarFieldEnum[]
}
/**
* inventory_overview findMany
*/
export type inventory_overviewFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the inventory_overview
*/
select?: Prisma.inventory_overviewSelect<ExtArgs> | null
/**
* Omit specific fields from the inventory_overview
*/
omit?: Prisma.inventory_overviewOmit<ExtArgs> | null
/**
* Filter, which inventory_overviews to fetch.
*/
where?: Prisma.inventory_overviewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of inventory_overviews to fetch.
*/
orderBy?: Prisma.inventory_overviewOrderByWithRelationInput | Prisma.inventory_overviewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` inventory_overviews 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` inventory_overviews.
*/
skip?: number
distinct?: Prisma.Inventory_overviewScalarFieldEnum | Prisma.Inventory_overviewScalarFieldEnum[]
}
/**
* inventory_overview without action
*/
export type inventory_overviewDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the inventory_overview
*/
select?: Prisma.inventory_overviewSelect<ExtArgs> | null
/**
* Omit specific fields from the inventory_overview
*/
omit?: Prisma.inventory_overviewOmit<ExtArgs> | null
}
+803
View File
@@ -0,0 +1,803 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `stock_cardex` 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 stock_cardex
*
*/
export type stock_cardexModel = runtime.Types.Result.DefaultSelection<Prisma.$stock_cardexPayload>
export type AggregateStock_cardex = {
_count: Stock_cardexCountAggregateOutputType | null
_avg: Stock_cardexAvgAggregateOutputType | null
_sum: Stock_cardexSumAggregateOutputType | null
_min: Stock_cardexMinAggregateOutputType | null
_max: Stock_cardexMaxAggregateOutputType | null
}
export type Stock_cardexAvgAggregateOutputType = {
productId: number | null
movement_id: number | null
quantity: runtime.Decimal | null
fee: runtime.Decimal | null
totalCost: runtime.Decimal | null
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
}
export type Stock_cardexSumAggregateOutputType = {
productId: number | null
movement_id: number | null
quantity: runtime.Decimal | null
fee: runtime.Decimal | null
totalCost: runtime.Decimal | null
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
}
export type Stock_cardexMinAggregateOutputType = {
productId: number | null
movement_id: number | null
type: $Enums.stock_cardex_type | null
quantity: runtime.Decimal | null
fee: runtime.Decimal | null
totalCost: runtime.Decimal | null
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
createdAt: Date | null
}
export type Stock_cardexMaxAggregateOutputType = {
productId: number | null
movement_id: number | null
type: $Enums.stock_cardex_type | null
quantity: runtime.Decimal | null
fee: runtime.Decimal | null
totalCost: runtime.Decimal | null
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
createdAt: Date | null
}
export type Stock_cardexCountAggregateOutputType = {
productId: number
movement_id: number
type: number
quantity: number
fee: number
totalCost: number
balance_quantity: number
balance_avg_cost: number
createdAt: number
_all: number
}
export type Stock_cardexAvgAggregateInputType = {
productId?: true
movement_id?: true
quantity?: true
fee?: true
totalCost?: true
balance_quantity?: true
balance_avg_cost?: true
}
export type Stock_cardexSumAggregateInputType = {
productId?: true
movement_id?: true
quantity?: true
fee?: true
totalCost?: true
balance_quantity?: true
balance_avg_cost?: true
}
export type Stock_cardexMinAggregateInputType = {
productId?: true
movement_id?: true
type?: true
quantity?: true
fee?: true
totalCost?: true
balance_quantity?: true
balance_avg_cost?: true
createdAt?: true
}
export type Stock_cardexMaxAggregateInputType = {
productId?: true
movement_id?: true
type?: true
quantity?: true
fee?: true
totalCost?: true
balance_quantity?: true
balance_avg_cost?: true
createdAt?: true
}
export type Stock_cardexCountAggregateInputType = {
productId?: true
movement_id?: true
type?: true
quantity?: true
fee?: true
totalCost?: true
balance_quantity?: true
balance_avg_cost?: true
createdAt?: true
_all?: true
}
export type Stock_cardexAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Filter which stock_cardex to aggregate.
*/
where?: Prisma.stock_cardexWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_cardexes to fetch.
*/
orderBy?: Prisma.stock_cardexOrderByWithRelationInput | Prisma.stock_cardexOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_cardexes 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` stock_cardexes.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Count returned stock_cardexes
**/
_count?: true | Stock_cardexCountAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to average
**/
_avg?: Stock_cardexAvgAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to sum
**/
_sum?: Stock_cardexSumAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the minimum value
**/
_min?: Stock_cardexMinAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the maximum value
**/
_max?: Stock_cardexMaxAggregateInputType
}
export type GetStock_cardexAggregateType<T extends Stock_cardexAggregateArgs> = {
[P in keyof T & keyof AggregateStock_cardex]: P extends '_count' | 'count'
? T[P] extends true
? number
: Prisma.GetScalarType<T[P], AggregateStock_cardex[P]>
: Prisma.GetScalarType<T[P], AggregateStock_cardex[P]>
}
export type stock_cardexGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.stock_cardexWhereInput
orderBy?: Prisma.stock_cardexOrderByWithAggregationInput | Prisma.stock_cardexOrderByWithAggregationInput[]
by: Prisma.Stock_cardexScalarFieldEnum[] | Prisma.Stock_cardexScalarFieldEnum
having?: Prisma.stock_cardexScalarWhereWithAggregatesInput
take?: number
skip?: number
_count?: Stock_cardexCountAggregateInputType | true
_avg?: Stock_cardexAvgAggregateInputType
_sum?: Stock_cardexSumAggregateInputType
_min?: Stock_cardexMinAggregateInputType
_max?: Stock_cardexMaxAggregateInputType
}
export type Stock_cardexGroupByOutputType = {
productId: number
movement_id: number
type: $Enums.stock_cardex_type
quantity: runtime.Decimal
fee: runtime.Decimal
totalCost: runtime.Decimal
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
createdAt: Date
_count: Stock_cardexCountAggregateOutputType | null
_avg: Stock_cardexAvgAggregateOutputType | null
_sum: Stock_cardexSumAggregateOutputType | null
_min: Stock_cardexMinAggregateOutputType | null
_max: Stock_cardexMaxAggregateOutputType | null
}
type GetStock_cardexGroupByPayload<T extends stock_cardexGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<Stock_cardexGroupByOutputType, T['by']> &
{
[P in ((keyof T) & (keyof Stock_cardexGroupByOutputType))]: P extends '_count'
? T[P] extends boolean
? number
: Prisma.GetScalarType<T[P], Stock_cardexGroupByOutputType[P]>
: Prisma.GetScalarType<T[P], Stock_cardexGroupByOutputType[P]>
}
>
>
export type stock_cardexWhereInput = {
AND?: Prisma.stock_cardexWhereInput | Prisma.stock_cardexWhereInput[]
OR?: Prisma.stock_cardexWhereInput[]
NOT?: Prisma.stock_cardexWhereInput | Prisma.stock_cardexWhereInput[]
productId?: Prisma.IntFilter<"stock_cardex"> | number
movement_id?: Prisma.IntFilter<"stock_cardex"> | number
type?: Prisma.Enumstock_cardex_typeFilter<"stock_cardex"> | $Enums.stock_cardex_type
quantity?: Prisma.DecimalFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
fee?: Prisma.DecimalFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
totalCost?: Prisma.DecimalFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
balance_quantity?: Prisma.DecimalNullableFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
balance_avg_cost?: Prisma.DecimalNullableFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
createdAt?: Prisma.DateTimeFilter<"stock_cardex"> | Date | string
}
export type stock_cardexOrderByWithRelationInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
type?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrderInput | Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder
}
export type stock_cardexOrderByWithAggregationInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
type?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrderInput | Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder
_count?: Prisma.stock_cardexCountOrderByAggregateInput
_avg?: Prisma.stock_cardexAvgOrderByAggregateInput
_max?: Prisma.stock_cardexMaxOrderByAggregateInput
_min?: Prisma.stock_cardexMinOrderByAggregateInput
_sum?: Prisma.stock_cardexSumOrderByAggregateInput
}
export type stock_cardexScalarWhereWithAggregatesInput = {
AND?: Prisma.stock_cardexScalarWhereWithAggregatesInput | Prisma.stock_cardexScalarWhereWithAggregatesInput[]
OR?: Prisma.stock_cardexScalarWhereWithAggregatesInput[]
NOT?: Prisma.stock_cardexScalarWhereWithAggregatesInput | Prisma.stock_cardexScalarWhereWithAggregatesInput[]
productId?: Prisma.IntWithAggregatesFilter<"stock_cardex"> | number
movement_id?: Prisma.IntWithAggregatesFilter<"stock_cardex"> | number
type?: Prisma.Enumstock_cardex_typeWithAggregatesFilter<"stock_cardex"> | $Enums.stock_cardex_type
quantity?: Prisma.DecimalWithAggregatesFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
fee?: Prisma.DecimalWithAggregatesFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
totalCost?: Prisma.DecimalWithAggregatesFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string
balance_quantity?: Prisma.DecimalNullableWithAggregatesFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
balance_avg_cost?: Prisma.DecimalNullableWithAggregatesFilter<"stock_cardex"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
createdAt?: Prisma.DateTimeWithAggregatesFilter<"stock_cardex"> | Date | string
}
export type stock_cardexCountOrderByAggregateInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
type?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
}
export type stock_cardexAvgOrderByAggregateInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrder
}
export type stock_cardexMaxOrderByAggregateInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
type?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
}
export type stock_cardexMinOrderByAggregateInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
type?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
}
export type stock_cardexSumOrderByAggregateInput = {
productId?: Prisma.SortOrder
movement_id?: Prisma.SortOrder
quantity?: Prisma.SortOrder
fee?: Prisma.SortOrder
totalCost?: Prisma.SortOrder
balance_quantity?: Prisma.SortOrder
balance_avg_cost?: Prisma.SortOrder
}
export type stock_cardexSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
productId?: boolean
movement_id?: boolean
type?: boolean
quantity?: boolean
fee?: boolean
totalCost?: boolean
balance_quantity?: boolean
balance_avg_cost?: boolean
createdAt?: boolean
}, ExtArgs["result"]["stock_cardex"]>
export type stock_cardexSelectScalar = {
productId?: boolean
movement_id?: boolean
type?: boolean
quantity?: boolean
fee?: boolean
totalCost?: boolean
balance_quantity?: boolean
balance_avg_cost?: boolean
createdAt?: boolean
}
export type stock_cardexOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"productId" | "movement_id" | "type" | "quantity" | "fee" | "totalCost" | "balance_quantity" | "balance_avg_cost" | "createdAt", ExtArgs["result"]["stock_cardex"]>
export type $stock_cardexPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "stock_cardex"
objects: {}
scalars: runtime.Types.Extensions.GetPayloadResult<{
productId: number
movement_id: number
type: $Enums.stock_cardex_type
quantity: runtime.Decimal
fee: runtime.Decimal
totalCost: runtime.Decimal
balance_quantity: runtime.Decimal | null
balance_avg_cost: runtime.Decimal | null
createdAt: Date
}, ExtArgs["result"]["stock_cardex"]>
composites: {}
}
export type stock_cardexGetPayload<S extends boolean | null | undefined | stock_cardexDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$stock_cardexPayload, S>
export type stock_cardexCountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> =
Omit<stock_cardexFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {
select?: Stock_cardexCountAggregateInputType | true
}
export interface stock_cardexDelegate<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> {
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['stock_cardex'], meta: { name: 'stock_cardex' } }
/**
* Find the first Stock_cardex 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 {stock_cardexFindFirstArgs} args - Arguments to find a Stock_cardex
* @example
* // Get one Stock_cardex
* const stock_cardex = await prisma.stock_cardex.findFirst({
* where: {
* // ... provide filter here
* }
* })
*/
findFirst<T extends stock_cardexFindFirstArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_cardexFindFirstArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__stock_cardexClient<runtime.Types.Result.GetResult<Prisma.$stock_cardexPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Find the first Stock_cardex 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 {stock_cardexFindFirstOrThrowArgs} args - Arguments to find a Stock_cardex
* @example
* // Get one Stock_cardex
* const stock_cardex = await prisma.stock_cardex.findFirstOrThrow({
* where: {
* // ... provide filter here
* }
* })
*/
findFirstOrThrow<T extends stock_cardexFindFirstOrThrowArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_cardexFindFirstOrThrowArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__stock_cardexClient<runtime.Types.Result.GetResult<Prisma.$stock_cardexPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>
/**
* Find zero or more Stock_cardexes 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 {stock_cardexFindManyArgs} args - Arguments to filter and select certain fields only.
* @example
* // Get all Stock_cardexes
* const stock_cardexes = await prisma.stock_cardex.findMany()
*
* // Get first 10 Stock_cardexes
* const stock_cardexes = await prisma.stock_cardex.findMany({ take: 10 })
*
* // Only select the `productId`
* const stock_cardexWithProductIdOnly = await prisma.stock_cardex.findMany({ select: { productId: true } })
*
*/
findMany<T extends stock_cardexFindManyArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_cardexFindManyArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$stock_cardexPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
/**
* Count the number of Stock_cardexes.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {stock_cardexCountArgs} args - Arguments to filter Stock_cardexes to count.
* @example
* // Count the number of Stock_cardexes
* const count = await prisma.stock_cardex.count({
* where: {
* // ... the filter for the Stock_cardexes we want to count
* }
* })
**/
count<T extends stock_cardexCountArgs>(
args?: Prisma.Subset<T, stock_cardexCountArgs>,
): Prisma.PrismaPromise<
T extends runtime.Types.Utils.Record<'select', any>
? T['select'] extends true
? number
: Prisma.GetScalarType<T['select'], Stock_cardexCountAggregateOutputType>
: number
>
/**
* Allows you to perform aggregations operations on a Stock_cardex.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {Stock_cardexAggregateArgs} 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 Stock_cardexAggregateArgs>(args: Prisma.Subset<T, Stock_cardexAggregateArgs>): Prisma.PrismaPromise<GetStock_cardexAggregateType<T>>
/**
* Group by Stock_cardex.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {stock_cardexGroupByArgs} 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 stock_cardexGroupByArgs,
HasSelectOrTake extends Prisma.Or<
Prisma.Extends<'skip', Prisma.Keys<T>>,
Prisma.Extends<'take', Prisma.Keys<T>>
>,
OrderByArg extends Prisma.True extends HasSelectOrTake
? { orderBy: stock_cardexGroupByArgs['orderBy'] }
: { orderBy?: stock_cardexGroupByArgs['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, stock_cardexGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetStock_cardexGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
* Fields of the stock_cardex model
*/
readonly fields: stock_cardexFieldRefs;
}
/**
* The delegate class that acts as a "Promise-like" for stock_cardex.
* 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__stock_cardexClient<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 stock_cardex model
*/
export interface stock_cardexFieldRefs {
readonly productId: Prisma.FieldRef<"stock_cardex", 'Int'>
readonly movement_id: Prisma.FieldRef<"stock_cardex", 'Int'>
readonly type: Prisma.FieldRef<"stock_cardex", 'stock_cardex_type'>
readonly quantity: Prisma.FieldRef<"stock_cardex", 'Decimal'>
readonly fee: Prisma.FieldRef<"stock_cardex", 'Decimal'>
readonly totalCost: Prisma.FieldRef<"stock_cardex", 'Decimal'>
readonly balance_quantity: Prisma.FieldRef<"stock_cardex", 'Decimal'>
readonly balance_avg_cost: Prisma.FieldRef<"stock_cardex", 'Decimal'>
readonly createdAt: Prisma.FieldRef<"stock_cardex", 'DateTime'>
}
// Custom InputTypes
/**
* stock_cardex findFirst
*/
export type stock_cardexFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_cardex
*/
select?: Prisma.stock_cardexSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_cardex
*/
omit?: Prisma.stock_cardexOmit<ExtArgs> | null
/**
* Filter, which stock_cardex to fetch.
*/
where?: Prisma.stock_cardexWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_cardexes to fetch.
*/
orderBy?: Prisma.stock_cardexOrderByWithRelationInput | Prisma.stock_cardexOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_cardexes 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` stock_cardexes.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of stock_cardexes.
*/
distinct?: Prisma.Stock_cardexScalarFieldEnum | Prisma.Stock_cardexScalarFieldEnum[]
}
/**
* stock_cardex findFirstOrThrow
*/
export type stock_cardexFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_cardex
*/
select?: Prisma.stock_cardexSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_cardex
*/
omit?: Prisma.stock_cardexOmit<ExtArgs> | null
/**
* Filter, which stock_cardex to fetch.
*/
where?: Prisma.stock_cardexWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_cardexes to fetch.
*/
orderBy?: Prisma.stock_cardexOrderByWithRelationInput | Prisma.stock_cardexOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_cardexes 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` stock_cardexes.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of stock_cardexes.
*/
distinct?: Prisma.Stock_cardexScalarFieldEnum | Prisma.Stock_cardexScalarFieldEnum[]
}
/**
* stock_cardex findMany
*/
export type stock_cardexFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_cardex
*/
select?: Prisma.stock_cardexSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_cardex
*/
omit?: Prisma.stock_cardexOmit<ExtArgs> | null
/**
* Filter, which stock_cardexes to fetch.
*/
where?: Prisma.stock_cardexWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_cardexes to fetch.
*/
orderBy?: Prisma.stock_cardexOrderByWithRelationInput | Prisma.stock_cardexOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_cardexes 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` stock_cardexes.
*/
skip?: number
distinct?: Prisma.Stock_cardexScalarFieldEnum | Prisma.Stock_cardexScalarFieldEnum[]
}
/**
* stock_cardex without action
*/
export type stock_cardexDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_cardex
*/
select?: Prisma.stock_cardexSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_cardex
*/
omit?: Prisma.stock_cardexOmit<ExtArgs> | null
}
+671
View File
@@ -0,0 +1,671 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `stock_view` 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 stock_view
*
*/
export type stock_viewModel = runtime.Types.Result.DefaultSelection<Prisma.$stock_viewPayload>
export type AggregateStock_view = {
_count: Stock_viewCountAggregateOutputType | null
_avg: Stock_viewAvgAggregateOutputType | null
_sum: Stock_viewSumAggregateOutputType | null
_min: Stock_viewMinAggregateOutputType | null
_max: Stock_viewMaxAggregateOutputType | null
}
export type Stock_viewAvgAggregateOutputType = {
productId: number | null
inventoryId: number | null
stock: runtime.Decimal | null
}
export type Stock_viewSumAggregateOutputType = {
productId: number | null
inventoryId: number | null
stock: runtime.Decimal | null
}
export type Stock_viewMinAggregateOutputType = {
productId: number | null
inventoryId: number | null
stock: runtime.Decimal | null
}
export type Stock_viewMaxAggregateOutputType = {
productId: number | null
inventoryId: number | null
stock: runtime.Decimal | null
}
export type Stock_viewCountAggregateOutputType = {
productId: number
inventoryId: number
stock: number
_all: number
}
export type Stock_viewAvgAggregateInputType = {
productId?: true
inventoryId?: true
stock?: true
}
export type Stock_viewSumAggregateInputType = {
productId?: true
inventoryId?: true
stock?: true
}
export type Stock_viewMinAggregateInputType = {
productId?: true
inventoryId?: true
stock?: true
}
export type Stock_viewMaxAggregateInputType = {
productId?: true
inventoryId?: true
stock?: true
}
export type Stock_viewCountAggregateInputType = {
productId?: true
inventoryId?: true
stock?: true
_all?: true
}
export type Stock_viewAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Filter which stock_view to aggregate.
*/
where?: Prisma.stock_viewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_views to fetch.
*/
orderBy?: Prisma.stock_viewOrderByWithRelationInput | Prisma.stock_viewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_views 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` stock_views.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Count returned stock_views
**/
_count?: true | Stock_viewCountAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to average
**/
_avg?: Stock_viewAvgAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to sum
**/
_sum?: Stock_viewSumAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the minimum value
**/
_min?: Stock_viewMinAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to find the maximum value
**/
_max?: Stock_viewMaxAggregateInputType
}
export type GetStock_viewAggregateType<T extends Stock_viewAggregateArgs> = {
[P in keyof T & keyof AggregateStock_view]: P extends '_count' | 'count'
? T[P] extends true
? number
: Prisma.GetScalarType<T[P], AggregateStock_view[P]>
: Prisma.GetScalarType<T[P], AggregateStock_view[P]>
}
export type stock_viewGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.stock_viewWhereInput
orderBy?: Prisma.stock_viewOrderByWithAggregationInput | Prisma.stock_viewOrderByWithAggregationInput[]
by: Prisma.Stock_viewScalarFieldEnum[] | Prisma.Stock_viewScalarFieldEnum
having?: Prisma.stock_viewScalarWhereWithAggregatesInput
take?: number
skip?: number
_count?: Stock_viewCountAggregateInputType | true
_avg?: Stock_viewAvgAggregateInputType
_sum?: Stock_viewSumAggregateInputType
_min?: Stock_viewMinAggregateInputType
_max?: Stock_viewMaxAggregateInputType
}
export type Stock_viewGroupByOutputType = {
productId: number
inventoryId: number
stock: runtime.Decimal | null
_count: Stock_viewCountAggregateOutputType | null
_avg: Stock_viewAvgAggregateOutputType | null
_sum: Stock_viewSumAggregateOutputType | null
_min: Stock_viewMinAggregateOutputType | null
_max: Stock_viewMaxAggregateOutputType | null
}
type GetStock_viewGroupByPayload<T extends stock_viewGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<Stock_viewGroupByOutputType, T['by']> &
{
[P in ((keyof T) & (keyof Stock_viewGroupByOutputType))]: P extends '_count'
? T[P] extends boolean
? number
: Prisma.GetScalarType<T[P], Stock_viewGroupByOutputType[P]>
: Prisma.GetScalarType<T[P], Stock_viewGroupByOutputType[P]>
}
>
>
export type stock_viewWhereInput = {
AND?: Prisma.stock_viewWhereInput | Prisma.stock_viewWhereInput[]
OR?: Prisma.stock_viewWhereInput[]
NOT?: Prisma.stock_viewWhereInput | Prisma.stock_viewWhereInput[]
productId?: Prisma.IntFilter<"stock_view"> | number
inventoryId?: Prisma.IntFilter<"stock_view"> | number
stock?: Prisma.DecimalNullableFilter<"stock_view"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
}
export type stock_viewOrderByWithRelationInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrderInput | Prisma.SortOrder
}
export type stock_viewOrderByWithAggregationInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.stock_viewCountOrderByAggregateInput
_avg?: Prisma.stock_viewAvgOrderByAggregateInput
_max?: Prisma.stock_viewMaxOrderByAggregateInput
_min?: Prisma.stock_viewMinOrderByAggregateInput
_sum?: Prisma.stock_viewSumOrderByAggregateInput
}
export type stock_viewScalarWhereWithAggregatesInput = {
AND?: Prisma.stock_viewScalarWhereWithAggregatesInput | Prisma.stock_viewScalarWhereWithAggregatesInput[]
OR?: Prisma.stock_viewScalarWhereWithAggregatesInput[]
NOT?: Prisma.stock_viewScalarWhereWithAggregatesInput | Prisma.stock_viewScalarWhereWithAggregatesInput[]
productId?: Prisma.IntWithAggregatesFilter<"stock_view"> | number
inventoryId?: Prisma.IntWithAggregatesFilter<"stock_view"> | number
stock?: Prisma.DecimalNullableWithAggregatesFilter<"stock_view"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
}
export type stock_viewCountOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrder
}
export type stock_viewAvgOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrder
}
export type stock_viewMaxOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrder
}
export type stock_viewMinOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrder
}
export type stock_viewSumOrderByAggregateInput = {
productId?: Prisma.SortOrder
inventoryId?: Prisma.SortOrder
stock?: Prisma.SortOrder
}
export type stock_viewSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
productId?: boolean
inventoryId?: boolean
stock?: boolean
}, ExtArgs["result"]["stock_view"]>
export type stock_viewSelectScalar = {
productId?: boolean
inventoryId?: boolean
stock?: boolean
}
export type stock_viewOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"productId" | "inventoryId" | "stock", ExtArgs["result"]["stock_view"]>
export type $stock_viewPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "stock_view"
objects: {}
scalars: runtime.Types.Extensions.GetPayloadResult<{
productId: number
inventoryId: number
stock: runtime.Decimal | null
}, ExtArgs["result"]["stock_view"]>
composites: {}
}
export type stock_viewGetPayload<S extends boolean | null | undefined | stock_viewDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$stock_viewPayload, S>
export type stock_viewCountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> =
Omit<stock_viewFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {
select?: Stock_viewCountAggregateInputType | true
}
export interface stock_viewDelegate<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> {
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['stock_view'], meta: { name: 'stock_view' } }
/**
* Find the first Stock_view 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 {stock_viewFindFirstArgs} args - Arguments to find a Stock_view
* @example
* // Get one Stock_view
* const stock_view = await prisma.stock_view.findFirst({
* where: {
* // ... provide filter here
* }
* })
*/
findFirst<T extends stock_viewFindFirstArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_viewFindFirstArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__stock_viewClient<runtime.Types.Result.GetResult<Prisma.$stock_viewPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Find the first Stock_view 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 {stock_viewFindFirstOrThrowArgs} args - Arguments to find a Stock_view
* @example
* // Get one Stock_view
* const stock_view = await prisma.stock_view.findFirstOrThrow({
* where: {
* // ... provide filter here
* }
* })
*/
findFirstOrThrow<T extends stock_viewFindFirstOrThrowArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_viewFindFirstOrThrowArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.Prisma__stock_viewClient<runtime.Types.Result.GetResult<Prisma.$stock_viewPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>
/**
* Find zero or more Stock_views 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 {stock_viewFindManyArgs} args - Arguments to filter and select certain fields only.
* @example
* // Get all Stock_views
* const stock_views = await prisma.stock_view.findMany()
*
* // Get first 10 Stock_views
* const stock_views = await prisma.stock_view.findMany({ take: 10 })
*
* // Only select the `productId`
* const stock_viewWithProductIdOnly = await prisma.stock_view.findMany({ select: { productId: true } })
*
*/
findMany<T extends stock_viewFindManyArgs, TakeDependenciesValidator extends "take" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}, SkipDependenciesValidator extends "skip" extends Prisma.Keys<T> ? {
orderBy: {}
} : {}>(args?: Prisma.SelectSubset<T, stock_viewFindManyArgs<ExtArgs>> & TakeDependenciesValidator & SkipDependenciesValidator): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$stock_viewPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
/**
* Count the number of Stock_views.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {stock_viewCountArgs} args - Arguments to filter Stock_views to count.
* @example
* // Count the number of Stock_views
* const count = await prisma.stock_view.count({
* where: {
* // ... the filter for the Stock_views we want to count
* }
* })
**/
count<T extends stock_viewCountArgs>(
args?: Prisma.Subset<T, stock_viewCountArgs>,
): Prisma.PrismaPromise<
T extends runtime.Types.Utils.Record<'select', any>
? T['select'] extends true
? number
: Prisma.GetScalarType<T['select'], Stock_viewCountAggregateOutputType>
: number
>
/**
* Allows you to perform aggregations operations on a Stock_view.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {Stock_viewAggregateArgs} 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 Stock_viewAggregateArgs>(args: Prisma.Subset<T, Stock_viewAggregateArgs>): Prisma.PrismaPromise<GetStock_viewAggregateType<T>>
/**
* Group by Stock_view.
* Note, that providing `undefined` is treated as the value not being there.
* Read more here: https://pris.ly/d/null-undefined
* @param {stock_viewGroupByArgs} 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 stock_viewGroupByArgs,
HasSelectOrTake extends Prisma.Or<
Prisma.Extends<'skip', Prisma.Keys<T>>,
Prisma.Extends<'take', Prisma.Keys<T>>
>,
OrderByArg extends Prisma.True extends HasSelectOrTake
? { orderBy: stock_viewGroupByArgs['orderBy'] }
: { orderBy?: stock_viewGroupByArgs['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, stock_viewGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetStock_viewGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
* Fields of the stock_view model
*/
readonly fields: stock_viewFieldRefs;
}
/**
* The delegate class that acts as a "Promise-like" for stock_view.
* 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__stock_viewClient<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 stock_view model
*/
export interface stock_viewFieldRefs {
readonly productId: Prisma.FieldRef<"stock_view", 'Int'>
readonly inventoryId: Prisma.FieldRef<"stock_view", 'Int'>
readonly stock: Prisma.FieldRef<"stock_view", 'Decimal'>
}
// Custom InputTypes
/**
* stock_view findFirst
*/
export type stock_viewFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_view
*/
select?: Prisma.stock_viewSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_view
*/
omit?: Prisma.stock_viewOmit<ExtArgs> | null
/**
* Filter, which stock_view to fetch.
*/
where?: Prisma.stock_viewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_views to fetch.
*/
orderBy?: Prisma.stock_viewOrderByWithRelationInput | Prisma.stock_viewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_views 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` stock_views.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of stock_views.
*/
distinct?: Prisma.Stock_viewScalarFieldEnum | Prisma.Stock_viewScalarFieldEnum[]
}
/**
* stock_view findFirstOrThrow
*/
export type stock_viewFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_view
*/
select?: Prisma.stock_viewSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_view
*/
omit?: Prisma.stock_viewOmit<ExtArgs> | null
/**
* Filter, which stock_view to fetch.
*/
where?: Prisma.stock_viewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_views to fetch.
*/
orderBy?: Prisma.stock_viewOrderByWithRelationInput | Prisma.stock_viewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_views 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` stock_views.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of stock_views.
*/
distinct?: Prisma.Stock_viewScalarFieldEnum | Prisma.Stock_viewScalarFieldEnum[]
}
/**
* stock_view findMany
*/
export type stock_viewFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_view
*/
select?: Prisma.stock_viewSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_view
*/
omit?: Prisma.stock_viewOmit<ExtArgs> | null
/**
* Filter, which stock_views to fetch.
*/
where?: Prisma.stock_viewWhereInput
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
*
* Determine the order of stock_views to fetch.
*/
orderBy?: Prisma.stock_viewOrderByWithRelationInput | Prisma.stock_viewOrderByWithRelationInput[]
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
*
* Take `±n` stock_views 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` stock_views.
*/
skip?: number
distinct?: Prisma.Stock_viewScalarFieldEnum | Prisma.Stock_viewScalarFieldEnum[]
}
/**
* stock_view without action
*/
export type stock_viewDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the stock_view
*/
select?: Prisma.stock_viewSelect<ExtArgs> | null
/**
* Omit specific fields from the stock_view
*/
omit?: Prisma.stock_viewOmit<ExtArgs> | null
}
+43 -4
View File
@@ -1,4 +1,5 @@
import { Injectable } from '@nestjs/common' import { Injectable } from '@nestjs/common'
import { ShortEntity } from '../common/interfaces/response-models'
import { ResponseMapper } from '../common/response/response-mapper' import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service' import { PrismaService } from '../prisma/prisma.service'
@@ -11,14 +12,52 @@ export class InventoriesService {
} }
async findAll() { async findAll() {
const items = await this.prisma.inventory.findMany() const items = await this.prisma.inventory.findMany({
return ResponseMapper.list(items) include: { productCharges: { include: { product: true } } },
})
const mapped = items.map(i => {
const productsMap: Record<number, ShortEntity> = {}
for (const pc of i.productCharges ?? []) {
if (pc.product) {
productsMap[pc.product.id] = { id: pc.product.id, name: pc.product.name }
}
}
const groupedProducts = Object.values(productsMap)
const { productCharges, ...rest } = i as any
return { ...rest, groupedProducts }
})
return ResponseMapper.list(mapped)
} }
async findOne(id: number) { async findOne(id: number) {
const item = await this.prisma.inventory.findUnique({ where: { id } }) const item = await this.prisma.inventory.findUnique({
where: { id },
include: { productCharges: { include: { product: true } } },
})
if (!item) return null if (!item) return null
return ResponseMapper.single(item) const productsMap: Record<number, { id: number; name: string; count: number }> = {}
for (const pc of item.productCharges ?? []) {
const pid = pc.productId
const pname = pc.product?.name ?? `#${pid}`
if (!productsMap[pid]) productsMap[pid] = { id: pid, name: pname, count: 0 }
productsMap[pid].count += Number(pc.count)
}
const productsWithCount = Object.values(productsMap)
const groupedProducts: ShortEntity[] = productsWithCount.map(p => ({
id: p.id,
name: p.name,
}))
const { productCharges, ...rest } = item as any
const itemWithCounts = {
...rest,
products: productsWithCount,
groupedProducts,
}
return ResponseMapper.single(itemWithCounts)
} }
async update(id: number, data: any) { async update(id: number, data: any) {
@@ -0,0 +1,5 @@
export interface IInventoryResponse {
name: string
location?: string
isActive: boolean
}
@@ -0,0 +1,16 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber } from 'class-validator'
export class CreateInventoryTransferItemDto {
@Type(() => Number)
@IsNumber()
count: number
@Type(() => Number)
@IsInt()
productId: number
@Type(() => Number)
@IsInt()
transferId: number
}
@@ -0,0 +1,19 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional } from 'class-validator'
export class UpdateInventoryTransferItemDto {
@IsOptional()
@Type(() => Number)
@IsNumber()
count?: number
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
transferId?: number
}
@@ -0,0 +1,42 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateInventoryTransferItemDto } from './dto/create-inventory-transfer-item.dto'
import { UpdateInventoryTransferItemDto } from './dto/update-inventory-transfer-item.dto'
import { InventoryTransferItemsService } from './inventory-transfer-items.service'
@Controller('inventory-transfers/:transferId/items')
export class InventoryTransferItemsController {
constructor(private readonly service: InventoryTransferItemsService) {}
@Post()
create(
@Param('transferId') transferId: string,
@Body() dto: CreateInventoryTransferItemDto,
) {
// ensure transferId from route is used
return this.service.createForTransfer(Number(transferId), dto)
}
@Get()
findAll(@Param('transferId') transferId: string) {
return this.service.findAllForTransfer(Number(transferId))
}
@Get(':id')
findOne(@Param('transferId') transferId: string, @Param('id') id: string) {
return this.service.findOneForTransfer(Number(transferId), Number(id))
}
@Patch(':id')
update(
@Param('transferId') transferId: string,
@Param('id') id: string,
@Body() dto: UpdateInventoryTransferItemDto,
) {
return this.service.updateForTransfer(Number(transferId), Number(id), dto)
}
@Delete(':id')
remove(@Param('transferId') transferId: string, @Param('id') id: string) {
return this.service.removeForTransfer(Number(transferId), Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { InventoryTransferItemsController } from './inventory-transfer-items.controller'
import { InventoryTransferItemsService } from './inventory-transfer-items.service'
@Module({
imports: [PrismaModule],
controllers: [InventoryTransferItemsController],
providers: [InventoryTransferItemsService],
})
export class InventoryTransferItemsModule {}
@@ -0,0 +1,101 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateInventoryTransferItemDto } from './dto/create-inventory-transfer-item.dto'
@Injectable()
export class InventoryTransferItemsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateInventoryTransferItemDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'transferId')) {
payload.transfer = { connect: { id: Number(payload.transferId) } }
delete payload.transferId
}
const item = await this.prisma.inventoryTransferItem.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll(transferId?: number) {
const where = transferId ? { transferId: Number(transferId) } : undefined
const items = await this.prisma.inventoryTransferItem.findMany({
where,
include: { product: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.inventoryTransferItem.findUnique({
where: { id },
include: { product: true, transfer: true },
})
if (!item) return null
return ResponseMapper.single(item)
}
// scoped helpers for nested routes
async createForTransfer(transferId: number, dto: CreateInventoryTransferItemDto) {
const payload: any = { ...dto, transferId }
return this.create(payload)
}
async findAllForTransfer(transferId: number) {
return this.findAll(transferId)
}
async findOneForTransfer(transferId: number, id: number) {
const item = await this.prisma.inventoryTransferItem.findFirst({
where: { id, transferId },
include: { product: true, transfer: 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, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'transferId')) {
payload.transfer = { connect: { id: Number(payload.transferId) } }
delete payload.transferId
}
const item = await this.prisma.inventoryTransferItem.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async updateForTransfer(transferId: number, id: number, data: any) {
// ensure the item belongs to the transfer
const existing = await this.prisma.inventoryTransferItem.findFirst({
where: { id, transferId },
})
if (!existing) return null
return this.update(id, data)
}
async remove(id: number) {
const item = await this.prisma.inventoryTransferItem.delete({ where: { id } })
return ResponseMapper.single(item)
}
async removeForTransfer(transferId: number, id: number) {
const existing = await this.prisma.inventoryTransferItem.findFirst({
where: { id, transferId },
})
if (!existing) return null
return this.remove(id)
}
}
@@ -0,0 +1,19 @@
import { Type } from 'class-transformer'
import { IsInt, IsOptional, IsString } from 'class-validator'
export class CreateInventoryTransferDto {
@IsString()
code: string
@IsOptional()
@IsString()
description?: string
@Type(() => Number)
@IsInt()
fromInventoryId: number
@Type(() => Number)
@IsInt()
toInventoryId: number
}
@@ -0,0 +1,22 @@
import { Type } from 'class-transformer'
import { IsInt, IsOptional, IsString } from 'class-validator'
export class UpdateInventoryTransferDto {
@IsOptional()
@IsString()
code?: string
@IsOptional()
@IsString()
description?: string
@IsOptional()
@Type(() => Number)
@IsInt()
fromInventoryId?: number | null
@IsOptional()
@Type(() => Number)
@IsInt()
toInventoryId?: number | null
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateInventoryTransferDto } from './dto/create-inventory-transfer.dto'
import { UpdateInventoryTransferDto } from './dto/update-inventory-transfer.dto'
import { InventoryTransfersService } from './inventory-transfers.service'
@Controller('inventory-transfers')
export class InventoryTransfersController {
constructor(private readonly service: InventoryTransfersService) {}
@Post()
create(@Body() dto: CreateInventoryTransferDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateInventoryTransferDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { InventoryTransfersController } from './inventory-transfers.controller'
import { InventoryTransfersService } from './inventory-transfers.service'
@Module({
imports: [PrismaModule],
controllers: [InventoryTransfersController],
providers: [InventoryTransfersService],
})
export class InventoryTransfersModule {}
@@ -0,0 +1,65 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateInventoryTransferDto } from './dto/create-inventory-transfer.dto'
@Injectable()
export class InventoryTransfersService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateInventoryTransferDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'fromInventoryId')) {
payload.fromInventory = { connect: { id: Number(payload.fromInventoryId) } }
delete payload.fromInventoryId
}
if (Object.prototype.hasOwnProperty.call(payload, 'toInventoryId')) {
payload.toInventory = { connect: { id: Number(payload.toInventoryId) } }
delete payload.toInventoryId
}
const item = await this.prisma.inventoryTransfer.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.inventoryTransfer.findMany({
include: { fromInventory: true, toInventory: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.inventoryTransfer.findUnique({
where: { id },
include: { items: true, fromInventory: true, toInventory: 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, 'fromInventoryId')) {
if (payload.fromInventoryId === null) payload.fromInventory = { disconnect: true }
else payload.fromInventory = { connect: { id: Number(payload.fromInventoryId) } }
delete payload.fromInventoryId
}
if (Object.prototype.hasOwnProperty.call(payload, 'toInventoryId')) {
if (payload.toInventoryId === null) payload.toInventory = { disconnect: true }
else payload.toInventory = { connect: { id: Number(payload.toInventoryId) } }
delete payload.toInventoryId
}
const item = await this.prisma.inventoryTransfer.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.inventoryTransfer.delete({ where: { id } })
return ResponseMapper.single(item)
}
}
+2
View File
@@ -9,7 +9,9 @@ const adapter = new PrismaMariaDb({
user: env('DATABASE_USER'), user: env('DATABASE_USER'),
password: env('DATABASE_PASSWORD'), password: env('DATABASE_PASSWORD'),
database: env('DATABASE_NAME'), database: env('DATABASE_NAME'),
ssl: false,
connectionLimit: 5, connectionLimit: 5,
port: Number(env('DATABASE_PORT')) || 3306,
}) })
const prisma = new PrismaClient({ adapter }) const prisma = new PrismaClient({ adapter })
+1
View File
@@ -12,6 +12,7 @@ export class PrismaService extends PrismaClient implements OnModuleInit, OnModul
user: env('DATABASE_USER'), user: env('DATABASE_USER'),
password: env('DATABASE_PASSWORD'), password: env('DATABASE_PASSWORD'),
database: env('DATABASE_NAME'), database: env('DATABASE_NAME'),
port: env('DATABASE_PORT') ? Number(env('DATABASE_PORT')) : 3306,
connectionLimit: 5, connectionLimit: 5,
}) })
super({ adapter }) super({ adapter })
@@ -0,0 +1,47 @@
import { Type } from 'class-transformer'
import {
IsBoolean,
IsDateString,
IsInt,
IsNumber,
IsOptional,
IsString,
} from 'class-validator'
export class CreateProductChargeDto {
@Type(() => Number)
@IsNumber()
count: number
@Type(() => Number)
@IsNumber()
fee: number
@Type(() => Number)
@IsNumber()
totalAmount: number
@IsOptional()
@IsBoolean()
@Type(() => Boolean)
isSettled?: boolean
@IsDateString()
buyAt: string
@IsOptional()
@IsString()
description?: string
@Type(() => Number)
@IsInt()
productId: number
@Type(() => Number)
@IsInt()
inventoryId: number
@Type(() => Number)
@IsInt()
supplierId: number
}
@@ -0,0 +1,54 @@
import { Type } from 'class-transformer'
import {
IsBoolean,
IsDateString,
IsInt,
IsNumber,
IsOptional,
IsString,
} from 'class-validator'
export class UpdateProductChargeDto {
@IsOptional()
@Type(() => Number)
@IsNumber()
count?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
fee?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
totalAmount?: number
@IsOptional()
@Type(() => Boolean)
@IsBoolean()
isSettled?: boolean
@IsOptional()
@IsDateString()
buyAt?: string
@IsOptional()
@IsString()
description?: string
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
inventoryId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
supplierId?: number
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateProductChargeDto } from './dto/create-product-charge.dto'
import { UpdateProductChargeDto } from './dto/update-product-charge.dto'
import { ProductChargesService } from './product-charges.service'
@Controller('product-charges')
export class ProductChargesController {
constructor(private readonly service: ProductChargesService) {}
@Post()
create(@Body() dto: CreateProductChargeDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateProductChargeDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { ProductChargesController } from './product-charges.controller'
import { ProductChargesService } from './product-charges.service'
@Module({
imports: [PrismaModule],
controllers: [ProductChargesController],
providers: [ProductChargesService],
})
export class ProductChargesModule {}
@@ -0,0 +1,104 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateProductChargeDto } from './dto/create-product-charge.dto'
@Injectable()
export class ProductChargesService {
constructor(private prisma: PrismaService) {}
async create(data: CreateProductChargeDto) {
const payload: any = { ...data }
// transform relation id scalars into nested connect objects
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
if (payload.productId !== undefined && payload.productId !== null) {
payload.product = { connect: { id: Number(payload.productId) } }
}
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
if (payload.inventoryId !== undefined && payload.inventoryId !== null) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
}
delete payload.inventoryId
}
if (Object.prototype.hasOwnProperty.call(payload, 'supplierId')) {
if (payload.supplierId !== undefined && payload.supplierId !== null) {
payload.supplier = { connect: { id: Number(payload.supplierId) } }
}
delete payload.supplierId
}
// Convert buyAt to Date if it's a string
if (typeof payload.buyAt === 'string') {
payload.buyAt = new Date(payload.buyAt)
}
// Remove explicit nulls for optional fields to avoid Prisma complaining
Object.keys(payload).forEach(k => {
if (payload[k] === null) delete payload[k]
})
const item = await this.prisma.productCharge.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.productCharge.findMany()
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.productCharge.findUnique({ where: { id } })
if (!item) return null
return ResponseMapper.single(item)
}
async update(id: number, data: any) {
const payload: any = { ...data }
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
if (payload.productId === null) {
payload.product = { disconnect: true }
} else {
payload.product = { connect: { id: Number(payload.productId) } }
}
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
if (payload.inventoryId === null) {
payload.inventory = { disconnect: true }
} else {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
}
delete payload.inventoryId
}
if (Object.prototype.hasOwnProperty.call(payload, 'supplierId')) {
if (payload.supplierId === null) {
payload.supplier = { disconnect: true }
} else {
payload.supplier = { connect: { id: Number(payload.supplierId) } }
}
delete payload.supplierId
}
if (typeof payload.buyAt === 'string') payload.buyAt = new Date(payload.buyAt)
Object.keys(payload).forEach(k => {
if (payload[k] === null) delete payload[k]
})
const item = await this.prisma.productCharge.update({ where: { id }, data: payload })
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.productCharge.delete({ where: { id } })
return ResponseMapper.single(item)
}
}
-1
View File
@@ -9,7 +9,6 @@ export class ProductsController {
@Post() @Post()
create(@Body() dto: CreateProductDto) { create(@Body() dto: CreateProductDto) {
console.log('[ProductController] create called', dto)
return this.productsService.create(dto) return this.productsService.create(dto)
} }
+21 -10
View File
@@ -1,4 +1,5 @@
import { Injectable } from '@nestjs/common' import { Injectable } from '@nestjs/common'
import { ShortEntity } from '../common/interfaces/response-models'
import { ResponseMapper } from '../common/response/response-mapper' import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service' import { PrismaService } from '../prisma/prisma.service'
import { CreateProductDto } from './dto/create-product.dto' import { CreateProductDto } from './dto/create-product.dto'
@@ -8,12 +9,7 @@ export class ProductsService {
constructor(private prisma: PrismaService) {} constructor(private prisma: PrismaService) {}
async create(data: CreateProductDto) { async create(data: CreateProductDto) {
console.log(data)
// Transform incoming DTO so relation ids are passed as `connect` objects
const payload: any = { ...data } const payload: any = { ...data }
// If the client supplied brandId/categoryId (even null), remove the scalar
// Prisma expects nested relation objects, so only add `connect` when an id is present.
if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) { if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) {
if (payload.brandId !== undefined && payload.brandId !== null) { if (payload.brandId !== undefined && payload.brandId !== null) {
payload.brand = { connect: { id: Number(payload.brandId) } } payload.brand = { connect: { id: Number(payload.brandId) } }
@@ -38,7 +34,13 @@ export class ProductsService {
}) })
const mapped = items.map(p => { const mapped = items.map(p => {
const { brandId, categoryId, ...rest } = p as any const { brandId, categoryId, ...rest } = p as any
return { ...rest, brand: p.brand, category: p.category } const brand: ShortEntity | null = p.brand
? { id: p.brand.id, name: p.brand.name }
: null
const category: ShortEntity | null = p.category
? { id: p.category.id, name: p.category.name }
: null
return { ...rest, brand, category }
}) })
return ResponseMapper.list(mapped) return ResponseMapper.list(mapped)
} }
@@ -46,14 +48,23 @@ export class ProductsService {
async findOne(id: number) { async findOne(id: number) {
const p = await this.prisma.product.findUnique({ const p = await this.prisma.product.findUnique({
where: { id }, where: { id },
include: { brand: true, category: true }, include: { brand: true, category: true, productCharges: true },
}) })
if (!p) return null if (!p) return null
console.log('first')
const { brandId, categoryId, ...rest } = p as any const { brandId, categoryId, ...rest } = p as any
return ResponseMapper.single({ ...rest, brand: p.brand, category: p.category }) const brand: ShortEntity | null = p.brand
? { id: p.brand.id, name: p.brand.name }
: null
const category: ShortEntity | null = p.category
? { id: p.category.id, name: p.category.name }
: null
return ResponseMapper.single({
...rest,
brand,
category,
count: p.productCharges.reduce((acc, charge) => acc + Number(charge.count), 0.0),
})
} }
async update(id: number, data: any) { async update(id: number, data: any) {
@@ -0,0 +1,24 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber } from 'class-validator'
export class CreatePurchaseReceiptItemDto {
@Type(() => Number)
@IsNumber()
count: number
@Type(() => Number)
@IsNumber()
fee: number
@Type(() => Number)
@IsNumber()
total: number
@Type(() => Number)
@IsInt()
receiptId: number
@Type(() => Number)
@IsInt()
productId: number
}
@@ -0,0 +1,29 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional } from 'class-validator'
export class UpdatePurchaseReceiptItemDto {
@IsOptional()
@Type(() => Number)
@IsNumber()
count?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
fee?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
total?: number
@IsOptional()
@Type(() => Number)
@IsInt()
receiptId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
}
@@ -0,0 +1,41 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreatePurchaseReceiptItemDto } from './dto/create-purchase-receipt-item.dto'
import { UpdatePurchaseReceiptItemDto } from './dto/update-purchase-receipt-item.dto'
import { PurchaseReceiptItemsService } from './purchase-receipt-items.service'
@Controller('purchase-receipts/:receiptId/items')
export class PurchaseReceiptItemsController {
constructor(private readonly service: PurchaseReceiptItemsService) {}
@Post()
create(
@Param('receiptId') receiptId: string,
@Body() dto: CreatePurchaseReceiptItemDto,
) {
return this.service.createForReceipt(Number(receiptId), dto)
}
@Get()
findAll(@Param('receiptId') receiptId: string) {
return this.service.findAllForReceipt(Number(receiptId))
}
@Get(':id')
findOne(@Param('receiptId') receiptId: string, @Param('id') id: string) {
return this.service.findOneForReceipt(Number(receiptId), Number(id))
}
@Patch(':id')
update(
@Param('receiptId') receiptId: string,
@Param('id') id: string,
@Body() dto: UpdatePurchaseReceiptItemDto,
) {
return this.service.updateForReceipt(Number(receiptId), Number(id), dto)
}
@Delete(':id')
remove(@Param('receiptId') receiptId: string, @Param('id') id: string) {
return this.service.removeForReceipt(Number(receiptId), Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { PurchaseReceiptItemsController } from './purchase-receipt-items.controller'
import { PurchaseReceiptItemsService } from './purchase-receipt-items.service'
@Module({
imports: [PrismaModule],
controllers: [PurchaseReceiptItemsController],
providers: [PurchaseReceiptItemsService],
})
export class PurchaseReceiptItemsModule {}
@@ -0,0 +1,98 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreatePurchaseReceiptItemDto } from './dto/create-purchase-receipt-item.dto'
@Injectable()
export class PurchaseReceiptItemsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreatePurchaseReceiptItemDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'receiptId')) {
payload.receipt = { connect: { id: Number(payload.receiptId) } }
delete payload.receiptId
}
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
const item = await this.prisma.purchaseReceiptItem.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll(receiptId?: number) {
const where = receiptId ? { receiptId: Number(receiptId) } : undefined
const items = await this.prisma.purchaseReceiptItem.findMany({
where,
include: { product: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.purchaseReceiptItem.findUnique({
where: { id },
include: { product: true, receipt: true },
})
if (!item) return null
return ResponseMapper.single(item)
}
async createForReceipt(receiptId: number, dto: CreatePurchaseReceiptItemDto) {
const payload: any = { ...dto, receiptId }
return this.create(payload)
}
async findAllForReceipt(receiptId: number) {
return this.findAll(receiptId)
}
async findOneForReceipt(receiptId: number, id: number) {
const item = await this.prisma.purchaseReceiptItem.findFirst({
where: { id, receiptId },
include: { product: true, receipt: 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, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'receiptId')) {
payload.receipt = { connect: { id: Number(payload.receiptId) } }
delete payload.receiptId
}
const item = await this.prisma.purchaseReceiptItem.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async updateForReceipt(receiptId: number, id: number, data: any) {
const existing = await this.prisma.purchaseReceiptItem.findFirst({
where: { id, receiptId },
})
if (!existing) return null
return this.update(id, data)
}
async remove(id: number) {
const item = await this.prisma.purchaseReceiptItem.delete({ where: { id } })
return ResponseMapper.single(item)
}
async removeForReceipt(receiptId: number, id: number) {
const existing = await this.prisma.purchaseReceiptItem.findFirst({
where: { id, receiptId },
})
if (!existing) return null
return this.remove(id)
}
}
@@ -0,0 +1,23 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
export class CreatePurchaseReceiptDto {
@IsString()
code: string
@Type(() => Number)
@IsNumber()
totalAmount: number
@IsOptional()
@IsString()
description?: string
@Type(() => Number)
@IsInt()
supplierId: number
@Type(() => Number)
@IsInt()
inventoryId: number
}
@@ -0,0 +1,27 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
export class UpdatePurchaseReceiptDto {
@IsOptional()
@IsString()
code?: string
@IsOptional()
@Type(() => Number)
@IsNumber()
totalAmount?: number
@IsOptional()
@IsString()
description?: string
@IsOptional()
@Type(() => Number)
@IsInt()
supplierId?: number | null
@IsOptional()
@Type(() => Number)
@IsInt()
inventoryId?: number | null
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreatePurchaseReceiptDto } from './dto/create-purchase-receipt.dto'
import { UpdatePurchaseReceiptDto } from './dto/update-purchase-receipt.dto'
import { PurchaseReceiptsService } from './purchase-receipts.service'
@Controller('purchase-receipts')
export class PurchaseReceiptsController {
constructor(private readonly service: PurchaseReceiptsService) {}
@Post()
create(@Body() dto: CreatePurchaseReceiptDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdatePurchaseReceiptDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { PurchaseReceiptsController } from './purchase-receipts.controller'
import { PurchaseReceiptsService } from './purchase-receipts.service'
@Module({
imports: [PrismaModule],
controllers: [PurchaseReceiptsController],
providers: [PurchaseReceiptsService],
})
export class PurchaseReceiptsModule {}
@@ -0,0 +1,65 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreatePurchaseReceiptDto } from './dto/create-purchase-receipt.dto'
@Injectable()
export class PurchaseReceiptsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreatePurchaseReceiptDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'supplierId')) {
payload.supplier = { connect: { id: Number(payload.supplierId) } }
delete payload.supplierId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.purchaseReceipt.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.purchaseReceipt.findMany({
include: { supplier: true, inventory: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.purchaseReceipt.findUnique({
where: { id },
include: { supplier: true, inventory: true, items: 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, 'supplierId')) {
if (payload.supplierId === null) payload.supplier = { disconnect: true }
else payload.supplier = { connect: { id: Number(payload.supplierId) } }
delete payload.supplierId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
if (payload.inventoryId === null) payload.inventory = { disconnect: true }
else payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.purchaseReceipt.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.purchaseReceipt.delete({ where: { id } })
return ResponseMapper.single(item)
}
}
@@ -0,0 +1,24 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber } from 'class-validator'
export class CreateSalesInvoiceItemDto {
@Type(() => Number)
@IsNumber()
count: number
@Type(() => Number)
@IsNumber()
fee: number
@Type(() => Number)
@IsNumber()
total: number
@Type(() => Number)
@IsInt()
invoiceId: number
@Type(() => Number)
@IsInt()
productId: number
}
@@ -0,0 +1,29 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional } from 'class-validator'
export class UpdateSalesInvoiceItemDto {
@IsOptional()
@Type(() => Number)
@IsNumber()
count?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
fee?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
total?: number
@IsOptional()
@Type(() => Number)
@IsInt()
invoiceId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
}
@@ -0,0 +1,38 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateSalesInvoiceItemDto } from './dto/create-sales-invoice-item.dto'
import { UpdateSalesInvoiceItemDto } from './dto/update-sales-invoice-item.dto'
import { SalesInvoiceItemsService } from './sales-invoice-items.service'
@Controller('sales-invoices/:invoiceId/items')
export class SalesInvoiceItemsController {
constructor(private readonly service: SalesInvoiceItemsService) {}
@Post()
create(@Param('invoiceId') invoiceId: string, @Body() dto: CreateSalesInvoiceItemDto) {
return this.service.createForInvoice(Number(invoiceId), dto)
}
@Get()
findAll(@Param('invoiceId') invoiceId: string) {
return this.service.findAllForInvoice(Number(invoiceId))
}
@Get(':id')
findOne(@Param('invoiceId') invoiceId: string, @Param('id') id: string) {
return this.service.findOneForInvoice(Number(invoiceId), Number(id))
}
@Patch(':id')
update(
@Param('invoiceId') invoiceId: string,
@Param('id') id: string,
@Body() dto: UpdateSalesInvoiceItemDto,
) {
return this.service.updateForInvoice(Number(invoiceId), Number(id), dto)
}
@Delete(':id')
remove(@Param('invoiceId') invoiceId: string, @Param('id') id: string) {
return this.service.removeForInvoice(Number(invoiceId), Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { SalesInvoiceItemsController } from './sales-invoice-items.controller'
import { SalesInvoiceItemsService } from './sales-invoice-items.service'
@Module({
imports: [PrismaModule],
controllers: [SalesInvoiceItemsController],
providers: [SalesInvoiceItemsService],
})
export class SalesInvoiceItemsModule {}
@@ -0,0 +1,98 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateSalesInvoiceItemDto } from './dto/create-sales-invoice-item.dto'
@Injectable()
export class SalesInvoiceItemsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateSalesInvoiceItemDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'invoiceId')) {
payload.invoice = { connect: { id: Number(payload.invoiceId) } }
delete payload.invoiceId
}
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
const item = await this.prisma.salesInvoiceItem.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll(invoiceId?: number) {
const where = invoiceId ? { invoiceId: Number(invoiceId) } : undefined
const items = await this.prisma.salesInvoiceItem.findMany({
where,
include: { product: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.salesInvoiceItem.findUnique({
where: { id },
include: { product: true, invoice: true },
})
if (!item) return null
return ResponseMapper.single(item)
}
async createForInvoice(invoiceId: number, dto: CreateSalesInvoiceItemDto) {
const payload: any = { ...dto, invoiceId }
return this.create(payload)
}
async findAllForInvoice(invoiceId: number) {
return this.findAll(invoiceId)
}
async findOneForInvoice(invoiceId: number, id: number) {
const item = await this.prisma.salesInvoiceItem.findFirst({
where: { id, invoiceId },
include: { product: true, invoice: 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, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'invoiceId')) {
payload.invoice = { connect: { id: Number(payload.invoiceId) } }
delete payload.invoiceId
}
const item = await this.prisma.salesInvoiceItem.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async updateForInvoice(invoiceId: number, id: number, data: any) {
const existing = await this.prisma.salesInvoiceItem.findFirst({
where: { id, invoiceId },
})
if (!existing) return null
return this.update(id, data)
}
async remove(id: number) {
const item = await this.prisma.salesInvoiceItem.delete({ where: { id } })
return ResponseMapper.single(item)
}
async removeForInvoice(invoiceId: number, id: number) {
const existing = await this.prisma.salesInvoiceItem.findFirst({
where: { id, invoiceId },
})
if (!existing) return null
return this.remove(id)
}
}
@@ -0,0 +1,20 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
export class CreateSalesInvoiceDto {
@IsString()
code: string
@Type(() => Number)
@IsNumber()
totalAmount: number
@IsOptional()
@IsString()
description?: string
@IsOptional()
@Type(() => Number)
@IsInt()
customerId?: number
}
@@ -0,0 +1,22 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
export class UpdateSalesInvoiceDto {
@IsOptional()
@IsString()
code?: string
@IsOptional()
@Type(() => Number)
@IsNumber()
totalAmount?: number
@IsOptional()
@IsString()
description?: string
@IsOptional()
@Type(() => Number)
@IsInt()
customerId?: number | null
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } 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'
@Controller('sales-invoices')
export class SalesInvoicesController {
constructor(private readonly service: SalesInvoicesService) {}
@Post()
create(@Body() dto: CreateSalesInvoiceDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateSalesInvoiceDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { SalesInvoicesController } from './sales-invoices.controller'
import { SalesInvoicesService } from './sales-invoices.service'
@Module({
imports: [PrismaModule],
controllers: [SalesInvoicesController],
providers: [SalesInvoicesService],
})
export class SalesInvoicesModule {}
@@ -0,0 +1,50 @@
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)
}
}
@@ -0,0 +1,16 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber } from 'class-validator'
export class CreateStockAdjustmentDto {
@Type(() => Number)
@IsNumber()
adjustedQuantity: number
@Type(() => Number)
@IsInt()
productId: number
@Type(() => Number)
@IsInt()
inventoryId: number
}
@@ -0,0 +1,19 @@
import { Type } from 'class-transformer'
import { IsInt, IsNumber, IsOptional } from 'class-validator'
export class UpdateStockAdjustmentDto {
@IsOptional()
@Type(() => Number)
@IsNumber()
adjustedQuantity?: number
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
inventoryId?: number
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateStockAdjustmentDto } from './dto/create-stock-adjustment.dto'
import { UpdateStockAdjustmentDto } from './dto/update-stock-adjustment.dto'
import { StockAdjustmentsService } from './stock-adjustments.service'
@Controller('stock-adjustments')
export class StockAdjustmentsController {
constructor(private readonly service: StockAdjustmentsService) {}
@Post()
create(@Body() dto: CreateStockAdjustmentDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateStockAdjustmentDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { StockAdjustmentsController } from './stock-adjustments.controller'
import { StockAdjustmentsService } from './stock-adjustments.service'
@Module({
imports: [PrismaModule],
controllers: [StockAdjustmentsController],
providers: [StockAdjustmentsService],
})
export class StockAdjustmentsModule {}
@@ -0,0 +1,63 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateStockAdjustmentDto } from './dto/create-stock-adjustment.dto'
@Injectable()
export class StockAdjustmentsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateStockAdjustmentDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.stockAdjustment.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.stockAdjustment.findMany({
include: { product: true, inventory: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.stockAdjustment.findUnique({
where: { id },
include: { product: true, inventory: 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, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.stockAdjustment.update({
where: { id },
data: payload,
})
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.stockAdjustment.delete({ where: { id } })
return ResponseMapper.single(item)
}
}
@@ -0,0 +1,17 @@
import { Controller, Get, Param } from '@nestjs/common'
import { StockBalanceService } from './stock-balance.service'
@Controller('stock-balance')
export class StockBalanceController {
constructor(private readonly service: StockBalanceService) {}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':itemId')
findOne(@Param('itemId') itemId: string) {
return this.service.findOne(Number(itemId))
}
}
+11
View File
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { StockBalanceController } from './stock-balance.controller'
import { StockBalanceService } from './stock-balance.service'
@Module({
imports: [PrismaModule],
controllers: [StockBalanceController],
providers: [StockBalanceService],
})
export class StockBalanceModule {}
@@ -0,0 +1,19 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
@Injectable()
export class StockBalanceService {
constructor(private prisma: PrismaService) {}
async findAll() {
const items = await this.prisma.stockBalance.findMany()
return ResponseMapper.list(items)
}
async findOne(ProductId: number) {
const item = await this.prisma.stockBalance.findUnique({ where: { ProductId } })
if (!item) return null
return ResponseMapper.single(item)
}
}
@@ -0,0 +1,34 @@
import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsNumber, IsString } from 'class-validator'
import { MovementReferenceType, MovementType } from '../../generated/prisma/enums'
export class CreateStockMovementDto {
@IsEnum(MovementType)
type: MovementType
@Type(() => Number)
@IsNumber()
quantity: number
@Type(() => Number)
@IsNumber()
fee: number
@Type(() => Number)
@IsNumber()
totalCost: number
@IsEnum(MovementReferenceType)
referenceType: MovementReferenceType
@IsString()
referenceId: string
@Type(() => Number)
@IsInt()
productId: number
@Type(() => Number)
@IsInt()
inventoryId: number
}
@@ -0,0 +1,42 @@
import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsNumber, IsOptional, IsString } from 'class-validator'
import { MovementReferenceType, MovementType } from '../../generated/prisma/enums'
export class UpdateStockMovementDto {
@IsOptional()
@IsEnum(MovementType)
type?: MovementType
@IsOptional()
@Type(() => Number)
@IsNumber()
quantity?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
unitCost?: number
@IsOptional()
@Type(() => Number)
@IsNumber()
totalCost?: number
@IsOptional()
@IsEnum(MovementReferenceType)
referenceType?: MovementReferenceType
@IsOptional()
@IsString()
referenceId?: string
@IsOptional()
@Type(() => Number)
@IsInt()
productId?: number
@IsOptional()
@Type(() => Number)
@IsInt()
inventoryId?: number
}
@@ -0,0 +1,34 @@
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
import { CreateStockMovementDto } from './dto/create-stock-movement.dto'
import { UpdateStockMovementDto } from './dto/update-stock-movement.dto'
import { StockMovementsService } from './stock-movements.service'
@Controller('stock-movements')
export class StockMovementsController {
constructor(private readonly service: StockMovementsService) {}
@Post()
create(@Body() dto: CreateStockMovementDto) {
return this.service.create(dto)
}
@Get()
findAll() {
return this.service.findAll()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(Number(id))
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateStockMovementDto) {
return this.service.update(Number(id), dto)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.service.remove(Number(id))
}
}
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaModule } from '../prisma/prisma.module'
import { StockMovementsController } from './stock-movements.controller'
import { StockMovementsService } from './stock-movements.service'
@Module({
imports: [PrismaModule],
controllers: [StockMovementsController],
providers: [StockMovementsService],
})
export class StockMovementsModule {}
@@ -0,0 +1,60 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../common/response/response-mapper'
import { PrismaService } from '../prisma/prisma.service'
import { CreateStockMovementDto } from './dto/create-stock-movement.dto'
@Injectable()
export class StockMovementsService {
constructor(private prisma: PrismaService) {}
async create(dto: CreateStockMovementDto) {
const payload: any = { ...dto }
if (Object.prototype.hasOwnProperty.call(payload, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.stockMovement.create({ data: payload })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.stockMovement.findMany({
include: { product: true, inventory: true },
})
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.stockMovement.findUnique({
where: { id },
include: { product: true, inventory: 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, 'productId')) {
payload.product = { connect: { id: Number(payload.productId) } }
delete payload.productId
}
if (Object.prototype.hasOwnProperty.call(payload, 'inventoryId')) {
payload.inventory = { connect: { id: Number(payload.inventoryId) } }
delete payload.inventoryId
}
const item = await this.prisma.stockMovement.update({ where: { id }, data: payload })
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.stockMovement.delete({ where: { id } })
return ResponseMapper.single(item)
}
}