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

  async handle(command) {
    if (!command.title || !command.content) {
      throw new Error('Title and content are required');
    }
    
    const postData = {
      title: command.title,
      content: command.content,
      author: command.author
    };
    
    return await this.postRepository.create(postData);
  }
}
