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 { CompanyEntity } from './company.entity'; import { DomainType, SkDomain } from '~/common/decorators/domain.decorator'; export class CompanyDto extends DomainType { @ApiProperty({ description: '公司名称' }) @IsUnique(CompanyEntity, { message: '已存在同名公司' }) @IsString() name: string; @ApiProperty({ description: '附件' }) files: Storage[]; } export class CompanyUpdateDto extends PartialType(CompanyDto) { @ApiProperty({ description: '附件' }) @IsOptional() @IsArray() fileIds: number[]; } export class ComapnyCreateDto extends PartialType(CompanyDto) { @ApiProperty({ description: '附件' }) @IsOptional() @IsArray() fileIds: number[]; } export class CompanyQueryDto extends IntersectionType( PagerDto, PartialType(CompanyDto), DomainType ) { @ApiProperty({ description: '公司名称' }) @IsOptional() @IsString() name: string; }