export class UpdateUserCommandHandler {
  constructor(userRepository) {
    this.userRepository = userRepository;
  }

  async handle(command) {
    const userData = {
      name: command.name,
      email: command.email,
      age: command.age
    };
    
    const user = await this.userRepository.update(command.id, userData);
    if (!user) {
      throw new Error('User not found');
    }
    
    return user;
  }
}
