080c2ac2a0
refactor(api): Pass IConfiguration to AddApplication
...
- Update AddApplication call with builder.Configuration parameter
- Required for license key reading from appsettings.json
2026-07-21 16:52:32 +02:00
97122d0bbd
feat(license): Configure MediatR + AutoMapper with LuckyPennySoft license
...
- Read LuckyPennySoftLicenseKey from appsettings.json
- Set MediatR config.LicenseKey
- Set AutoMapper cfg.LicenseKey
- AddApplication now requires IConfiguration parameter
2026-07-21 16:52:27 +02:00
e9d1586266
chore(deps): Add Microsoft.Extensions.Configuration packages
...
- Microsoft.Extensions.Configuration.Abstractions 10.0.10
- Microsoft.Extensions.Configuration.Binder 10.0.10
- Required for reading appsettings.json in Application layer
2026-07-21 16:52:21 +02:00
2804993ea6
feat(api): Enable conditional Swagger/Scalar in production
...
Program.cs changes:
- Add Scalar.AspNetCore using
- Register SwaggerSettings with Options Pattern
- Pass IConfiguration to AddSwaggerDocumentation()
- Conditional middleware: Development OR EnableInProduction=true
- Add Swagger UI with custom endpoint configuration
- Add Scalar UI at /scalar/v1 (DeepSpace theme, C# HttpClient target)
Access URLs:
- Swagger UI: https://localhost:7186/swagger
- Scalar UI: https://localhost:7186/scalar/v1
- Serilog UI: https://localhost:7186/serilog-ui
Production behavior: Swagger+Scalar enabled by default (configurable)
2026-07-21 15:01:56 +02:00
06a9dc7385
chore(deps): Add Scalar.AspNetCore 1.2.58 package
...
- Modern Swagger UI alternative with better UX
- DeepSpace theme
- C# HttpClient code generation support
2026-07-21 15:01:46 +02:00
4b5c763f24
refactor(swagger): Read SwaggerConfiguration from appsettings
...
- 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
2026-07-21 15:01:38 +02:00
559c726118
feat(swagger): Configure Swagger settings in appsettings.json
...
- Add SwaggerSettings section with EnableInProduction: true
- Title: DocumentOperator API
- Version: v1
- Description: PDF document processing service using DevExpress
- Production Swagger enabled by default
2026-07-21 15:01:29 +02:00
1106a86ec3
feat(swagger): Add SwaggerSettings configuration class
...
- Add SwaggerSettings with EnableInProduction flag (default: true)
- Title, Version, Description configurable via appsettings.json
- Enables production Swagger access for debugging/testing
2026-07-21 15:01:22 +02:00
89436406ce
Add PDF Stamp Operation feature with endpoints and tests
...
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.
2026-07-21 14:45:30 +02:00
c96cbbc8d3
ee
...
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.
2026-07-21 14:44:21 +02:00
9b85e55cd4
docs: Update AGENTS.md for Feature 7 completion + Serilog.UI
...
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
2026-07-21 14:39:40 +02:00
536413bafe
feat(logging): Configure Serilog SQLite sink + UI
...
appsettings.json:
- Add Application:LogDirectory configuration
- Add Serilog WriteTo.SQLite sink (logs.db in LogDirectory)
- Logs table with UTC timestamps
Program.cs:
- Add Serilog.UI usings
- Configure Serilog.UI with SQLite provider
- Mount UI at /serilog-ui endpoint
Web-based log viewer accessible at: https://localhost:7186/serilog-ui
2026-07-21 14:39:32 +02:00
b37ccc8538
chore: Add Serilog.UI packages + versioning metadata
...
Packages:
- Serilog.Sinks.SQLite 7.0.0 (SQLite log persistence)
- Serilog.UI 3.2.0 (Web-based log viewer)
- Serilog.UI.SqliteProvider 1.1.0 (SQLite provider for Serilog.UI)
Versioning metadata:
- Version: 1.0.0
- Authors/Company: Digital Data GmbH
- Copyright: 2026
- Description: PDF document processing service using DevExpress
2026-07-21 14:39:24 +02:00
d0606f3605
feat(stamp): Add Application layer (AddStampCommand with handler/validator)
...
- Vertical slice: Command + Handler + Validator in single file
- Validation rules enforce StampType-specific required fields
- Text stamps: Text + FontName + FontSize required
- Image stamps: ImageBytes required
- Predefined stamps: PredefinedType required
- Supports Origin, Rotation, Opacity, Placement, Size parameters
2026-07-21 14:39:03 +02:00
c037ad8446
feat(stamp): Add IPdfProcessor.AddStampAsync interface
...
- Add AddStampAsync method signature to IPdfProcessor interface
- Parameters: pdfBytes, stampType, pages, position, text/image/predefined params
- Supports Origin (TopLeft/BottomLeft), Rotation, Opacity, Placement
2026-07-21 14:38:29 +02:00
e2bec710e0
feat(stamp): Add Domain value objects for stamp operations
...
- Add StampType enum (Text, Image, Predefined)
- Add PredefinedStampType enum (CONFIDENTIAL, APPROVED, DRAFT, etc.)
- Add StampPlacement enum (Foreground, Background)
- All enums in DocumentOperator.Domain namespace
2026-07-21 14:38:22 +02:00
61b11fc216
feat(annotation): Add Origin/Width/Height to API endpoints
...
- 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
2026-07-21 14:38:14 +02:00
c4ec0c2b48
feat(annotation): Implement coordinate system conversion in DevExpressPdfProcessor
...
- Add Y-axis conversion for TopLeft origin (bottomLeftY = pageHeight - topLeftY)
- Origin parameter support in AddAnnotationAsync
- Preserves existing BottomLeft behavior as default
2026-07-21 14:38:08 +02:00
eed9d46e19
feat(annotation): Add Origin/Width/Height parameters to AddAnnotationCommand
...
- 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
2026-07-21 14:38:01 +02:00
c1bb3abeef
feat(annotation): Add AnnotationOrigin value object
...
- Add AnnotationOrigin enum (BottomLeft/TopLeft)
- BottomLeft = PDF native coordinate system (default)
- TopLeft = UI-friendly coordinate system (requires Y-axis conversion)
- Shared with stamp operations for consistency
2026-07-21 14:37:54 +02:00
d72d41ec2d
test(integration): Add 10 integration tests for annotation endpoints + update docs
...
Integration tests:
- 5 happy path tests (TextMarkup, FreeText, StickyNote, Circle, Square) with multipart + Base64 mix
- 5 validation error tests (invalid Base64, page number, missing content/style, invalid color)
- All existing 7 merge tests retained (now 17 total in PdfOperationsControllerTests)
Documentation updates (AGENTS.md):
- Update test count: 82 -> 101 passed, 7 skipped
- Update PdfOperationsController status: 1/N -> 2/3 endpoints (merge + annotate DONE, stamp TODO)
- Add test breakdown by feature (6 features listed)
- Update 'Run tests' section with Feature 6 mention
Test results: 101 PASSED, 7 SKIPPED, 0 FAILED
2026-07-21 12:28:59 +02:00
d4107f6f89
feat(api): Add annotation endpoints to PdfOperationsController
...
- Add POST /api/pdf/operations/annotate (multipart/form-data)
- Add POST /api/pdf/operations/annotate (application/json with Base64)
- Create AddAnnotationMultipartRequest DTO (wrapper for 10+ form parameters)
- Create AddAnnotationBase64Command DTO (Base64 PDF + annotation parameters)
- Add unique operation names (AnnotateFromFile, AnnotateFromBase64) for Swagger
- Rename MergePdfsRequest -> MergePdfsBase64Request for clarity
- Add Name attributes to merge endpoints (MergeFromFiles, MergeFromBase64) to fix Swagger conflict
- Base64 FormatException wrapped in BadRequestException
2026-07-21 12:28:43 +02:00
22ac2889af
feat(application): Add AddAnnotationCommand with handler and validator
...
- 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)
2026-07-21 12:28:30 +02:00
a23c78ec3a
test(infrastructure): Add 12 unit tests for AddAnnotationAsync
...
- 5 happy path tests (one per annotation type)
- 7 validation error tests (empty stream, invalid position, page number, content, style, color)
- All tests passing (12/12)
- Total unit tests: 37 (25 previous + 12 annotation)
2026-07-21 12:28:17 +02:00
41f97ce533
feat(infrastructure): Implement DevExpressPdfProcessor.AddAnnotationAsync
...
- Implement AddAnnotationAsync using DevExpress PdfDocumentProcessor
- Add 5 private helper methods (one per annotation type)
- Add ParseColor helper (hex string to PdfRGBColor)
- Validation: content required for FreeText/StickyNote, style for TextMarkup
- Default colors: Yellow for TextMarkup, Red for others
- Handle DevExpress API quirks (TextMarkupStyle.StrikeOut capitalization)
2026-07-21 12:28:05 +02:00
25fbea205f
feat(infrastructure): Add IPdfProcessor.AddAnnotationAsync interface
...
- Add AddAnnotationAsync method with 8 parameters
- Support Stream-based PDF input (Position=0 required)
- Accept annotation type, page number, rectangle coordinates
- Optional parameters: content, author, color (hex), textMarkupStyle
- Returns annotated PDF as byte array
2026-07-21 12:27:52 +02:00
e95f070b9b
feat(domain): Add annotation value objects for Feature 6
...
- Add AnnotationType enum (TextMarkup, FreeText, StickyNote, Circle, Square)
- Add TextMarkupStyle enum (Highlight, Underline, Strikeout)
- Support 5 annotation types as per CONTROLLER_ENDPOINTS.md requirements
2026-07-21 12:27:41 +02:00
aafe46a738
docs: Update AGENTS.md for Feature 5 (PDF Merge) completion
...
- Update test count: 82 passed, 7 skipped (was 62 passed)
- Update PdfOperationsController status: Partial (1/N endpoints), 7 tests
- Add PdfOperationsController Status section with merge endpoint details
- Mark merge endpoint as DONE (Phase 1, Priority 5)
- List remaining Phase 2 endpoints: stamp, annotate
2026-07-21 10:22:04 +02:00
0bec759396
test: Add 7 integration tests for PdfOperationsController merge endpoint
...
Multipart tests (4):
- POST_Merge_Multipart_TwoPdfs_Returns200WithMergedPdf
- POST_Merge_Multipart_ThreePdfs_Returns200
- POST_Merge_Multipart_SinglePdf_Returns400
- POST_Merge_Multipart_CorruptedPdf_Returns400Or500 (flexible assertion)
Base64 tests (3):
- POST_Merge_Base64_TwoPdfs_Returns200WithMergedPdf
- POST_Merge_Base64_ThreePdfs_Returns200
- POST_Merge_Base64_SinglePdf_Returns400
Skipped tests (2):
- POST_Merge_Multipart_WithPageRanges_Returns200 (multipart List<string?> binding complex)
- POST_Merge_Multipart_InvalidPageRange_Returns400 (page ranges work via JSON endpoint)
2026-07-21 10:21:46 +02:00
5c3fafff1b
feat: Add PdfOperationsController with dual-input merge endpoints
...
- Add PdfOperationsController.cs with route '/api/pdf/operations'
- MergeFromFiles: POST /merge (multipart/form-data) - accepts List<IFormFile>
- MergeFromBase64: POST /merge (application/json) - accepts MergePdfsRequest DTO
- Returns merged PDF as FileContentResult (application/pdf)
- Supports optional page ranges via JSON endpoint only (multipart binding complex)
- XML documentation with response codes (200, 400, 500)
- Uses primary constructor pattern
2026-07-21 10:21:27 +02:00
bc273c7f4f
feat: Add MergePdfsCommand with merged Command/Handler/Validator
...
- Add MergePdfsCommand.cs (Vertical Slice pattern)
- Command: IRequest<byte[]> with PdfStreams + PageRanges properties
- Handler: Calls IPdfProcessor.MergePdfsAsync, uses primary constructor
- Validator: Validates minimum 2 PDFs, page ranges count matches PDF count
- All 3 classes in single file (Command/Handler/Validator merged)
2026-07-21 10:21:10 +02:00
e12b64a517
test: Add 10 unit tests for MergePdfsAsync + LoadTestPdfAsStream helper
...
Unit tests (10):
- MergePdfsAsync_TwoPdfs_ReturnsMergedPdf
- MergePdfsAsync_ThreePdfs_ReturnsMergedPdf
- MergePdfsAsync_WithNullPageRanges_MergesAllPages
- MergePdfsAsync_WithEmptyPageRanges_MergesAllPages
- MergePdfsAsync_WithRangeFormat_MergesSelectedPages
- MergePdfsAsync_SinglePdf_ThrowsBadRequestException
- MergePdfsAsync_InvalidPageRangeCount_ThrowsBadRequestException
- MergePdfsAsync_InvalidPageRangeFormat_ThrowsBadRequestException
- MergePdfsAsync_PageNumberOutOfRange_ThrowsBadRequestException
- MergePdfsAsync_StreamNotAtPositionZero_ThrowsBadRequestException
Helper:
- Add LoadTestPdfAsStream helper for Stream-returning test setup
2026-07-21 10:20:53 +02:00
3598c5f9c6
feat: Implement DevExpressPdfProcessor.MergePdfsAsync with page range support
...
- Implement MergePdfsAsync: merges multiple PDFs with optional page ranges
- Add ParsePageRange helper: parses '1-3,5' format, validates page numbers
- Stream-based pipeline (no byte[] buffering)
- Validates: Position = 0, minimum 2 PDFs, page ranges count
- Uses DevExpress PdfDocumentProcessor for actual merge operation
- Returns merged PDF as byte array
2026-07-21 10:20:35 +02:00
522de8a863
feat: Add IPdfProcessor.MergePdfsAsync interface
...
- Add MergePdfsAsync method to IPdfProcessor interface
- Parameters: IReadOnlyList<Stream> pdfStreams, IReadOnlyList<string?>? pageRanges
- Returns: Task<byte[]> (merged PDF)
- Validates: Minimum 2 PDFs, stream Position = 0, page ranges count matches PDF count
- Supports optional page ranges (e.g., '1-3,5' or null for all pages)
2026-07-21 10:20:18 +02:00
cb552e54e7
docs: Update AGENTS.md - PdfAttachmentController 2/3 endpoints, 62 tests
2026-07-21 09:27:14 +02:00
fa4e55242d
fix: Update SwissQrCode test - ArgumentException to BadRequestException
2026-07-21 09:26:51 +02:00
e14044c48a
test: Add PdfAttachmentController extract endpoint integration tests (6 tests)
2026-07-21 09:26:43 +02:00
34e38f19e5
feat: Add PdfAttachmentController extract endpoints (multipart + Base64)
2026-07-21 09:26:34 +02:00
61b1595258
test: Add ExtractAttachmentsAsync unit tests (ZIP validation, edge cases)
2026-07-21 09:26:27 +02:00
26458a4017
feat: Implement DevExpressPdfProcessor.ExtractAttachmentsAsync with ZIP packaging
2026-07-21 09:26:18 +02:00
2c673ea98e
feat: Add IPdfProcessor.ExtractAttachmentsAsync interface method
2026-07-21 09:26:11 +02:00
1989ca7ef7
feat: Add ExtractPdfAttachments Application layer (Command/Handler/Validator merged)
2026-07-21 09:26:04 +02:00
0f4d860176
test(integration): migrate integration tests to Controller DTOs and update assertions
...
Test Changes:
- Use Controller DTOs (ValidatePdfBase64Request, ValidatePdfABase64Request, CheckPdfAttachmentsRequest, ExtractSwissQrCodeBase64Request)
- Remove direct Query object usage in HTTP tests (architectural violation)
- Update imports: DocumentOperator.API.Controllers namespace
Assertion Updates:
- Invalid Base64 tests: case-insensitive regex (?i)base.?64 (FormatException message contains 'Base-64' with hyphen)
- Empty PDF tests: regex match for 'Base64|empty|stream' (flexible validation error matching)
- Corrupted PDF test: Expect 500 Internal Server Error (DevExpress exception propagates naturally)
Result: 52 tests pass, 6 skipped (IBAN validation - DevExpress limitation)
2026-07-20 16:33:19 +02:00
645dfceafa
test(unit): migrate unit tests to Stream API
...
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
2026-07-20 16:33:00 +02:00
07be9b9f02
refactor(domain): remove obsolete exception types
...
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
2026-07-20 16:32:36 +02:00
a1e8575018
refactor(api): remove generic exception handling from middleware
...
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
2026-07-20 16:32:19 +02:00
b4befde418
refactor(api): migrate controllers to Stream API with Base64 validation
...
PdfValidationController:
- ValidateFromFile: IFormFile.OpenReadStream() direct usage (no byte[] copy)
- ValidateFromBase64: try-catch Convert.FromBase64String → BadRequestException
- ValidatePdfAFromFile: IFormFile.OpenReadStream() direct usage
- ValidatePdfAFromBase64: try-catch Convert.FromBase64String → BadRequestException
PdfAttachmentController:
- CheckAttachmentsFromBase64: try-catch Convert.FromBase64String → BadRequestException
SwissQrCodeController:
- ExtractFromBase64: try-catch Convert.FromBase64String → BadRequestException
All controllers: Add using DocumentOperator.Domain.Common.Exceptions for BadRequestException
2026-07-20 16:32:03 +02:00
1af158840e
refactor(infrastructure): implement Stream-based PDF processing
...
DevExpressPdfProcessor:
- ValidateAsync, ValidatePdfAAsync, CheckAttachmentsAsync: Stream parameters
- Defensive Position=0 validation (BadRequestException for seekable streams not at beginning)
- Remove unsafe Position reset (non-seekable stream compatibility)
- Remove PdfProcessingException wrapping (let DevExpress exceptions propagate naturally)
DevExpressSwissQrCodeProcessor:
- ExtractSwissQrCodeAsync: Stream parameter
- Defensive Position=0 validation
- Remove unsafe Position reset
Memory optimization: MemoryStream.TryGetBuffer fast path for byte[] extraction
2026-07-20 16:31:47 +02:00
5dc2e38507
refactor(application): update processor interfaces for Stream API
...
- IPdfProcessor: ValidateAsync, ValidatePdfAAsync, CheckAttachmentsAsync now accept Stream
- ISwissQrCodeProcessor: ExtractSwissQrCodeAsync now accepts Stream
- Update XML documentation: Position=0 requirement, non-seekable stream support
- Exception documentation: BadRequestException for validation errors (stream empty/invalid/wrong position)
2026-07-20 16:31:31 +02:00
c93488c29f
refactor(application): migrate all queries to Stream-based API
...
- Replace byte[] and Base64String with required Stream PdfStream
- Simplify validators: remove XOR/Base64 validation, only check NotNull
- Affected queries: ValidatePdfQuery, ValidatePdfAQuery, CheckPdfAttachmentsQuery, ExtractSwissQrCodeQuery
- Memory efficiency: direct stream usage, no intermediate byte[] copies
2026-07-20 16:31:14 +02:00