feat: add safe user directory query
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
|
||||
|
||||
export class UserDirectoryQueryDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
page = 1;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(50)
|
||||
limit = 20;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
search?: string;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
export class UserDirectoryReferenceDto {
|
||||
id: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export class UserDirectoryTeamDto {
|
||||
id: number;
|
||||
name: string;
|
||||
alias: string;
|
||||
}
|
||||
|
||||
export class UserDirectoryAssignmentDto {
|
||||
id: number;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
active: boolean;
|
||||
team: UserDirectoryTeamDto;
|
||||
teamRole: UserDirectoryReferenceDto | null;
|
||||
}
|
||||
|
||||
export class UserDirectorySummaryDto {
|
||||
id: number;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
status: UserDirectoryReferenceDto | null;
|
||||
assignments: UserDirectoryAssignmentDto[];
|
||||
}
|
||||
|
||||
export class AdminUserDirectorySummaryDto extends UserDirectorySummaryDto {
|
||||
email: string | null;
|
||||
role: UserDirectoryReferenceDto | null;
|
||||
}
|
||||
|
||||
export class UserDirectoryPageDto {
|
||||
data: Array<UserDirectorySummaryDto | AdminUserDirectorySummaryDto>;
|
||||
page: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
hasNextPage: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user