import { UserNotFoundError } from "../common/errors" ; import Usecase from "../common/Usecase" ; import { IUserWithGroups } from "../entities/User" ; export default class GetUser extends Usecase { async exec ( id ) { await this . authorizer . ensureCanGetUsers ( ) ; const user = await this . storages . users . findOneWithGroups ( id ) ; if ( ! user ) { throw new UserNotFoundError ( id ) ; } return user ; } }