2024-03-04 17:31:28 +08:00
|
|
|
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;
|
|
|
|
|
2024-03-05 13:57:03 +08:00
|
|
|
@ApiProperty({ description: '所属公司' })
|
|
|
|
@IsOptional()
|
|
|
|
@IsNumber()
|
|
|
|
companyId: number;
|
|
|
|
|
2024-03-04 17:31:28 +08:00
|
|
|
@ApiProperty({ description: '附件' })
|
|
|
|
files: Storage[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ProductUpdateDto extends PartialType(ProductDto) {
|
|
|
|
@ApiProperty({ description: '附件' })
|
|
|
|
@IsOptional()
|
|
|
|
@IsArray()
|
|
|
|
fileIds: number[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ProductQueryDto extends IntersectionType(
|
|
|
|
PagerDto<ProductDto>,
|
|
|
|
PartialType(ProductDto)
|
2024-03-05 13:57:03 +08:00
|
|
|
) {
|
|
|
|
@ApiProperty({ description: '所属公司名称' })
|
|
|
|
@IsOptional()
|
|
|
|
@IsString()
|
|
|
|
company: string;
|
2024-03-05 22:27:01 +08:00
|
|
|
|
|
|
|
@ApiProperty({ description: '产品名字' })
|
|
|
|
@IsOptional()
|
|
|
|
@IsString()
|
|
|
|
name?: string;
|
2024-03-05 13:57:03 +08:00
|
|
|
}
|