1. 重构项目文件结构,统一文件存放位置与命名规则 2. 配置tsconfig路径别名,替换原有相对路径导入 3. 迁移drama-status枚举到dramas.types统一管理 4. 新增全局配置文件与工具类,补充完整注释与文档 5. 修复所有导入路径与依赖引用问题
124 lines
2.3 KiB
TypeScript
124 lines
2.3 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsArray, IsEmail, IsIn, IsInt, IsOptional, IsString, Min, MinLength } from "class-validator";
|
|
|
|
export class AdminLoginDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
username: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(6)
|
|
password: string;
|
|
}
|
|
|
|
export class ChangeAdminPasswordDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
oldPassword: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(6)
|
|
newPassword: string;
|
|
}
|
|
|
|
export class CreateAdminUserDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
username: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(6)
|
|
password: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
nickname?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsEmail()
|
|
email?: string;
|
|
|
|
@ApiPropertyOptional({ type: [Number] })
|
|
@IsOptional()
|
|
@IsArray()
|
|
@IsInt({ each: true })
|
|
@Min(1, { each: true })
|
|
roleIds?: number[];
|
|
}
|
|
|
|
export class CreatePermissionDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
code: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
}
|
|
|
|
export class CreateRoleDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
code: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
@ApiPropertyOptional({ type: [Number] })
|
|
@IsOptional()
|
|
@IsArray()
|
|
@IsInt({ each: true })
|
|
@Min(1, { each: true })
|
|
permissionIds?: number[];
|
|
}
|
|
|
|
export class UpdateAdminProfileDto {
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
nickname?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsEmail()
|
|
email?: string;
|
|
}
|
|
|
|
export class UpdateAdminRolesDto {
|
|
@ApiProperty({ type: [Number] })
|
|
@IsArray()
|
|
@IsInt({ each: true })
|
|
@Min(1, { each: true })
|
|
roleIds: number[];
|
|
}
|
|
|
|
export class UpdateAdminStatusDto {
|
|
@ApiProperty({ enum: ["active", "disabled"] })
|
|
@IsIn(["active", "disabled"])
|
|
status: "active" | "disabled";
|
|
}
|
|
|
|
export class UpdateRolePermissionsDto {
|
|
@ApiProperty({ type: [Number] })
|
|
@IsArray()
|
|
@IsInt({ each: true })
|
|
@Min(1, { each: true })
|
|
permissionIds: number[];
|
|
}
|