feat: add product variant management functionality
- Implemented CreateProductVariantDto and UpdateProductVariantDto for product variant data transfer. - Developed ProductVariantsController to handle CRUD operations for product variants. - Created ProductVariantsService to interact with the database using Prisma. - Added ProductVariantsModule to encapsulate the product variant feature. - Included response mapping for consistent API responses.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -386,8 +386,8 @@ type FieldRefInputType<Model, FieldType> = Model extends never ? never : FieldRe
|
||||
export const ModelName = {
|
||||
User: 'User',
|
||||
Role: 'Role',
|
||||
ProductVariant: 'ProductVariant',
|
||||
Product: 'Product',
|
||||
ProductInfo: 'ProductInfo',
|
||||
ProductBrand: 'ProductBrand',
|
||||
ProductCategory: 'ProductCategory',
|
||||
Supplier: 'Supplier',
|
||||
@@ -409,7 +409,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "role" | "product" | "productInfo" | "productBrand" | "productCategory" | "supplier" | "customer" | "inventory" | "store"
|
||||
modelProps: "user" | "role" | "productVariant" | "product" | "productBrand" | "productCategory" | "supplier" | "customer" | "inventory" | "store"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -545,6 +545,72 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductVariant: {
|
||||
payload: Prisma.$ProductVariantPayload<ExtArgs>
|
||||
fields: Prisma.ProductVariantFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ProductVariantFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ProductVariantFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ProductVariantFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ProductVariantFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ProductVariantFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ProductVariantCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ProductVariantCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ProductVariantDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ProductVariantUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ProductVariantDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ProductVariantUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ProductVariantUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ProductVariantAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateProductVariant>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ProductVariantGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductVariantGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ProductVariantCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductVariantCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
Product: {
|
||||
payload: Prisma.$ProductPayload<ExtArgs>
|
||||
fields: Prisma.ProductFieldRefs
|
||||
@@ -611,72 +677,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductInfo: {
|
||||
payload: Prisma.$ProductInfoPayload<ExtArgs>
|
||||
fields: Prisma.ProductInfoFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ProductInfoFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ProductInfoFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ProductInfoFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ProductInfoFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ProductInfoFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ProductInfoCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ProductInfoCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ProductInfoDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ProductInfoUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ProductInfoDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ProductInfoUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ProductInfoUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ProductInfoAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateProductInfo>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ProductInfoGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductInfoGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ProductInfoCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductInfoCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductBrand: {
|
||||
payload: Prisma.$ProductBrandPayload<ExtArgs>
|
||||
fields: Prisma.ProductBrandFieldRefs
|
||||
@@ -1137,16 +1137,15 @@ export const RoleScalarFieldEnum = {
|
||||
export type RoleScalarFieldEnum = (typeof RoleScalarFieldEnum)[keyof typeof RoleScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductScalarFieldEnum = {
|
||||
export const ProductVariantScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
basePrice: 'basePrice',
|
||||
salePrice: 'salePrice',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
attachmentId: 'attachmentId',
|
||||
unit: 'unit',
|
||||
discount: 'discount',
|
||||
quantity: 'quantity',
|
||||
alertQuantity: 'alertQuantity',
|
||||
isActive: 'isActive',
|
||||
@@ -1154,27 +1153,26 @@ export const ProductScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
productInfoId: 'productInfoId'
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
export type ProductVariantScalarFieldEnum = (typeof ProductVariantScalarFieldEnum)[keyof typeof ProductVariantScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoScalarFieldEnum = {
|
||||
export const ProductScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
productType: 'productType',
|
||||
metaData: 'metaData',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
brandId: 'brandId',
|
||||
categoryId: 'categoryId',
|
||||
supplierId: 'supplierId'
|
||||
categoryId: 'categoryId'
|
||||
} as const
|
||||
|
||||
export type ProductInfoScalarFieldEnum = (typeof ProductInfoScalarFieldEnum)[keyof typeof ProductInfoScalarFieldEnum]
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandScalarFieldEnum = {
|
||||
@@ -1324,25 +1322,25 @@ export const RoleOrderByRelevanceFieldEnum = {
|
||||
export type RoleOrderByRelevanceFieldEnum = (typeof RoleOrderByRelevanceFieldEnum)[keyof typeof RoleOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
export const ProductVariantOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
unit: 'unit'
|
||||
} as const
|
||||
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
export type ProductVariantOrderByRelevanceFieldEnum = (typeof ProductVariantOrderByRelevanceFieldEnum)[keyof typeof ProductVariantOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoOrderByRelevanceFieldEnum = {
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
productType: 'productType'
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type ProductInfoOrderByRelevanceFieldEnum = (typeof ProductInfoOrderByRelevanceFieldEnum)[keyof typeof ProductInfoOrderByRelevanceFieldEnum]
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandOrderByRelevanceFieldEnum = {
|
||||
@@ -1448,13 +1446,6 @@ export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'BigInt'
|
||||
*/
|
||||
export type BigIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BigInt'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Decimal'
|
||||
*/
|
||||
@@ -1572,8 +1563,8 @@ export type PrismaClientOptions = ({
|
||||
export type GlobalOmitConfig = {
|
||||
user?: Prisma.UserOmit
|
||||
role?: Prisma.RoleOmit
|
||||
productVariant?: Prisma.ProductVariantOmit
|
||||
product?: Prisma.ProductOmit
|
||||
productInfo?: Prisma.ProductInfoOmit
|
||||
productBrand?: Prisma.ProductBrandOmit
|
||||
productCategory?: Prisma.ProductCategoryOmit
|
||||
supplier?: Prisma.SupplierOmit
|
||||
|
||||
@@ -53,8 +53,8 @@ export const AnyNull = runtime.AnyNull
|
||||
export const ModelName = {
|
||||
User: 'User',
|
||||
Role: 'Role',
|
||||
ProductVariant: 'ProductVariant',
|
||||
Product: 'Product',
|
||||
ProductInfo: 'ProductInfo',
|
||||
ProductBrand: 'ProductBrand',
|
||||
ProductCategory: 'ProductCategory',
|
||||
Supplier: 'Supplier',
|
||||
@@ -104,16 +104,15 @@ export const RoleScalarFieldEnum = {
|
||||
export type RoleScalarFieldEnum = (typeof RoleScalarFieldEnum)[keyof typeof RoleScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductScalarFieldEnum = {
|
||||
export const ProductVariantScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
basePrice: 'basePrice',
|
||||
salePrice: 'salePrice',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
attachmentId: 'attachmentId',
|
||||
unit: 'unit',
|
||||
discount: 'discount',
|
||||
quantity: 'quantity',
|
||||
alertQuantity: 'alertQuantity',
|
||||
isActive: 'isActive',
|
||||
@@ -121,27 +120,26 @@ export const ProductScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
productInfoId: 'productInfoId'
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
export type ProductVariantScalarFieldEnum = (typeof ProductVariantScalarFieldEnum)[keyof typeof ProductVariantScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoScalarFieldEnum = {
|
||||
export const ProductScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
productType: 'productType',
|
||||
metaData: 'metaData',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
brandId: 'brandId',
|
||||
categoryId: 'categoryId',
|
||||
supplierId: 'supplierId'
|
||||
categoryId: 'categoryId'
|
||||
} as const
|
||||
|
||||
export type ProductInfoScalarFieldEnum = (typeof ProductInfoScalarFieldEnum)[keyof typeof ProductInfoScalarFieldEnum]
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandScalarFieldEnum = {
|
||||
@@ -291,25 +289,25 @@ export const RoleOrderByRelevanceFieldEnum = {
|
||||
export type RoleOrderByRelevanceFieldEnum = (typeof RoleOrderByRelevanceFieldEnum)[keyof typeof RoleOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
export const ProductVariantOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
unit: 'unit'
|
||||
} as const
|
||||
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
export type ProductVariantOrderByRelevanceFieldEnum = (typeof ProductVariantOrderByRelevanceFieldEnum)[keyof typeof ProductVariantOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoOrderByRelevanceFieldEnum = {
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
productType: 'productType'
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type ProductInfoOrderByRelevanceFieldEnum = (typeof ProductInfoOrderByRelevanceFieldEnum)[keyof typeof ProductInfoOrderByRelevanceFieldEnum]
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandOrderByRelevanceFieldEnum = {
|
||||
|
||||
Reference in New Issue
Block a user