product
This commit is contained in:
@@ -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: [{
|
||||||
|
|||||||
Reference in New Issue
Block a user