mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
wip
This commit is contained in:
@@ -17,7 +17,7 @@ export class EditRoleService {
|
||||
|
||||
@Inject(Role.name)
|
||||
private readonly roleModel: TenantModelProxy<typeof Role>,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Edits details of the given role on the storage.
|
||||
@@ -30,7 +30,13 @@ export class EditRoleService {
|
||||
|
||||
// Retrieve the given role or throw not found serice error.
|
||||
const oldRole = await this.roleModel().query().findById(roleId);
|
||||
const permissions = editRoleDTO.permissions;
|
||||
// Transform permissions: map permissionId to id for Objection.js upsertGraph
|
||||
const permissions = editRoleDTO.permissions.map((perm) => ({
|
||||
id: perm.permissionId,
|
||||
subject: perm.subject,
|
||||
ability: perm.ability,
|
||||
value: perm.value,
|
||||
}));
|
||||
|
||||
// Updates the role on the storage.
|
||||
return this.uow.withTransaction(async (trx: Knex.Transaction) => {
|
||||
|
||||
Reference in New Issue
Block a user