Fixing minor bug with permission add.

This commit is contained in:
mike12345567 2021-02-09 13:14:23 +00:00
parent cc02397b01
commit ec5f9788c5
3 changed files with 7 additions and 5 deletions

View File

@ -71,10 +71,11 @@ async function updatePermissionOnRole(
}
const response = await db.bulkDocs(docUpdates)
return response.map(resp => ({
...resp,
_id: getExternalRoleID(resp._id),
}))
return response.map(resp => {
resp._id = getExternalRoleID(resp.id)
delete resp.id
return resp
})
}
exports.fetchBuiltin = function(ctx) {

View File

@ -47,6 +47,7 @@ router.use(async (ctx, next) => {
message: err.message,
status: ctx.status,
}
console.trace(err)
}
})

View File

@ -48,7 +48,7 @@ describe("/permission", () => {
describe("test", () => {
it("should be able to add permission to a role for the table", async () => {
expect(perms.length).toEqual(1)
expect(perms[0].id).toEqual(`${STD_ROLE_ID}`)
expect(perms[0]._id).toEqual(`${STD_ROLE_ID}`)
})
it("should get the resource permissions", async () => {