mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 14:29:07 +00:00
FIX: get departments and jobTitles
This commit is contained in:
@@ -54,7 +54,17 @@ export class UsersService implements OnModuleInit {
|
||||
this.usersClientService.UserFindAllByCustomerId({ customerId }),
|
||||
);
|
||||
this.adjustUsersPayload(users);
|
||||
return { users };
|
||||
const dintinctDepartments = [...new Set(users.map((u) => u.department))]
|
||||
.filter((value) => value != null)
|
||||
.sort();
|
||||
const dintinctJobTitles = [...new Set(users.map((u) => u.jobTitle))]
|
||||
.filter((value) => value != null)
|
||||
.sort();
|
||||
return {
|
||||
users,
|
||||
jobTitles: dintinctJobTitles,
|
||||
departments: dintinctDepartments,
|
||||
};
|
||||
}
|
||||
|
||||
async findOneById(id: string) {
|
||||
@@ -156,6 +166,18 @@ export class UsersService implements OnModuleInit {
|
||||
return { hierarchies };
|
||||
}
|
||||
|
||||
async getAllDepartments(customerId?: string) {
|
||||
return lastValueFrom(
|
||||
this.usersClientService.FindDistinctDepartments({ customerId }),
|
||||
);
|
||||
}
|
||||
|
||||
async getAllJobTitles(customerId?: string) {
|
||||
return lastValueFrom(
|
||||
this.usersClientService.FindDistinctJobTitles({ customerId }),
|
||||
);
|
||||
}
|
||||
|
||||
adjustUsersPayload(users: UserByCustomer[]) {
|
||||
users?.forEach((u) => {
|
||||
if (!u) return;
|
||||
|
||||
Reference in New Issue
Block a user