forked from wangziqi/gongxue-base
fix: add DTO validation, transactional imports, role-not-found handling, null role guard
This commit is contained in:
30
apps/server/src/sync/dto/import-users.dto.ts
Normal file
30
apps/server/src/sync/dto/import-users.dto.ts
Normal 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user