liuyun 24790e8985 feat: add Swagger API docs (/docs) with DTO schemas
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-10 21:39:37 +08:00

54 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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[];
}