export class UpdatePostCommandHandler {
  constructor(postRepository) {
    this.postRepository = postRepository;
  }

  async handle(command) {
    const postData = {
      title: command.title,
      content: command.content,
      author: command.author
    };
    
    const post = await this.postRepository.update(command.id, postData);
    if (!post) {
      throw new Error('Post not found');
    }
    
    return post;
  }
}
