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

  async handle(query) {
    const post = await this.postRepository.getById(query.id);
    if (!post) {
      throw new Error('Post not found');
    }
    return post;
  }
}
