fix: add DTO validation, transactional imports, role-not-found handling, null role guard

This commit is contained in:
2026-07-09 11:28:11 +08:00
parent 33e6cb445c
commit 0cfdab95ee
5 changed files with 241 additions and 457 deletions

View File

@@ -0,0 +1,30 @@
import {
IsArray,
IsString,
IsNumber,
IsOptional,
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
export class ImportUserItemDto {
@IsString()
dingUserId: string;
@IsString()
name: string;
@IsString()
mobile: string;
@IsOptional()
@IsNumber()
roleId: number | null;
}
export class ImportUsersDto {
@IsArray()
@ValidateNested({ each: true })
@Type(() => ImportUserItemDto)
users: ImportUserItemDto[];
}