Remove broken completeOfficeRoles
This commit is contained in:
parent
e4d8064abc
commit
c8f7c3e08e
@ -93,8 +93,6 @@ export default class OfficeRoleService extends AbstractService {
|
||||
return items;
|
||||
} else {
|
||||
for (let process of processes) {
|
||||
process = await this.completeOfficeRole(process);
|
||||
|
||||
// Update cache
|
||||
this.setItem('_office_roles_', process);
|
||||
|
||||
@ -121,14 +119,11 @@ export default class OfficeRoleService extends AbstractService {
|
||||
publicValues['isDeleted'] &&
|
||||
publicValues['isDeleted'] === 'false'
|
||||
).then(async (processes: any[]) => {
|
||||
if (processes.length === 0) {
|
||||
if (processes.length !== 1) {
|
||||
resolve(null);
|
||||
} else {
|
||||
let process: any = processes[0];
|
||||
process = await this.completeOfficeRole(process);
|
||||
|
||||
// Update cache
|
||||
this.setItem('_office_roles_', process);
|
||||
this.setItem('_office_roles_', processes[0]);
|
||||
|
||||
resolve(process);
|
||||
}
|
||||
@ -152,24 +147,4 @@ export default class OfficeRoleService extends AbstractService {
|
||||
});
|
||||
}
|
||||
|
||||
private static async completeOfficeRole(process: any): Promise<any> {
|
||||
if (process.processData.office) {
|
||||
process.processData.office = await new Promise<any>(async (resolve: (office: any) => void) => {
|
||||
const office: any = (await OfficeService.getOfficeByUid(process.processData.office.uid)).processData;
|
||||
resolve(office);
|
||||
});
|
||||
}
|
||||
|
||||
if (process.processData.rules && process.processData.rules.length > 0) {
|
||||
process.processData.rules = await new Promise<any[]>(async (resolve: (rules: any[]) => void) => {
|
||||
const rules: any[] = [];
|
||||
for (const rule of process.processData.rules) {
|
||||
rules.push((await RuleService.getRuleByUid(rule.uid)).processData);
|
||||
}
|
||||
resolve(rules);
|
||||
});
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user