12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { ApiProperty, ApiBody, PartialType } from '@nestjs/swagger';
- import { Exclude } from 'class-transformer';
- import {
- Allow,
- IsArray,
- IsBoolean,
- IsNotEmpty,
- IsNumber,
- IsOptional,
- IsString,
- Length,
- } from 'class-validator';
- export class CreateCategoryDto {
- @ApiProperty()
- @IsString()
- @IsNotEmpty({ message: '标题不能为空' })
- @Length(1, 200, {
- message: `用户名长度必须大于$constraint1到$constraint2之间,当前传递的值是$value`,
- })
- title: string;
- @ApiProperty({ required: false })
- @IsBoolean()
- @IsOptional()
- enable?: boolean;
- @ApiProperty({ required: false })
- @IsNumber()
- @IsOptional()
- parentId?: number;
- }
- export class GetCategoryDto {
- @ApiProperty({ required: false })
- @Allow()
- pageSize?: number;
- @ApiProperty({ required: false })
- @Allow()
- pageNo?: number;
- @ApiProperty({ required: false })
- @Allow()
- title?: string;
- @ApiProperty({ required: false })
- @Allow()
- enable?: boolean;
- }
- export class UpdateCategoryDto extends PartialType(CreateCategoryDto) {}
|