- Read LuckyPennySoftLicenseKey from appsettings.json
- Set MediatR config.LicenseKey
- Set AutoMapper cfg.LicenseKey
- AddApplication now requires IConfiguration parameter
- Update AddSwaggerDocumentation to accept IConfiguration parameter
- Read SwaggerSettings from configuration (Title/Version/Description)
- Replace hardcoded values with dynamic settings
- Add Microsoft.Extensions.Options using for IOptions support
- Add SwaggerSettings section with EnableInProduction: true
- Title: DocumentOperator API
- Version: v1
- Description: PDF document processing service using DevExpress
- Production Swagger enabled by default
- Add SwaggerSettings with EnableInProduction flag (default: true)
- Title, Version, Description configurable via appsettings.json
- Enables production Swagger access for debugging/testing
Implemented the "PDF Stamp Operation" feature, allowing users to add text, image, or predefined stamps to PDF documents.
- Added `FEATURE_7_PLAN.md` with detailed implementation plan.
- Introduced enums (`StampType`, `PredefinedStampType`, `StampPlacement`) in the domain layer.
- Added `AddStampAsync` method to `IPdfProcessor` interface.
- Implemented `AddStampAsync` in `DevExpressPdfProcessor` using DevExpress API.
- Created unit tests for `AddStampAsync` covering various scenarios.
- Added `AddStampCommand` in the application layer with validation rules.
- Created two new endpoints in `PdfOperationsController` for multipart and Base64 inputs.
- Added DTOs for handling endpoint requests.
- Wrote integration tests for endpoints to ensure correctness.
- Updated `AGENTS.md` and added DevExpress API references.
- Documented challenges, considerations, and estimated effort.
This commit completes the "PDF Stamp Operation" feature with full test coverage and documentation.
Add IIS publish profile for Web Deploy packaging
Added `IISProfile.pubxml` to configure publishing via Web Deploy.
Set the publish method to `Package` and specified build settings
(`Release`, `Any CPU`). Configured the output package location,
enabled single-file packaging, and set the IIS app path to
`DocumentOperator.API`. Target framework updated to .NET 8.0.
Updates:
- Mark stamp endpoint as DONE in Current Status table
- Add Serilog.UI packages to Key Libraries table
- Update test count (Feature 7 instead of Feature 6)
- Add Serilog UI URL to Build/Run section
- Document log viewer access at /serilog-ui
- Update AddAnnotationFromFile/AddAnnotationFromBase64 endpoints
- Add Origin parameter to multipart/JSON request DTOs
- Add Width/Height as alternative to X2/Y2 in requests
- Calculate X2/Y2 from Width/Height if provided
- XML documentation updated with new parameters
- Add Origin parameter (default: BottomLeft)
- Add Width/Height as alternatives to X2/Y2
- Validation: Either (X2+Y2) OR (Width+Height) required, not both
- FluentValidation rules enforce mutual exclusivity
- Create AddAnnotationCommand (Command/Handler/Validator merged in single file)
- Use primary constructors for handler (IPdfProcessor dependency)
- FluentValidation rules: stream required, pageNumber > 0, content for FreeText/StickyNote
- Validate textMarkupStyle required for TextMarkup annotations
- Validate color format (6-digit hex) and rectangle coordinates (X2>X1, Y2>Y1)
Application Handler Tests:
- ValidatePdfHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- ValidatePdfAQueryHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- CheckPdfAttachmentsQueryHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- Remove Base64/PdfBytes property usage
Infrastructure Tests:
- DevExpressSwissQrCodeProcessorTests: LoadTestPdf() returns Stream
- All test methods use 'using var stream' pattern
- Add test: ExtractSwissQrCodeAsync_StreamNotAtBeginning_ThrowsBadRequestException
Result: All unit tests pass with Stream-based API
Deleted:
- PdfProcessingException: Obsolete, DevExpress exceptions now propagate naturally
- SwissQrCodeNotFoundException: Moved to Application layer (feature-specific exception)
Rationale:
- PdfProcessingException was wrapping library exceptions unnecessarily
- Better to let infrastructure exceptions propagate → middleware handles as 500
- SwissQrCodeNotFoundException is application-level concern, not domain
Remove FormatException/ArgumentException handling:
- These are framework exceptions, not application-specific
- May come from internal libraries (false positives for 400 Bad Request)
- Controllers now wrap Base64 conversion with BadRequestException explicitly
Remove PdfProcessingException handling:
- Exception type removed (obsolete)
- DevExpress exceptions now propagate naturally → 500 Internal Server Error
Current exception mapping:
- ValidationException (FluentValidation) → 400 Bad Request
- BadRequestException (custom) → 400 Bad Request
- NotFoundException (custom) → 404 Not Found
- SwissQrCodeNotFoundException (custom) → 404 Not Found
- All others → 500 Internal Server Error
- Unit tests for CheckPdfAttachmentsQueryHandler (3 tests)
- Integration tests for PdfAttachmentController (14 tests covering both multipart and JSON endpoints)
- Tests verify: attachment detection, metadata extraction, empty PDF handling, validation errors
- All tests using Stream API (mocks with It.IsAny<Stream>())
- Total: 17 new tests, all passing