mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-28 19:59:08 +00:00
188 lines
3.5 KiB
TypeScript
188 lines
3.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
|
import { UserRole } from 'src/modules/roles/dto/entities';
|
|
|
|
export class Hierarchy {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
}
|
|
export class Customer {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
domain: string;
|
|
@ApiProperty()
|
|
tier: string;
|
|
@ApiProperty()
|
|
info: string;
|
|
@ApiProperty()
|
|
createdAt: string;
|
|
@ApiProperty()
|
|
updatedAt: string;
|
|
}
|
|
export class User {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
email: string;
|
|
@ApiProperty({ type: [UserRole] })
|
|
roles: UserRole[];
|
|
@ApiProperty()
|
|
jobTitle?: string;
|
|
@ApiProperty()
|
|
department?: string;
|
|
@ApiProperty()
|
|
hierarchy?: string;
|
|
@ApiPropertyOptional()
|
|
customer?: Customer;
|
|
@ApiProperty()
|
|
mfaStatus: string;
|
|
@ApiProperty()
|
|
createdAt: string;
|
|
@ApiProperty()
|
|
updatedAt: string;
|
|
@ApiProperty()
|
|
status: string;
|
|
@ApiPropertyOptional()
|
|
lastLogin?: string;
|
|
}
|
|
export class UserNoRoles extends OmitType(User, ['roles']) {}
|
|
export class UserNoRolesAndCustomer extends OmitType(UserNoRoles, [
|
|
'customer',
|
|
]) {}
|
|
export class IUserByCustomer extends OmitType(User, ['customer']) {
|
|
@ApiPropertyOptional()
|
|
permissions?: string[];
|
|
}
|
|
|
|
export class CreateUserReq {
|
|
@ApiPropertyOptional()
|
|
name?: string;
|
|
@ApiProperty()
|
|
email: string;
|
|
@ApiPropertyOptional()
|
|
roleNames?: string[];
|
|
@ApiPropertyOptional()
|
|
jobTitle?: string;
|
|
@ApiPropertyOptional()
|
|
department?: string;
|
|
@ApiPropertyOptional()
|
|
hierarchy?: string;
|
|
}
|
|
export class CreateUserRes {
|
|
@ApiProperty()
|
|
user: User;
|
|
}
|
|
export class BatchCreateUserReq {
|
|
@ApiProperty({ type: [CreateUserReq] })
|
|
users: CreateUserReq[];
|
|
}
|
|
|
|
class ErrorUsers {
|
|
@ApiProperty()
|
|
user: CreateUserReq;
|
|
@ApiProperty()
|
|
error: string;
|
|
}
|
|
|
|
export class BatchCreateUserRes {
|
|
@ApiProperty({ type: [User] })
|
|
usersCreated: User[];
|
|
@ApiProperty({ type: [ErrorUsers] })
|
|
errorUsers: ErrorUsers[];
|
|
}
|
|
|
|
export class UpdateUserReq {
|
|
@ApiPropertyOptional()
|
|
name?: string;
|
|
@ApiPropertyOptional()
|
|
email?: string;
|
|
@ApiPropertyOptional()
|
|
jobTitle?: string;
|
|
@ApiPropertyOptional()
|
|
department?: string;
|
|
@ApiPropertyOptional()
|
|
hierarchy?: string;
|
|
@ApiPropertyOptional()
|
|
roleNames?: string[];
|
|
}
|
|
|
|
export class UpdateUserRes {
|
|
@ApiProperty()
|
|
user: IUserByCustomer;
|
|
}
|
|
export class GetAllUsersByCustomerIdRes {
|
|
@ApiProperty({ type: [IUserByCustomer] })
|
|
users: IUserByCustomer[];
|
|
@ApiProperty()
|
|
departments: string[];
|
|
@ApiProperty()
|
|
jobTitles: string[];
|
|
}
|
|
|
|
export class AssignRoleToUserReq {
|
|
@ApiProperty()
|
|
userId: string;
|
|
@ApiProperty()
|
|
roleId: string;
|
|
}
|
|
export class UnassignRoleToUserReq {
|
|
@ApiProperty()
|
|
userId: string;
|
|
@ApiProperty()
|
|
roleId: string;
|
|
}
|
|
export class DeleteUserRes {
|
|
@ApiProperty()
|
|
id: string;
|
|
}
|
|
|
|
export class SearchUserReq {
|
|
@ApiProperty()
|
|
s: string;
|
|
}
|
|
|
|
export class SetUserRolesReq {
|
|
@ApiProperty()
|
|
userId: string;
|
|
@ApiProperty()
|
|
roleNames: string[];
|
|
}
|
|
|
|
export class SetUserRolesRes {
|
|
@ApiProperty()
|
|
user: IUserByCustomer;
|
|
}
|
|
|
|
export class SearchUserRes extends GetAllUsersByCustomerIdRes {}
|
|
|
|
export class GetAllHierarchiesRes {
|
|
@ApiProperty({ type: [Hierarchy] })
|
|
hierarchies: Hierarchy[];
|
|
}
|
|
|
|
export class GetAllJobTitlesRes {
|
|
@ApiProperty()
|
|
jobTitles: string[];
|
|
}
|
|
export class GetAllDepartmentsRes {
|
|
@ApiProperty()
|
|
departments: string[];
|
|
}
|
|
|
|
|
|
export interface UserReporter {
|
|
name: string;
|
|
email: string;
|
|
mfaStatus: string;
|
|
status: string;
|
|
lastLogin: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|