This commit is contained in:
2026-02-14 11:53:19 +03:30
parent 0ebe9b10f1
commit 92e2347ad1
@@ -1,5 +1,6 @@
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { import {
ArrayMinSize,
IsArray, IsArray,
IsBoolean, IsBoolean,
IsEnum, IsEnum,
@@ -10,19 +11,19 @@ import {
IsString, IsString,
Min, Min,
Length, Length,
ValidateNested,
} from 'class-validator'; } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class CreateVariantDto { export class CreateVariantDto {
@IsString()
@IsOptional() @IsOptional()
@IsString()
@ApiPropertyOptional() @ApiPropertyOptional()
id: string id: string
@IsString() @IsString()
@ApiProperty() @ApiProperty()
@IsOptional() @IsOptional()
@IsNotEmpty()
value: string value: string
@IsNumber() @IsNumber()
@@ -50,8 +51,10 @@ export class CreateProductDto {
@ApiPropertyOptional({ example: 'مثلا رنگ ،سایز' }) @ApiPropertyOptional({ example: 'مثلا رنگ ،سایز' })
attribute?: string; attribute?: string;
@IsOptional() @IsArray()
@Length(1, 100) @ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => CreateVariantDto)
@ApiPropertyOptional({ @ApiPropertyOptional({
type: CreateVariantDto, type: CreateVariantDto,
example: [{ example: [{