102 lines
2.2 KiB
TypeScript
102 lines
2.2 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||
import { IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||
|
||
export class CreateResourceDto {
|
||
@ApiProperty({ description: '类型:menu/button/api' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
type!: string;
|
||
|
||
@ApiProperty({ description: '资源 code(租户内唯一,兼权限标识)' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
code!: string;
|
||
|
||
@ApiProperty({ description: '名称' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
name!: string;
|
||
|
||
@ApiPropertyOptional({ description: '父资源 code' })
|
||
@IsOptional()
|
||
@IsString()
|
||
parentCode?: string;
|
||
|
||
@ApiPropertyOptional({ description: '路由 path(menu)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
path?: string;
|
||
|
||
@ApiPropertyOptional({ description: '前端组件(menu)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
component?: string;
|
||
|
||
@ApiPropertyOptional({ description: 'HTTP method(api)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
method?: string;
|
||
|
||
@ApiPropertyOptional({ description: '接口 path(api)' })
|
||
@IsOptional()
|
||
@IsString()
|
||
apiPath?: string;
|
||
|
||
@ApiPropertyOptional({ description: '图标' })
|
||
@IsOptional()
|
||
@IsString()
|
||
icon?: string;
|
||
|
||
@ApiPropertyOptional({ description: '排序', default: 0 })
|
||
@IsOptional()
|
||
@IsInt()
|
||
sort?: number;
|
||
}
|
||
|
||
export class UpdateResourceDto {
|
||
@ApiPropertyOptional({ description: '名称' })
|
||
@IsOptional()
|
||
@IsString()
|
||
name?: string;
|
||
|
||
@ApiPropertyOptional({ description: '父资源 code' })
|
||
@IsOptional()
|
||
@IsString()
|
||
parentCode?: string;
|
||
|
||
@ApiPropertyOptional({ description: '路由 path' })
|
||
@IsOptional()
|
||
@IsString()
|
||
path?: string;
|
||
|
||
@ApiPropertyOptional({ description: '前端组件' })
|
||
@IsOptional()
|
||
@IsString()
|
||
component?: string;
|
||
|
||
@ApiPropertyOptional({ description: 'HTTP method' })
|
||
@IsOptional()
|
||
@IsString()
|
||
method?: string;
|
||
|
||
@ApiPropertyOptional({ description: '接口 path' })
|
||
@IsOptional()
|
||
@IsString()
|
||
apiPath?: string;
|
||
|
||
@ApiPropertyOptional({ description: '图标' })
|
||
@IsOptional()
|
||
@IsString()
|
||
icon?: string;
|
||
|
||
@ApiPropertyOptional({ description: '排序' })
|
||
@IsOptional()
|
||
@IsInt()
|
||
sort?: number;
|
||
|
||
@ApiPropertyOptional({ description: '状态:enabled/disabled' })
|
||
@IsOptional()
|
||
@IsString()
|
||
status?: string;
|
||
}
|