Files
maestro/src/modules/users/dtos/entities.ts
T

117 lines
2.2 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Role } from 'src/modules/roles/dto/entities';
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: [Role] })
roles: Role[];
@ApiProperty()
jobTitle: string;
@ApiProperty()
department: string;
@ApiProperty()
hierarchy: number;
@ApiProperty()
customer: Customer;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class UserByCustomer {
@ApiProperty({ type: [Role] })
roles: Role[];
@ApiProperty()
id: string;
@ApiProperty()
name: string;
@ApiProperty()
username: string;
@ApiProperty()
mfaStatus: string;
@ApiProperty()
createdAt: string;
@ApiProperty()
updatedAt: string;
}
export class CreateUserReq {
@ApiPropertyOptional()
name: string;
@ApiProperty()
email: string;
@ApiPropertyOptional()
roles: string[];
@ApiPropertyOptional()
jobTitle: string;
@ApiPropertyOptional()
department: string;
@ApiPropertyOptional()
hierarchy: number;
}
export class CreateUserRes {
@ApiProperty()
user: User;
}
export class BatchCreateUserReq {
@ApiProperty({ type: [CreateUserReq] })
users: CreateUserReq[];
}
export class BatchCreateUserRes {
@ApiProperty({ type: [User] })
users: User[];
}
export class GetAllUsersByCustomerIdReq {
@ApiPropertyOptional()
s: string;
}
export class GetAllUsersByCustomerIdRes {
@ApiProperty({ type: [UserByCustomer] })
users: UserByCustomer[];
}
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 SearchUserRes extends GetAllUsersByCustomerIdRes {}