🐛 Code optimization
This commit is contained in:
parent
e3ae788b01
commit
81fc7644a0
@ -110,18 +110,16 @@ export default class OfficeRolesController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.body.rules) {
|
if (req.body.rules) {
|
||||||
const rules = req.body.rules;
|
|
||||||
const allRules = await this.rulesService.get({
|
const allRules = await this.rulesService.get({
|
||||||
where: {
|
where: {
|
||||||
namespace: "notary",
|
namespace: "notary",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const rulesToEdit = rules.filter((rule: any) => {
|
req.body.rules = req.body.rules.filter((rule: any) => {
|
||||||
const ruleFound = allRules.find((r) => r.uid === rule.uid && r.namespace === "notary");
|
const ruleFound = allRules.find((r) => r.uid === rule.uid && r.namespace === "notary");
|
||||||
return ruleFound;
|
return ruleFound;
|
||||||
});
|
});
|
||||||
req.body.rules = rulesToEdit;
|
|
||||||
}
|
}
|
||||||
//init IOfficeRole resource with request body values
|
//init IOfficeRole resource with request body values
|
||||||
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
const officeRoleEntity = OfficeRole.hydrate<OfficeRole>(req.body);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user