1
0
Fork 0
mirror of synced 2024-06-28 11:00:55 +12:00

Fixing minor bug with permission add.

This commit is contained in:
mike12345567 2021-02-09 13:14:23 +00:00
parent c8ef404560
commit 2103378e5c
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 () => {