import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsArray, IsNotEmpty, IsOptional, IsString } from 'class-validator'; export class CreateRoleDto { @ApiProperty({ description: '角色编码' }) @IsString() @IsNotEmpty() code!: string; @ApiProperty({ description: '角色名称' }) @IsString() @IsNotEmpty() name!: string; @ApiPropertyOptional({ description: '数据权限:all/dept/dept_and_child/self/custom', default: 'all' }) @IsOptional() @IsString() dataScope?: string; @ApiPropertyOptional({ description: '备注' }) @IsOptional() @IsString() remark?: string; } export class UpdateRoleDto { @ApiPropertyOptional({ description: '角色名称' }) @IsOptional() @IsString() name?: string; @ApiPropertyOptional({ description: '数据权限:all/dept/dept_and_child/self/custom' }) @IsOptional() @IsString() dataScope?: string; @ApiPropertyOptional({ description: '状态:enabled/disabled' }) @IsOptional() @IsString() status?: string; @ApiPropertyOptional({ description: '备注' }) @IsOptional() @IsString() remark?: string; } export class AssignResourcesDto { @ApiProperty({ description: '资源 code 列表', type: [String] }) @IsArray() @IsString({ each: true }) resourceCodes!: string[]; }