Updated project and solution files to rename and restructure `DocumentOperator` to `DocumentService`. Modified project references in `DocumentService.API.csproj`, `DocumentService.Application.csproj`, and `DocumentService.Infrastructure.csproj` to reflect the new naming convention. Updated `DocumentService.sln` to remove old project references, add new ones, and adjust configuration and nested project mappings accordingly. This change aligns the project structure with the new naming convention.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using DocumentService.Application.Common.Interfaces;
|
|
using FluentValidation;
|
|
using MediatR;
|
|
|
|
namespace DocumentService.Application.ConvertFromPdfA;
|
|
|
|
/// <summary>
|
|
/// Command to convert a PDF/A document to a standard PDF (removes PDF/A restrictions)
|
|
/// </summary>
|
|
public record ConvertFromPdfACommand : IRequest<byte[]>
|
|
{
|
|
/// <summary>
|
|
/// PDF/A document stream. Must be positioned at the beginning (Position = 0).
|
|
/// </summary>
|
|
public required Stream PdfStream { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handler for ConvertFromPdfACommand
|
|
/// </summary>
|
|
public class ConvertFromPdfACommandHandler(IPdfProcessor pdfProcessor)
|
|
: IRequestHandler<ConvertFromPdfACommand, byte[]>
|
|
{
|
|
public async Task<byte[]> Handle(ConvertFromPdfACommand request, CancellationToken cancellationToken)
|
|
{
|
|
return await pdfProcessor.ConvertFromPdfAAsync(request.PdfStream);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Validator for ConvertFromPdfACommand
|
|
/// </summary>
|
|
public class ConvertFromPdfACommandValidator : AbstractValidator<ConvertFromPdfACommand>
|
|
{
|
|
public ConvertFromPdfACommandValidator()
|
|
{
|
|
RuleFor(x => x.PdfStream)
|
|
.NotNull()
|
|
.WithMessage("PDF stream is required");
|
|
}
|
|
}
|