123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- 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 CreateMenuDto {
- @ApiProperty()
- @IsString()
- @IsNotEmpty({ message: '标题不能为空' })
- @Length(1, 200, {
- message: `用户名长度必须大于$constraint1到$constraint2之间,当前传递的值是$value`,
- })
- title: string;
- @ApiProperty({ required: false })
- @IsString()
- @IsOptional()
- cover?: string;
- @ApiProperty({ required: true })
- @IsNumber()
- userId: number;
- @ApiProperty({ nullable: true, required: false, default: null })
- @IsNumber()
- @IsOptional()
- categoryId?: number;
- @ApiProperty({ required: false, default: true })
- @IsBoolean()
- @IsOptional()
- isPublish?: boolean;
- @ApiProperty({ required: false })
- @IsBoolean()
- @IsOptional()
- enable?: boolean;
- @ApiProperty({ nullable: true, required: false, default: null })
- @IsNumber()
- @IsOptional()
- parentId?: number;
- }
- export class GetMenuDto {
- @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 QueryMenuDto extends GetMenuDto {}
- export class UpdateMenuDto {
- @ApiProperty()
- @IsString()
- @IsOptional()
- @Length(1, 200, {
- message: `用户名长度必须大于$constraint1到$constraint2之间,当前传递的值是$value`,
- })
- title?: string;
- @ApiProperty({ required: false })
- @IsBoolean()
- @IsOptional()
- enable?: boolean;
- @ApiProperty({ required: false })
- @IsOptional()
- @IsNumber()
- userId?: number;
- @ApiProperty({ required: false })
- @IsOptional()
- @IsNumber()
- categoryId?: number;
- }
|