Files
automatisch/packages/backend/src/graphql/queries/get-role.ee.js
2024-01-05 19:08:04 +01:00

18 lines
356 B
JavaScript

import Role from '../../models/role.js';
const getRole = async (_parent, params, context) => {
context.currentUser.can('read', 'Role');
return await Role.query()
.leftJoinRelated({
permissions: true,
})
.withGraphFetched({
permissions: true,
})
.findById(params.id)
.throwIfNotFound();
};
export default getRole;