|
|
cd50d45bd5
|
feat: Add PDF/A validation endpoint (Feature 3)
Domain layer:
- PdfAMetadata value object (isValid, pdfVersion, pageCount, encrypted, pdfaVersion, pdfaCompliant, errors, warnings)
Infrastructure layer:
- IPdfProcessor.ValidatePdfAAsync() interface method
- DevExpressPdfProcessor.ValidatePdfAAsync() implementation
- DetectEncryption() - scans PDF raw data for /Encrypt keyword
- DetectPdfAConformance() - parses XMP metadata (pdfaid:part, pdfaid:conformance)
- Validation: encrypted PDF cannot be PDF/A compliant
Application layer:
- ValidatePdfAQuery + ValidatePdfAQueryHandler (co-located)
- ValidatePdfAQueryValidator (FluentValidation: PdfBytes XOR Base64Pdf)
- PdfAValidationResult DTO
- AutoMapper: PdfAMetadata -> PdfAValidationResult
API layer:
- PdfValidationController.ValidatePdfAFromFile() (multipart/form-data)
- PdfValidationController.ValidatePdfAFromBase64() (application/json)
- XML documentation with response codes
Result:
- POST /api/pdf/validation/validate-pdfa (both multipart and JSON)
- Returns: conformance level, errors, warnings
- Build: 0 errors, 4 warnings (DevExpress eval)
- Tests: 20/20 passing
Next: Integration tests + Swagger test case
|
2026-07-09 12:59:24 +02:00 |
|
|
|
d6e3a5fda1
|
refactor: Restructure Application layer with vertical slices and AutoMapper
Vertical slice architecture:
- Move Features/Documents/{UseCase}/ to {UseCase}/Queries/
- Query + Handler in SAME file (co-located)
- Validator in separate file (single responsibility)
New structure:
- ValidatePdf/Queries/ValidatePdfQuery.cs (Query + Handler)
- ValidatePdf/Queries/ValidatePdfQueryValidator.cs
- SwissQrCode/Queries/ExtractSwissQrCodeQuery.cs (Query + Handler)
- SwissQrCode/Queries/ExtractSwissQrCodeQueryValidator.cs
AutoMapper integration:
- Add Common/Mapping/MappingProfile.cs
- Map PdfMetadata -> PdfValidationResult (domain -> DTO)
- Map SwissQrCodeData -> SwissQrCodeExtractionResult (domain -> DTO)
- Controllers now thin: pass request to MediatR, AutoMapper handles mapping
DTO improvements:
- Rename: ValidatePdfResponse -> PdfValidationResult (business-friendly)
- Rename: ExtractSwissQrCodeResponse -> SwissQrCodeExtractionResult
- Support BOTH byte[] and Base64Pdf string (XOR validation)
- Use modern C# 12 collection expressions
Code quality:
- Use PascalCase for primary constructor parameters
- Fix LoggingBehavior logging format
Deleted old structure:
- Features/Documents/ValidatePdf/ (old horizontal structure)
- Features/Documents/ExtractSwissQrCode/ (old horizontal structure)
- Common/DTOs/{Request|Response} (replaced with {Result})
Result: Vertical slices, AutoMapper v16.2.0, thin controllers
|
2026-07-07 19:01:05 +02:00 |
|