a782d61890
- 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.
64 lines
964 B
TypeScript
64 lines
964 B
TypeScript
import { Type } from 'class-transformer'
|
|
import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'
|
|
|
|
export class UpdateProductVariantDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
name?: string
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
sku?: string
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
barcode?: string
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
imageUrl?: string
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
attachmentId?: number
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
unit?: string
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
discount?: number
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
quantity?: number
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
alertQuantity?: number
|
|
|
|
@IsOptional()
|
|
@Type(() => Boolean)
|
|
@IsBoolean()
|
|
isActive?: boolean
|
|
|
|
@IsOptional()
|
|
@Type(() => Boolean)
|
|
@IsBoolean()
|
|
isFeatured?: boolean
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
productId?: number
|
|
}
|