From 2c98558131eb6478525e25e59aeebd67730bc991 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 31 Aug 2026 01:19:52 +0200 Subject: [PATCH] Refactor DTOs and namespaces for maintainability Consolidated DTOs under `DocumentService.Application.Common.DTOs.Requests` to centralize and align them with the application layer. Introduced `PdfBase64RequestBase` to encapsulate shared properties, reducing redundancy across request DTOs. Updated controllers, clients, and tests to use the new DTO structure. Removed redundant DTOs and cleaned up unused namespaces and comments. Improved documentation and ensured consistent naming conventions across the codebase. --- .../Controllers/PdfAttachmentController.cs | 66 +----- .../Controllers/PdfConversionController.cs | 2 +- .../Controllers/PdfOperationsController.cs | 221 +----------------- .../Controllers/PdfValidationController.cs | 2 +- .../Controllers/SwissQrCodeController.cs | 12 +- .../Controllers/ZugferdController.cs | 2 +- .../DTOs}/Requests/PdfAttachmentRequests.cs | 25 +- .../DTOs/Requests/PdfBase64RequestBase.cs | 7 +- .../DTOs/Requests/PdfConversionRequests.cs | 18 ++ .../DTOs}/Requests/PdfOperationRequests.cs | 19 +- .../DTOs/Requests/PdfValidationRequests.cs | 11 + .../DTOs/Requests/SwissQrCodeRequests.cs | 6 + .../Common/DTOs/Requests/ZugferdRequests.cs | 11 + .../Clients/PdfAttachmentClient.cs | 2 +- .../Clients/PdfConversionClient.cs | 2 +- .../Clients/PdfOperationsClient.cs | 2 +- .../Clients/PdfValidationClient.cs | 2 +- .../Clients/SwissQrCodeClient.cs | 2 +- .../Clients/ZugferdClient.cs | 2 +- .../Interfaces/IPdfAttachmentClient.cs | 2 +- .../Interfaces/IPdfOperationsClient.cs | 2 +- .../Models/Requests/PdfConversionRequests.cs | 31 --- .../Models/Requests/PdfValidationRequests.cs | 27 --- .../Models/Requests/ZugferdRequests.cs | 25 -- .../API/ExtractSwissQrCodeEndpointTests.cs | 2 +- .../API/PdfAttachmentControllerTests.cs | 2 +- .../API/PdfOperationsControllerTests.cs | 18 +- .../API/PdfValidationControllerTests.cs | 2 +- .../Unit/Client/PdfAttachmentClientTests.cs | 8 +- .../Unit/Client/PdfOperationsClientTests.cs | 4 +- 30 files changed, 97 insertions(+), 440 deletions(-) rename {DocumentService.Client/Models => DocumentService.Application/Common/DTOs}/Requests/PdfAttachmentRequests.cs (59%) rename DocumentService.Client/Models/Requests/SwissQrCodeRequests.cs => DocumentService.Application/Common/DTOs/Requests/PdfBase64RequestBase.cs (50%) create mode 100644 DocumentService.Application/Common/DTOs/Requests/PdfConversionRequests.cs rename {DocumentService.Client/Models => DocumentService.Application/Common/DTOs}/Requests/PdfOperationRequests.cs (92%) create mode 100644 DocumentService.Application/Common/DTOs/Requests/PdfValidationRequests.cs create mode 100644 DocumentService.Application/Common/DTOs/Requests/SwissQrCodeRequests.cs create mode 100644 DocumentService.Application/Common/DTOs/Requests/ZugferdRequests.cs delete mode 100644 DocumentService.Client/Models/Requests/PdfConversionRequests.cs delete mode 100644 DocumentService.Client/Models/Requests/PdfValidationRequests.cs delete mode 100644 DocumentService.Client/Models/Requests/ZugferdRequests.cs diff --git a/DocumentService.API/Controllers/PdfAttachmentController.cs b/DocumentService.API/Controllers/PdfAttachmentController.cs index 10c3efb..5f1ebba 100644 --- a/DocumentService.API/Controllers/PdfAttachmentController.cs +++ b/DocumentService.API/Controllers/PdfAttachmentController.cs @@ -2,7 +2,7 @@ using DocumentService.Application.AddAttachments; using DocumentService.Application.CheckPdfAttachments.Queries; using DocumentService.Application.Common.DTOs; using DocumentService.Application.ExtractPdfAttachments; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Domain.Common.Exceptions; using MediatR; using Microsoft.AspNetCore.Http; @@ -290,67 +290,3 @@ public class PdfAttachmentController(IMediator mediator) : ControllerBase } } -/// -/// Request DTO for Base64-encoded PDF attachment check -/// -public record CheckPdfAttachmentsRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public string Base64Pdf { get; init; } = string.Empty; -} - -/// -/// Request DTO for Base64-encoded PDF attachment extraction -/// -public record ExtractPdfAttachmentsRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} - -/// -/// Request DTO for Base64-encoded PDF with attachments to add -/// -public record AddAttachmentsRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } - - /// - /// List of attachments to embed - /// - public required List Attachments { get; init; } -} - -/// -/// DTO for attachment file in request -/// -public record AttachmentRequestDto -{ - /// - /// File name (e.g., "invoice.xml", "document.pdf") - /// - /// factur-x.xml - public required string FileName { get; init; } - - /// - /// File content encoded as Base64 string - /// - /// PD94bWwgdmVyc2lvbj0iMS4wIj8+... - public required string Base64Content { get; init; } - - /// - /// MIME type (optional, e.g., "application/xml") - /// - /// application/xml - public string? MimeType { get; init; } -} diff --git a/DocumentService.API/Controllers/PdfConversionController.cs b/DocumentService.API/Controllers/PdfConversionController.cs index 9bf7228..84fd8b7 100644 --- a/DocumentService.API/Controllers/PdfConversionController.cs +++ b/DocumentService.API/Controllers/PdfConversionController.cs @@ -1,6 +1,6 @@ using DocumentService.Application.ConvertFromPdfA; using DocumentService.Application.ConvertToPdfA; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Domain.Common.Exceptions; using MediatR; using Microsoft.AspNetCore.Http; diff --git a/DocumentService.API/Controllers/PdfOperationsController.cs b/DocumentService.API/Controllers/PdfOperationsController.cs index 90dde0f..f3a3177 100644 --- a/DocumentService.API/Controllers/PdfOperationsController.cs +++ b/DocumentService.API/Controllers/PdfOperationsController.cs @@ -1,5 +1,6 @@ using DocumentService.Application.AddAnnotation; using DocumentService.Application.AddStamp; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Application.MergePdfs; using DocumentService.Domain.Common.Exceptions; using DocumentService.Domain.Models.ValueObjects; @@ -158,7 +159,7 @@ public class PdfOperationsController(IMediator mediator) : ControllerBase [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] public async Task AnnotateFromBase64( - [FromBody] AddAnnotationBase64Command command, + [FromBody] AddAnnotationBase64Request command, CancellationToken cancellationToken) { // Convert Base64 to MemoryStream @@ -404,116 +405,6 @@ public class AddAnnotationMultipartRequest public AnnotationOrigin Origin { get; set; } = AnnotationOrigin.BottomLeft; } -/// -/// Request DTO for Base64-encoded PDF merge operation (API layer only - converts to MergePdfsCommand) -/// -public record MergePdfsBase64Request -{ - /// - /// Array of Base64-encoded PDF files (minimum 2 required) - /// - /// ["JVBERi0xLjQK...", "JVBERi0xLjQK..."] - public required List Base64Pdfs { get; init; } - - /// - /// Optional page ranges per PDF (null = all pages). - /// Format: "1-3,5" means pages 1, 2, 3, and 5. - /// If provided, array length must match Base64Pdfs length. - /// - /// ["1-2", "1,3,5", null] - public List? PageRanges { get; init; } -} - -/// -/// Request DTO for Base64-encoded PDF annotation (API layer only - converts to AddAnnotationCommand) -/// -public record AddAnnotationBase64Command -{ - /// - /// Base64-encoded PDF file - /// - /// "JVBERi0xLjQK..." - public required string Base64Pdf { get; init; } - - /// - /// Type of annotation to add - /// - /// TextMarkup - public required AnnotationType AnnotationType { get; init; } - - /// - /// Target page number (1-indexed) - /// - /// 1 - public required int PageNumber { get; init; } - - /// - /// Rectangle X1 coordinate (left) - /// - /// 100.0 - public required double X1 { get; init; } - - /// - /// Rectangle Y1 coordinate (top or bottom depending on Origin) - /// - /// 100.0 - public required double Y1 { get; init; } - - /// - /// Rectangle X2 coordinate (right). Optional if Width is provided. - /// - /// 200.0 - public double? X2 { get; init; } - - /// - /// Rectangle Y2 coordinate (bottom or top depending on Origin). Optional if Height is provided. - /// - /// 120.0 - public double? Y2 { get; init; } - - /// - /// Rectangle width. Alternative to X2 (X2 = X1 + Width). Optional if X2 is provided. - /// - /// 100.0 - public double? Width { get; init; } - - /// - /// Rectangle height. Alternative to Y2 (Y2 = Y1 + Height). Optional if Y2 is provided. - /// - /// 20.0 - public double? Height { get; init; } - - /// - /// Annotation content (required for FreeText and StickyNote) - /// - /// "Important text to highlight" - public string? Content { get; init; } - - /// - /// Author name (optional) - /// - /// "John Doe" - public string? Author { get; init; } - - /// - /// Hex color (6 digits, e.g., "FF0000" for red). Optional - defaults vary by annotation type. - /// - /// "FFFF00" - public string? Color { get; init; } - - /// - /// Text markup style (Highlight, Underline, or Strikeout). Required for TextMarkup annotations. - /// - /// Highlight - public TextMarkupStyle? TextMarkupStyle { get; init; } - - /// - /// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft - /// - /// BottomLeft - public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft; -} - /// /// Request DTO for multipart/form-data stamp operation /// @@ -618,111 +509,3 @@ public class AddStampMultipartRequest /// Confidential public PredefinedStampType? PredefinedType { get; set; } } - -/// -/// Request DTO for Base64-encoded PDF stamp operation (API layer only - converts to AddStampCommand) -/// -public record AddStampBase64Request -{ - /// - /// Base64-encoded PDF file - /// - /// "JVBERi0xLjQK..." - public required string Base64Pdf { get; init; } - - /// - /// Type of stamp (Text, Image, or Predefined) - /// - /// Text - public required StampType StampType { get; init; } - - /// - /// Target page numbers (1-indexed). Null or empty = all pages. - /// - /// [1, 3, 5] - public int[]? PageNumbers { get; init; } - - /// - /// Stamp position X coordinate - /// - /// 100.0 - public required double X { get; init; } - - /// - /// Stamp position Y coordinate - /// - /// 100.0 - public required double Y { get; init; } - - /// - /// Stamp width (optional, auto-size for images if not specified) - /// - /// 200.0 - public double? Width { get; init; } - - /// - /// Stamp height (optional, auto-size for images if not specified) - /// - /// 50.0 - public double? Height { get; init; } - - /// - /// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft - /// - /// BottomLeft - public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft; - - /// - /// Text content (required for Text stamps) - /// - /// "CONFIDENTIAL" - public string? Text { get; init; } - - /// - /// Font name (default: Arial) - /// - /// "Arial" - public string? FontName { get; init; } - - /// - /// Font size in points (default: 12) - /// - /// 24.0 - public double? FontSize { get; init; } - - /// - /// Hex color (6 digits, e.g., "FF0000" for red, default: "000000") - /// - /// "FF0000" - public string? Color { get; init; } - - /// - /// Opacity (0.0 = transparent, 1.0 = opaque, default: 0.5) - /// - /// 0.5 - public double? Opacity { get; init; } - - /// - /// Rotation angle in degrees (0-360, default: 0) - /// - /// 45.0 - public double? Rotation { get; init; } - - /// - /// Stamp placement (Foreground = on top, Background = watermark effect, default: Foreground) - /// - /// Foreground - public StampPlacement Placement { get; init; } = StampPlacement.Foreground; - - /// - /// Base64-encoded image (required for Image stamps, PNG/JPEG) - /// - /// "iVBORw0KGgoAAAANSUhEUgAA..." - public string? Base64Image { get; init; } - - /// - /// Predefined stamp type (required for Predefined stamps) - /// - /// Confidential - public PredefinedStampType? PredefinedType { get; init; } -} diff --git a/DocumentService.API/Controllers/PdfValidationController.cs b/DocumentService.API/Controllers/PdfValidationController.cs index 7d587d4..4b209e2 100644 --- a/DocumentService.API/Controllers/PdfValidationController.cs +++ b/DocumentService.API/Controllers/PdfValidationController.cs @@ -1,7 +1,7 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Application.ValidatePdf.Queries; using DocumentService.Application.ValidatePdfA.Queries; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Domain.Common.Exceptions; using MediatR; using Microsoft.AspNetCore.Mvc; diff --git a/DocumentService.API/Controllers/SwissQrCodeController.cs b/DocumentService.API/Controllers/SwissQrCodeController.cs index f9657a9..f8e9a77 100644 --- a/DocumentService.API/Controllers/SwissQrCodeController.cs +++ b/DocumentService.API/Controllers/SwissQrCodeController.cs @@ -1,4 +1,5 @@ using DocumentService.Application.Common.DTOs; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Application.SwissQrCode.Queries; using DocumentService.Domain.Common.Exceptions; using MediatR; @@ -100,14 +101,3 @@ public class SwissQrCodeController(IMediator Mediator) : ControllerBase } } -/// -/// Request DTO for Base64-encoded Swiss QR Code extraction -/// -public record ExtractSwissQrCodeBase64Request -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} diff --git a/DocumentService.API/Controllers/ZugferdController.cs b/DocumentService.API/Controllers/ZugferdController.cs index 3967f51..4f752d8 100644 --- a/DocumentService.API/Controllers/ZugferdController.cs +++ b/DocumentService.API/Controllers/ZugferdController.cs @@ -1,7 +1,7 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Application.ExtractZugferd; using DocumentService.Application.HasZugferd.Queries; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Domain.Common.Exceptions; using MediatR; using Microsoft.AspNetCore.Http; diff --git a/DocumentService.Client/Models/Requests/PdfAttachmentRequests.cs b/DocumentService.Application/Common/DTOs/Requests/PdfAttachmentRequests.cs similarity index 59% rename from DocumentService.Client/Models/Requests/PdfAttachmentRequests.cs rename to DocumentService.Application/Common/DTOs/Requests/PdfAttachmentRequests.cs index 9cee72f..13071ec 100644 --- a/DocumentService.Client/Models/Requests/PdfAttachmentRequests.cs +++ b/DocumentService.Application/Common/DTOs/Requests/PdfAttachmentRequests.cs @@ -1,31 +1,28 @@ -namespace DocumentService.Client.Models.Requests; +namespace DocumentService.Application.Common.DTOs.Requests; /// /// Request DTO for Base64-encoded PDF attachment check /// -public record CheckPdfAttachmentsRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} +public record CheckPdfAttachmentsRequest : PdfBase64RequestBase; /// /// Request DTO for Base64-encoded PDF attachment extraction /// -public record ExtractPdfAttachmentsRequest +public record ExtractPdfAttachmentsRequest : PdfBase64RequestBase; + +/// +/// Request DTO for Base64-encoded PDF with attachments to add +/// +public record AddAttachmentsRequest : PdfBase64RequestBase { /// - /// PDF document encoded as Base64 string + /// List of attachments to embed /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } + public required List Attachments { get; init; } } /// -/// DTO for attachment file in request +/// DTO for a single attachment file in a request /// public record AttachmentRequestDto { diff --git a/DocumentService.Client/Models/Requests/SwissQrCodeRequests.cs b/DocumentService.Application/Common/DTOs/Requests/PdfBase64RequestBase.cs similarity index 50% rename from DocumentService.Client/Models/Requests/SwissQrCodeRequests.cs rename to DocumentService.Application/Common/DTOs/Requests/PdfBase64RequestBase.cs index 775199c..80325c5 100644 --- a/DocumentService.Client/Models/Requests/SwissQrCodeRequests.cs +++ b/DocumentService.Application/Common/DTOs/Requests/PdfBase64RequestBase.cs @@ -1,9 +1,10 @@ -namespace DocumentService.Client.Models.Requests; +namespace DocumentService.Application.Common.DTOs.Requests; /// -/// Request DTO for Base64-encoded Swiss QR Code extraction +/// Base record for all single-PDF Base64 request types. +/// Provides the common property shared across endpoints. /// -public record ExtractSwissQrCodeBase64Request +public abstract record PdfBase64RequestBase { /// /// PDF document encoded as Base64 string diff --git a/DocumentService.Application/Common/DTOs/Requests/PdfConversionRequests.cs b/DocumentService.Application/Common/DTOs/Requests/PdfConversionRequests.cs new file mode 100644 index 0000000..c165071 --- /dev/null +++ b/DocumentService.Application/Common/DTOs/Requests/PdfConversionRequests.cs @@ -0,0 +1,18 @@ +namespace DocumentService.Application.Common.DTOs.Requests; + +/// +/// Request DTO for converting a standard PDF to PDF/A format (Base64 JSON) +/// +public record ConvertToPdfARequest : PdfBase64RequestBase +{ + /// + /// Target PDF/A conformance level. Defaults to "PDF/A-3b". + /// + /// PDF/A-3b + public string? PdfALevel { get; init; } +} + +/// +/// Request DTO for converting a PDF/A document back to standard PDF (Base64 JSON) +/// +public record ConvertFromPdfARequest : PdfBase64RequestBase; diff --git a/DocumentService.Client/Models/Requests/PdfOperationRequests.cs b/DocumentService.Application/Common/DTOs/Requests/PdfOperationRequests.cs similarity index 92% rename from DocumentService.Client/Models/Requests/PdfOperationRequests.cs rename to DocumentService.Application/Common/DTOs/Requests/PdfOperationRequests.cs index c6b9416..802b6a9 100644 --- a/DocumentService.Client/Models/Requests/PdfOperationRequests.cs +++ b/DocumentService.Application/Common/DTOs/Requests/PdfOperationRequests.cs @@ -1,7 +1,6 @@ -using DocumentService.Client.Models.ValueObjects; using DocumentService.Domain.Models.ValueObjects; -namespace DocumentService.Client.Models.Requests; +namespace DocumentService.Application.Common.DTOs.Requests; /// /// Request DTO for Base64-encoded PDF merge operation @@ -26,14 +25,8 @@ public record MergePdfsBase64Request /// /// Request DTO for Base64-encoded PDF annotation /// -public record AddAnnotationBase64Request +public record AddAnnotationBase64Request : PdfBase64RequestBase { - /// - /// Base64-encoded PDF file - /// - /// "JVBERi0xLjQK..." - public required string Base64Pdf { get; init; } - /// /// Type of annotation to add /// @@ -116,14 +109,8 @@ public record AddAnnotationBase64Request /// /// Request DTO for Base64-encoded PDF stamp operation /// -public record AddStampBase64Request +public record AddStampBase64Request : PdfBase64RequestBase { - /// - /// Base64-encoded PDF file - /// - /// "JVBERi0xLjQK..." - public required string Base64Pdf { get; init; } - /// /// Type of stamp (Text, Image, or Predefined) /// diff --git a/DocumentService.Application/Common/DTOs/Requests/PdfValidationRequests.cs b/DocumentService.Application/Common/DTOs/Requests/PdfValidationRequests.cs new file mode 100644 index 0000000..e6b98f7 --- /dev/null +++ b/DocumentService.Application/Common/DTOs/Requests/PdfValidationRequests.cs @@ -0,0 +1,11 @@ +namespace DocumentService.Application.Common.DTOs.Requests; + +/// +/// Request DTO for Base64-encoded PDF validation +/// +public record ValidatePdfBase64Request : PdfBase64RequestBase; + +/// +/// Request DTO for Base64-encoded PDF/A validation +/// +public record ValidatePdfABase64Request : PdfBase64RequestBase; diff --git a/DocumentService.Application/Common/DTOs/Requests/SwissQrCodeRequests.cs b/DocumentService.Application/Common/DTOs/Requests/SwissQrCodeRequests.cs new file mode 100644 index 0000000..8a5460e --- /dev/null +++ b/DocumentService.Application/Common/DTOs/Requests/SwissQrCodeRequests.cs @@ -0,0 +1,6 @@ +namespace DocumentService.Application.Common.DTOs.Requests; + +/// +/// Request DTO for Base64-encoded Swiss QR Code extraction +/// +public record ExtractSwissQrCodeBase64Request : PdfBase64RequestBase; diff --git a/DocumentService.Application/Common/DTOs/Requests/ZugferdRequests.cs b/DocumentService.Application/Common/DTOs/Requests/ZugferdRequests.cs new file mode 100644 index 0000000..e7aa262 --- /dev/null +++ b/DocumentService.Application/Common/DTOs/Requests/ZugferdRequests.cs @@ -0,0 +1,11 @@ +namespace DocumentService.Application.Common.DTOs.Requests; + +/// +/// Request DTO for Base64-encoded PDF ZUGFeRD check +/// +public record HasZugferdRequest : PdfBase64RequestBase; + +/// +/// Request DTO for Base64-encoded PDF ZUGFeRD extraction +/// +public record ExtractZugferdRequest : PdfBase64RequestBase; diff --git a/DocumentService.Client/Clients/PdfAttachmentClient.cs b/DocumentService.Client/Clients/PdfAttachmentClient.cs index b6be48f..a80942b 100644 --- a/DocumentService.Client/Clients/PdfAttachmentClient.cs +++ b/DocumentService.Client/Clients/PdfAttachmentClient.cs @@ -1,6 +1,6 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.IO.Compression; using System.Net.Http; diff --git a/DocumentService.Client/Clients/PdfConversionClient.cs b/DocumentService.Client/Clients/PdfConversionClient.cs index 0ecb0ed..59ed870 100644 --- a/DocumentService.Client/Clients/PdfConversionClient.cs +++ b/DocumentService.Client/Clients/PdfConversionClient.cs @@ -1,5 +1,5 @@ using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.Net.Http; diff --git a/DocumentService.Client/Clients/PdfOperationsClient.cs b/DocumentService.Client/Clients/PdfOperationsClient.cs index 3ba4919..dffdecf 100644 --- a/DocumentService.Client/Clients/PdfOperationsClient.cs +++ b/DocumentService.Client/Clients/PdfOperationsClient.cs @@ -1,5 +1,5 @@ using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.Net.Http; using System.Net.Http.Headers; diff --git a/DocumentService.Client/Clients/PdfValidationClient.cs b/DocumentService.Client/Clients/PdfValidationClient.cs index 06efa87..a0ccf21 100644 --- a/DocumentService.Client/Clients/PdfValidationClient.cs +++ b/DocumentService.Client/Clients/PdfValidationClient.cs @@ -1,6 +1,6 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.Net.Http; diff --git a/DocumentService.Client/Clients/SwissQrCodeClient.cs b/DocumentService.Client/Clients/SwissQrCodeClient.cs index 8454ba8..7036743 100644 --- a/DocumentService.Client/Clients/SwissQrCodeClient.cs +++ b/DocumentService.Client/Clients/SwissQrCodeClient.cs @@ -1,6 +1,6 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.Net.Http; diff --git a/DocumentService.Client/Clients/ZugferdClient.cs b/DocumentService.Client/Clients/ZugferdClient.cs index 190adef..838d2a1 100644 --- a/DocumentService.Client/Clients/ZugferdClient.cs +++ b/DocumentService.Client/Clients/ZugferdClient.cs @@ -1,7 +1,7 @@ using DocumentService.Application.Common.DTOs; using DocumentService.Application.ExtractZugferd; using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using Microsoft.Extensions.Logging; using System.Net.Http; diff --git a/DocumentService.Client/Interfaces/IPdfAttachmentClient.cs b/DocumentService.Client/Interfaces/IPdfAttachmentClient.cs index b6e6b0a..cd711a8 100644 --- a/DocumentService.Client/Interfaces/IPdfAttachmentClient.cs +++ b/DocumentService.Client/Interfaces/IPdfAttachmentClient.cs @@ -1,5 +1,5 @@ using DocumentService.Application.Common.DTOs; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; namespace DocumentService.Client.Interfaces; diff --git a/DocumentService.Client/Interfaces/IPdfOperationsClient.cs b/DocumentService.Client/Interfaces/IPdfOperationsClient.cs index bdde83e..1236899 100644 --- a/DocumentService.Client/Interfaces/IPdfOperationsClient.cs +++ b/DocumentService.Client/Interfaces/IPdfOperationsClient.cs @@ -1,4 +1,4 @@ -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; namespace DocumentService.Client.Interfaces; diff --git a/DocumentService.Client/Models/Requests/PdfConversionRequests.cs b/DocumentService.Client/Models/Requests/PdfConversionRequests.cs deleted file mode 100644 index 825228a..0000000 --- a/DocumentService.Client/Models/Requests/PdfConversionRequests.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace DocumentService.Client.Models.Requests; - -/// -/// Request DTO for converting a standard PDF to PDF/A format (Base64 JSON) -/// -public record ConvertToPdfARequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } - - /// - /// Target PDF/A conformance level. Defaults to "PDF/A-3b". - /// - /// PDF/A-3b - public string? PdfALevel { get; init; } -} - -/// -/// Request DTO for converting a PDF/A document back to standard PDF (Base64 JSON) -/// -public record ConvertFromPdfARequest -{ - /// - /// PDF/A document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} diff --git a/DocumentService.Client/Models/Requests/PdfValidationRequests.cs b/DocumentService.Client/Models/Requests/PdfValidationRequests.cs deleted file mode 100644 index b6d4ff4..0000000 --- a/DocumentService.Client/Models/Requests/PdfValidationRequests.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DocumentService.Client.Models.ValueObjects; - -namespace DocumentService.Client.Models.Requests; - -/// -/// Request DTO for Base64-encoded PDF validation -/// -public record ValidatePdfBase64Request -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} - -/// -/// Request DTO for Base64-encoded PDF/A validation -/// -public record ValidatePdfABase64Request -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} diff --git a/DocumentService.Client/Models/Requests/ZugferdRequests.cs b/DocumentService.Client/Models/Requests/ZugferdRequests.cs deleted file mode 100644 index a6adca4..0000000 --- a/DocumentService.Client/Models/Requests/ZugferdRequests.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace DocumentService.Client.Models.Requests; - -/// -/// Request DTO for Base64-encoded PDF ZUGFeRD check -/// -public record HasZugferdRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} - -/// -/// Request DTO for Base64-encoded PDF ZUGFeRD extraction -/// -public record ExtractZugferdRequest -{ - /// - /// PDF document encoded as Base64 string - /// - /// JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c... - public required string Base64Pdf { get; init; } -} diff --git a/DocumentService.Tests/Integration/API/ExtractSwissQrCodeEndpointTests.cs b/DocumentService.Tests/Integration/API/ExtractSwissQrCodeEndpointTests.cs index fe87103..18ab2d5 100644 --- a/DocumentService.Tests/Integration/API/ExtractSwissQrCodeEndpointTests.cs +++ b/DocumentService.Tests/Integration/API/ExtractSwissQrCodeEndpointTests.cs @@ -1,4 +1,4 @@ -using DocumentService.API.Controllers; // For ExtractSwissQrCodeBase64Request DTO +using DocumentService.Application.Common.DTOs.Requests; // For ExtractSwissQrCodeBase64Request DTO using DocumentService.Application.Common.DTOs; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; diff --git a/DocumentService.Tests/Integration/API/PdfAttachmentControllerTests.cs b/DocumentService.Tests/Integration/API/PdfAttachmentControllerTests.cs index 364a400..c6b5e37 100644 --- a/DocumentService.Tests/Integration/API/PdfAttachmentControllerTests.cs +++ b/DocumentService.Tests/Integration/API/PdfAttachmentControllerTests.cs @@ -1,5 +1,5 @@ using DocumentService.Application.Common.DTOs; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; using System.Net; diff --git a/DocumentService.Tests/Integration/API/PdfOperationsControllerTests.cs b/DocumentService.Tests/Integration/API/PdfOperationsControllerTests.cs index 3a29c8e..e271f87 100644 --- a/DocumentService.Tests/Integration/API/PdfOperationsControllerTests.cs +++ b/DocumentService.Tests/Integration/API/PdfOperationsControllerTests.cs @@ -3,7 +3,7 @@ using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Text.Json; -using DocumentService.API.Controllers; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Domain.Models.ValueObjects; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; @@ -243,7 +243,7 @@ public class PdfOperationsControllerTests : IClassFixture /// Unit tests for . -/// All tests use a fake — no real HTTP calls are made. +/// All tests use a fake � no real HTTP calls are made. /// public class PdfAttachmentClientTests { @@ -118,7 +118,7 @@ public class PdfAttachmentClientTests doc.RootElement.GetProperty("base64Pdf").GetString().Should().NotBeNullOrEmpty(); } - // ?? ExtractAttachmentsAsync (Stream) — ZIP unzip ????????????????????????? + // ?? ExtractAttachmentsAsync (Stream) � ZIP unzip ????????????????????????? [Fact] public async Task ExtractAttachmentsAsync_Stream_UnzipsAndReturnsDictionary() @@ -169,7 +169,7 @@ public class PdfAttachmentClientTests foreach (var s in result.Values) s.Dispose(); } - // ?? ExtractAttachmentsAsync (byte[]) — ZIP unzip ????????????????????????? + // ?? ExtractAttachmentsAsync (byte[]) � ZIP unzip ????????????????????????? [Fact] public async Task ExtractAttachmentsAsync_Bytes_SendsJsonAndUnzips() diff --git a/DocumentService.Tests/Unit/Client/PdfOperationsClientTests.cs b/DocumentService.Tests/Unit/Client/PdfOperationsClientTests.cs index 17aa54b..8b09d21 100644 --- a/DocumentService.Tests/Unit/Client/PdfOperationsClientTests.cs +++ b/DocumentService.Tests/Unit/Client/PdfOperationsClientTests.cs @@ -1,6 +1,6 @@ using DocumentService.Client.Clients; using DocumentService.Client.Interfaces; -using DocumentService.Client.Models.Requests; +using DocumentService.Application.Common.DTOs.Requests; using DocumentService.Client.Models.ValueObjects; using DocumentService.Domain.Models.ValueObjects; using FluentAssertions; @@ -13,7 +13,7 @@ namespace DocumentService.Tests.Unit.Client; /// /// Unit tests for . -/// All tests use a fake — no real HTTP calls are made. +/// All tests use a fake � no real HTTP calls are made. /// public class PdfOperationsClientTests {