namespace Netina.Repository.Handlers.Faqs;

public class DeleteFaqCommandHandler(IMartenRepositoryWrapper martenRepositoryWrapper)
    : IRequestHandler<DeleteFaqCommand, bool>
{
    public async Task<bool> Handle(DeleteFaqCommand request, CancellationToken cancellationToken)
    {
        var ent = await martenRepositoryWrapper.SetRepository<BaseFaq>().GetEntityAsync(request.Id, cancellationToken);
        await martenRepositoryWrapper.SetRepository<BaseFaq>().RemoveEntityAsync(ent, cancellationToken);
        return true;
    }
}