fix created
This commit is contained in:
parent
79a0d847ce
commit
5b21866265
1 changed files with 15 additions and 0 deletions
|
|
@ -123,9 +123,24 @@ export class AuthRoleController extends Controller {
|
||||||
return attr;
|
return attr;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAttrs = body.authRoleAttrs
|
||||||
|
.filter((a) => !roleAttrData.some((attr) => attr.authSysId === a.authSysId))
|
||||||
|
.map((attr) => {
|
||||||
|
const newAttr = new AuthRoleAttr();
|
||||||
|
Object.assign(newAttr, attr, {
|
||||||
|
authRoleId: roleId,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
return newAttr;
|
||||||
|
});
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.authRoleRepo.save(record),
|
this.authRoleRepo.save(record),
|
||||||
...updatedRoleAttrData.map((attr) => this.authRoleAttrRepo.save(attr)),
|
...updatedRoleAttrData.map((attr) => this.authRoleAttrRepo.save(attr)),
|
||||||
|
...newAttrs.map((attr) => this.authRoleAttrRepo.save(attr)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue