import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger'; import { IsArray, IsDate, IsDateString, IsIn, IsInt, IsNumber, IsOptional, IsString, Matches, MinLength } from 'class-validator'; import { PagerDto } from '~/common/dto/pager.dto'; import { Storage } from '../tools/storage/storage.entity'; import { IsUnique } from '~/shared/database/constraints/unique.constraint'; import { ProductEntity } from './product.entity'; export class ProductDto { @ApiProperty({ description: '产品名称' }) @IsString() name: string; @ApiProperty({ description: '所属公司' }) @IsOptional() @IsNumber() companyId: number; @ApiProperty({ description: '附件' }) files: Storage[]; } export class ProductUpdateDto extends PartialType(ProductDto) { @ApiProperty({ description: '附件' }) @IsOptional() @IsArray() fileIds: number[]; } export class ProductQueryDto extends IntersectionType( PagerDto, PartialType(ProductDto) ) { @ApiProperty({ description: '所属公司名称' }) @IsOptional() @IsString() company: string; @ApiProperty({ description: '产品名字' }) @IsOptional() @IsString() name?: string; }