product
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
ArrayMinSize,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
@@ -10,19 +11,19 @@ import {
|
||||
IsString,
|
||||
Min,
|
||||
Length,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class CreateVariantDto {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ApiPropertyOptional()
|
||||
id: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsNotEmpty()
|
||||
value: string
|
||||
|
||||
@IsNumber()
|
||||
@@ -50,8 +51,10 @@ export class CreateProductDto {
|
||||
@ApiPropertyOptional({ example: 'مثلا رنگ ،سایز' })
|
||||
attribute?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Length(1, 100)
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateVariantDto)
|
||||
@ApiPropertyOptional({
|
||||
type: CreateVariantDto,
|
||||
example: [{
|
||||
|
||||
Reference in New Issue
Block a user