Commit Graph

17 Commits

Author SHA1 Message Date
35016f02e1 refactor: Update Application layer for Codecrete Bill integration
- Change SwissQrCodeExtractionResult to use Bill + RawLines
- Update ISwissQrCodeProcessor to return tuple (Bill, string[])
- Add Codecrete.SwissQRBill.Generator v3.4.0 package reference
- Update ExtractSwissQrCodeQuery handler to use AutoMapper for Bill->DTO mapping
- Remove References property from query (not needed for QR extraction)
2026-07-16 15:47:09 +02:00
711f1a2660 feat: Add SwissQrBillDto and BadRequestException
- Add SwissQrBillDto, AddressDto, AlternativeSchemeDto for Codecrete Bill mapping
- Add BadRequestException to Domain exceptions
- DTOs include [Obsolete] warnings for deprecated fields (AddressLine1/2)
2026-07-16 15:46:44 +02:00
f7433111a7 test: Add PDF/A validation tests and manual testing guide
- Add unit tests for ValidatePdfAQueryHandler (4 tests)
- Add integration tests for PDF/A validation endpoint (6 tests)
- Fix FluentValidation: Add Base64 format validation to ValidatePdfAQueryValidator
- Update AGENTS.md: Document 3-folder test structure rationale and test count (30 tests)
- Add DocumentOperator.API/README.md: 16 manual test scenarios for all endpoints

Test coverage:
- Unit: ValidatePdfAQueryHandler (compliant, non-compliant, encrypted, exceptions)
- Integration: PDF/A endpoint (multipart + Base64, validation, error handling)
- Manual: Step-by-step Swagger UI testing guide for all features

All 30 automated tests passing.
2026-07-09 14:01:57 +02:00
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
398651964e chore: Upgrade AutoMapper to v16.2.0 and fix DI registration
- Upgrade AutoMapper from 12.0.1 to 16.2.0

- Remove deprecated AutoMapper.Extensions.Microsoft.DependencyInjection v12.0.1

  (deprecated 25 May 2023, DI moved to main package in v13.0+)

- Update DI registration: AddAutoMapper(cfg => {}, typeof(MappingProfile))

  (v13.0+ requires Action<IMapperConfigurationExpression> + marker type)

Security fix:

  - Resolves NU1903 vulnerability (GHSA-rvv3-g6hj-g44x DoS in v12.0.1)

Result: AutoMapper v16.2.0, 0 security warnings, all tests passing
2026-07-07 19:00:29 +02:00
OlgunR
84c0a54c1e Enhance ExtractSwissQrCode feature documentation
Updated `DocumentEndpoints` to include detailed requirements, return values, and use case for the `ExtractSwissQrCode` endpoint.

Marked Feature 2 (`ExtractSwissQrCode`) as completed in `PHASENPLAN.md` and `ROADMAP.md`, summarizing achievements and outlining next steps for Feature 3 (`ExtractAttachments`).

Enhanced `ExtractSwissQrCodeRequest` and `ExtractSwissQrCodeResponse` DTOs with example JSON payloads for clarity.

Expanded `SwissQrCodeDataDto` and `AddressDataDto` with detailed field-level documentation to improve usability and adherence to Swiss QR Bill Standard 2.0.
2026-06-26 08:58:25 +02:00
OlgunR
586fd4a207 Add Swiss QR Code extraction feature
Introduced DTOs for request and response to handle Swiss QR Code extraction from PDF documents. Implemented `ExtractSwissQrCodeHandler` to process the extraction using `ISwissQrCodeProcessor`. Added validation for the query with `ExtractSwissQrCodeValidator`. Developed unit tests to ensure correct behavior for successful and failure scenarios.
2026-06-26 08:46:42 +02:00
OlgunR
47cba50d0f Add ExtractSwissQrCode feature and update feature order
Updated PHASENPLAN.md and ROADMAP.md to reflect the new
feature order, making "ExtractSwissQrCode" Feature 2 and
renumbering previous Features 2-5 to 3-6. Added detailed
steps, endpoints, and acceptance criteria for the new
feature.

Implemented `ISwissQrCodeProcessor` interface with
`DevExpressSwissQrCodeProcessor` for extracting and parsing
Swiss QR Codes using DevExpress and Codecrete libraries.
Registered the new service in DependencyInjection.cs.

Introduced `SwissQrCodeData` value object and
`SwissQrCodeNotFoundException` for domain modeling and
error handling. Updated project dependencies to include
libraries for QR code processing.

Adjusted existing feature descriptions and steps to align
with the new feature order.
2026-06-26 08:39:44 +02:00
OlgunR
930b76ecb5 Add ValidatePDF feature with API, Swagger, and tests
Implemented the ValidatePDF feature end-to-end:
- Added `/api/v1/documents/validate` Minimal API endpoint.
- Introduced centralized ExceptionHandlingMiddleware.
- Configured Swagger with `AddSwaggerDocumentation` extension.
- Enabled XML comments in `DocumentOperator.API.csproj`.
- Updated DTOs with XML comments and added `FileSizeMB`.
- Added integration tests for the ValidatePDF endpoint (3 tests).
- Registered infrastructure services (e.g., `IPdfProcessor`).
- Refactored `Program.cs` to include middleware and endpoints.
- Updated PHASENPLAN.md and ROADMAP.md to reflect progress.
- Cleaned up code and made `Program` accessible for tests.
2026-06-25 16:01:33 +02:00
OlgunR
afc0e34312 Complete Step 1.1: ValidatePDF Application Layer
Updated PHASENPLAN and ROADMAP to reflect progress on Feature 1 - ValidatePDF (75% complete). Marked Step 1.1 as completed, including MediatR setup, pipeline behaviors (`ValidationBehavior`, `LoggingBehavior`), ValidatePDF feature (Query, Handler, Validator), and DTOs.

Added `DependencyInjection.cs` for Application Layer DI configuration. Introduced `LoggingBehavior` and `ValidationBehavior` for MediatR pipelines. Implemented `ValidatePdfHandler`, `ValidatePdfQuery`, and `ValidatePdfValidator`.

Created DTOs (`ValidatePdfRequest`, `ValidatePdfResponse`) for the ValidatePDF feature. Added unit tests for `ValidatePdfHandler` to verify metadata handling and exception propagation.

Removed unused folder references in `DocumentOperator.Application.csproj`.
2026-06-25 15:23:58 +02:00
OlgunR
09cc64eff0 Refactor: Remove ProcessDocument and update roadmap
Removed the obsolete `ProcessDocument` folder and its files
(`ProcessDocumentCommand.cs`, `ProcessDocumentHandler.cs`,
`ProcessDocumentValidator.cs`) as part of Application Layer
cleanup. Updated `ROADMAP.md` to reflect progress, including
the start of `DevExpressPdfProcessor` implementation (Step 3.2)
and actionable steps for creating a test folder structure.
Documented the availability of the `DevExpress Universal License`.
2026-06-19 11:36:16 +02:00
OlgunR
49d1f43822 Add IPdfProcessor interface and update ROADMAP.md
The `IPdfProcessor` interface was added to the `Application/Common/Interfaces/` directory. It includes the `ValidateAsync` method for validating PDFs and extracting metadata, with proper XML documentation and dependency on domain value objects.

Updated `ROADMAP.md` to mark Step 3.1 as completed, detailing the creation of the `IPdfProcessor` interface and its implementation status.

Removed the `<Folder Include="Common\Interfaces\" />` entry from `DocumentOperator.Application.csproj` to reflect the transition from a placeholder folder structure to actual implementation.
2026-06-18 16:02:32 +02:00
OlgunR
7272b26105 Remove Ardalis.Result package dependency
The `<PackageReference Include="Ardalis.Result" Version="10.1.0" />` was removed from the `DocumentOperator.Application.csproj` file. This indicates that the project no longer relies on the `Ardalis.Result` library. Other package references remain unchanged.
2026-06-16 13:56:56 +02:00
OlgunR
297f760e7f Refactor project structure and add new features
Restructured project files across all layers:
- Removed `Controllers` folder reference from `DocumentOperator.API.csproj`.
- Added folder structure to `DocumentOperator.Application`, `DocumentOperator.Domain`, and `DocumentOperator.Infrastructure` projects for better organization.

Introduced new API configurations and middleware:
- Added `SerilogConfiguration` and `SwaggerConfiguration` classes.
- Added `ExceptionHandlingMiddleware`, `RequestLoggingMiddleware`, and `TenantResolutionMiddleware`.

Implemented new document processing feature:
- Added `ProcessDocumentCommand`, `ProcessDocumentHandler`, and `ProcessDocumentValidator` classes in the application layer.
2026-06-15 16:21:43 +02:00
OlgunR
b25d593771 Add dependencies for API, Application, and Infrastructure
Added `Asp.Versioning.Http`, `Microsoft.Extensions.Caching.StackExchangeRedis`, and `Serilog.AspNetCore` to `DocumentOperator.API` for API versioning, Redis caching, and structured logging.

Added `Ardalis.Result`, `FluentValidation`, `FluentValidation.DependencyInjectionExtensions`, and `MediatR` to `DocumentOperator.Application` for result handling, validation, and mediator pattern support.

Added `DevExpress.Pdf.Core` and `Microsoft.Extensions.Options.ConfigurationExtensions` to `DocumentOperator.Infrastructure` for PDF processing and configuration management.
2026-06-15 11:00:22 +02:00
OlgunR
4d427c10fe Add project files. 2026-06-12 13:38:48 +02:00