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

18 lines
342 B
JavaScript

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