refactor: remove PdfMetadata/PdfAMetadata, use result DTOs directly

PdfMetadata and PdfAMetadata were redundant intermediate classes that
mirrored PdfValidationResult and PdfAValidationResult exactly.

Changes:
- Delete PdfMetadata.cs and PdfAMetadata.cs
- IPdfProcessor.ValidateAsync now returns PdfValidationResult directly
- IPdfProcessor.ValidatePdfAAsync now returns PdfAValidationResult directly
- ValidatePdfQueryHandler: remove IMapper dependency, return result directly
- ValidatePdfAQueryHandler: remove IMapper dependency, return result directly
- MappingProfile: remove the two now-obsolete CreateMap calls
- PdfValidationResult: add IsEncrypted parameter (was missing)
This commit is contained in:
2026-08-28 11:45:33 +02:00
parent 9cb964379f
commit ef78fb5cdd
7 changed files with 9 additions and 88 deletions

View File

@@ -1,4 +1,3 @@
using AutoMapper;
using DocumentService.Application.Common.DTOs;
using DocumentService.Application.Common.Interfaces;
using MediatR;
@@ -18,20 +17,12 @@ public record ValidatePdfAQuery : IRequest<PdfAValidationResult>
/// <summary>
/// Handler for ValidatePdfAQuery
/// Orchestrates PDF/A validation using IPdfProcessor and AutoMapper
/// </summary>
public class ValidatePdfAQueryHandler(IPdfProcessor PdfProcessor, IMapper Mapper)
public class ValidatePdfAQueryHandler(IPdfProcessor pdfProcessor)
: IRequestHandler<ValidatePdfAQuery, PdfAValidationResult>
{
/// <summary>
/// Validates PDF/A and returns metadata with conformance level
/// </summary>
public async Task<PdfAValidationResult> Handle(ValidatePdfAQuery request, CancellationToken cancellationToken)
{
// Call DevExpress service directly with stream (exceptions propagate naturally)
var metadata = await PdfProcessor.ValidatePdfAAsync(request.PdfStream);
// Map DTO to response DTO using AutoMapper
return Mapper.Map<PdfAValidationResult>(metadata);
return await pdfProcessor.ValidatePdfAAsync(request.PdfStream);
}
}