This commit implements a complete rebranding of the project: - Updated all namespaces from `DocumentOperator` to `DocumentService`. - Renamed file paths, embedded resources, and test data references. - Updated configuration keys, logging paths, and Redis instance names. - Revised documentation to reflect the new project name. - Modified project and solution files to align with the new structure. - Updated class names, DTOs, commands, queries, and handlers. - Adjusted middleware, controllers, and API endpoints. - Updated Swagger metadata and API titles to `DocumentService API`. - Refactored test namespaces, resource paths, and embedded resources. - Updated build and deployment configurations for the new name. - Replaced all references to `DocumentOperator` in comments and literals. These changes ensure consistency across the codebase and documentation.
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");
|
|
}
|
|
}
|