const UserRepository = require('../../../infrastructure/repositories/UserRepository');

class GetUserHandler {
  constructor() {
    this.userRepository = new UserRepository();
  }

  async handle(query) {
    const user = await this.userRepository.findById(query.id);
    if (!user) {
      throw new Error('User nem található');
    }
    return user;
  }
}

module.exports = GetUserHandler;
