import { ApiProperty } from '@nestjs/swagger'; import { ArrayMinSize, IsArray, IsInt, IsNotEmpty, IsOptional, IsString, Min, } from 'class-validator'; export class CreateGoodDto { @ApiProperty() @IsString() @IsNotEmpty() goodName!: string; @ApiProperty() @IsInt() @Min(1) originGoodId!: number; @ApiProperty({ required: false, nullable: true, type: [Number], description: '副源原产品 ID,不含主源' }) @IsOptional() @IsArray() @IsInt({ each: true }) @Min(1, { each: true }) mergedOriginGoodIds?: number[]; @ApiProperty() @IsInt() @Min(1) countryId!: number; @ApiProperty() @IsInt() @Min(1) categoryId!: number; @ApiProperty({ required: false, nullable: true, type: [Number] }) @IsOptional() @IsArray() @ArrayMinSize(1) @IsInt({ each: true }) @Min(1, { each: true }) tagIds?: number[]; @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsInt() @Min(1) positionId?: number; @ApiProperty({ required: false, default: 0 }) @IsOptional() @IsInt() @Min(0) goodPriority?: number; @ApiProperty({ required: false, nullable: true }) @IsOptional() @IsString() goodImage?: string; }