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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF attachment check
|
||||
/// </summary>
|
||||
public record CheckPdfAttachmentsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public string Base64Pdf { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF attachment extraction
|
||||
/// </summary>
|
||||
public record ExtractPdfAttachmentsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF with attachments to add
|
||||
/// </summary>
|
||||
public record AddAttachmentsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// List of attachments to embed
|
||||
/// </summary>
|
||||
public required List<AttachmentRequestDto> Attachments { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DTO for attachment file in request
|
||||
/// </summary>
|
||||
public record AttachmentRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// File name (e.g., "invoice.xml", "document.pdf")
|
||||
/// </summary>
|
||||
/// <example>factur-x.xml</example>
|
||||
public required string FileName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// File content encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>PD94bWwgdmVyc2lvbj0iMS4wIj8+...</example>
|
||||
public required string Base64Content { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// MIME type (optional, e.g., "application/xml")
|
||||
/// </summary>
|
||||
/// <example>application/xml</example>
|
||||
public string? MimeType { get; init; }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<IActionResult> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF merge operation (API layer only - converts to MergePdfsCommand)
|
||||
/// </summary>
|
||||
public record MergePdfsBase64Request
|
||||
{
|
||||
/// <summary>
|
||||
/// Array of Base64-encoded PDF files (minimum 2 required)
|
||||
/// </summary>
|
||||
/// <example>["JVBERi0xLjQK...", "JVBERi0xLjQK..."]</example>
|
||||
public required List<string> Base64Pdfs { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <example>["1-2", "1,3,5", null]</example>
|
||||
public List<string?>? PageRanges { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF annotation (API layer only - converts to AddAnnotationCommand)
|
||||
/// </summary>
|
||||
public record AddAnnotationBase64Command
|
||||
{
|
||||
/// <summary>
|
||||
/// Base64-encoded PDF file
|
||||
/// </summary>
|
||||
/// <example>"JVBERi0xLjQK..."</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of annotation to add
|
||||
/// </summary>
|
||||
/// <example>TextMarkup</example>
|
||||
public required AnnotationType AnnotationType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Target page number (1-indexed)
|
||||
/// </summary>
|
||||
/// <example>1</example>
|
||||
public required int PageNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle X1 coordinate (left)
|
||||
/// </summary>
|
||||
/// <example>100.0</example>
|
||||
public required double X1 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle Y1 coordinate (top or bottom depending on Origin)
|
||||
/// </summary>
|
||||
/// <example>100.0</example>
|
||||
public required double Y1 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle X2 coordinate (right). Optional if Width is provided.
|
||||
/// </summary>
|
||||
/// <example>200.0</example>
|
||||
public double? X2 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle Y2 coordinate (bottom or top depending on Origin). Optional if Height is provided.
|
||||
/// </summary>
|
||||
/// <example>120.0</example>
|
||||
public double? Y2 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle width. Alternative to X2 (X2 = X1 + Width). Optional if X2 is provided.
|
||||
/// </summary>
|
||||
/// <example>100.0</example>
|
||||
public double? Width { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle height. Alternative to Y2 (Y2 = Y1 + Height). Optional if Y2 is provided.
|
||||
/// </summary>
|
||||
/// <example>20.0</example>
|
||||
public double? Height { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Annotation content (required for FreeText and StickyNote)
|
||||
/// </summary>
|
||||
/// <example>"Important text to highlight"</example>
|
||||
public string? Content { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Author name (optional)
|
||||
/// </summary>
|
||||
/// <example>"John Doe"</example>
|
||||
public string? Author { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Hex color (6 digits, e.g., "FF0000" for red). Optional - defaults vary by annotation type.
|
||||
/// </summary>
|
||||
/// <example>"FFFF00"</example>
|
||||
public string? Color { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Text markup style (Highlight, Underline, or Strikeout). Required for TextMarkup annotations.
|
||||
/// </summary>
|
||||
/// <example>Highlight</example>
|
||||
public TextMarkupStyle? TextMarkupStyle { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft
|
||||
/// </summary>
|
||||
/// <example>BottomLeft</example>
|
||||
public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for multipart/form-data stamp operation
|
||||
/// </summary>
|
||||
@@ -618,111 +509,3 @@ public class AddStampMultipartRequest
|
||||
/// <example>Confidential</example>
|
||||
public PredefinedStampType? PredefinedType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF stamp operation (API layer only - converts to AddStampCommand)
|
||||
/// </summary>
|
||||
public record AddStampBase64Request
|
||||
{
|
||||
/// <summary>
|
||||
/// Base64-encoded PDF file
|
||||
/// </summary>
|
||||
/// <example>"JVBERi0xLjQK..."</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of stamp (Text, Image, or Predefined)
|
||||
/// </summary>
|
||||
/// <example>Text</example>
|
||||
public required StampType StampType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Target page numbers (1-indexed). Null or empty = all pages.
|
||||
/// </summary>
|
||||
/// <example>[1, 3, 5]</example>
|
||||
public int[]? PageNumbers { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Stamp position X coordinate
|
||||
/// </summary>
|
||||
/// <example>100.0</example>
|
||||
public required double X { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Stamp position Y coordinate
|
||||
/// </summary>
|
||||
/// <example>100.0</example>
|
||||
public required double Y { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Stamp width (optional, auto-size for images if not specified)
|
||||
/// </summary>
|
||||
/// <example>200.0</example>
|
||||
public double? Width { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Stamp height (optional, auto-size for images if not specified)
|
||||
/// </summary>
|
||||
/// <example>50.0</example>
|
||||
public double? Height { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft
|
||||
/// </summary>
|
||||
/// <example>BottomLeft</example>
|
||||
public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft;
|
||||
|
||||
/// <summary>
|
||||
/// Text content (required for Text stamps)
|
||||
/// </summary>
|
||||
/// <example>"CONFIDENTIAL"</example>
|
||||
public string? Text { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Font name (default: Arial)
|
||||
/// </summary>
|
||||
/// <example>"Arial"</example>
|
||||
public string? FontName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Font size in points (default: 12)
|
||||
/// </summary>
|
||||
/// <example>24.0</example>
|
||||
public double? FontSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Hex color (6 digits, e.g., "FF0000" for red, default: "000000")
|
||||
/// </summary>
|
||||
/// <example>"FF0000"</example>
|
||||
public string? Color { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Opacity (0.0 = transparent, 1.0 = opaque, default: 0.5)
|
||||
/// </summary>
|
||||
/// <example>0.5</example>
|
||||
public double? Opacity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Rotation angle in degrees (0-360, default: 0)
|
||||
/// </summary>
|
||||
/// <example>45.0</example>
|
||||
public double? Rotation { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Stamp placement (Foreground = on top, Background = watermark effect, default: Foreground)
|
||||
/// </summary>
|
||||
/// <example>Foreground</example>
|
||||
public StampPlacement Placement { get; init; } = StampPlacement.Foreground;
|
||||
|
||||
/// <summary>
|
||||
/// Base64-encoded image (required for Image stamps, PNG/JPEG)
|
||||
/// </summary>
|
||||
/// <example>"iVBORw0KGgoAAAANSUhEUgAA..."</example>
|
||||
public string? Base64Image { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Predefined stamp type (required for Predefined stamps)
|
||||
/// </summary>
|
||||
/// <example>Confidential</example>
|
||||
public PredefinedStampType? PredefinedType { get; init; }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded Swiss QR Code extraction
|
||||
/// </summary>
|
||||
public record ExtractSwissQrCodeBase64Request
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF attachment check
|
||||
/// </summary>
|
||||
public record CheckPdfAttachmentsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
public record CheckPdfAttachmentsRequest : PdfBase64RequestBase;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF attachment extraction
|
||||
/// </summary>
|
||||
public record ExtractPdfAttachmentsRequest
|
||||
public record ExtractPdfAttachmentsRequest : PdfBase64RequestBase;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF with attachments to add
|
||||
/// </summary>
|
||||
public record AddAttachmentsRequest : PdfBase64RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// List of attachments to embed
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
public required List<AttachmentRequestDto> Attachments { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DTO for attachment file in request
|
||||
/// DTO for a single attachment file in a request
|
||||
/// </summary>
|
||||
public record AttachmentRequestDto
|
||||
{
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded Swiss QR Code extraction
|
||||
/// Base record for all single-PDF Base64 request types.
|
||||
/// Provides the common <see cref="Base64Pdf"/> property shared across endpoints.
|
||||
/// </summary>
|
||||
public record ExtractSwissQrCodeBase64Request
|
||||
public abstract record PdfBase64RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for converting a standard PDF to PDF/A format (Base64 JSON)
|
||||
/// </summary>
|
||||
public record ConvertToPdfARequest : PdfBase64RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Target PDF/A conformance level. Defaults to "PDF/A-3b".
|
||||
/// </summary>
|
||||
/// <example>PDF/A-3b</example>
|
||||
public string? PdfALevel { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for converting a PDF/A document back to standard PDF (Base64 JSON)
|
||||
/// </summary>
|
||||
public record ConvertFromPdfARequest : PdfBase64RequestBase;
|
||||
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF merge operation
|
||||
@@ -26,14 +25,8 @@ public record MergePdfsBase64Request
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF annotation
|
||||
/// </summary>
|
||||
public record AddAnnotationBase64Request
|
||||
public record AddAnnotationBase64Request : PdfBase64RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Base64-encoded PDF file
|
||||
/// </summary>
|
||||
/// <example>"JVBERi0xLjQK..."</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of annotation to add
|
||||
/// </summary>
|
||||
@@ -116,14 +109,8 @@ public record AddAnnotationBase64Request
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF stamp operation
|
||||
/// </summary>
|
||||
public record AddStampBase64Request
|
||||
public record AddStampBase64Request : PdfBase64RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Base64-encoded PDF file
|
||||
/// </summary>
|
||||
/// <example>"JVBERi0xLjQK..."</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of stamp (Text, Image, or Predefined)
|
||||
/// </summary>
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF validation
|
||||
/// </summary>
|
||||
public record ValidatePdfBase64Request : PdfBase64RequestBase;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF/A validation
|
||||
/// </summary>
|
||||
public record ValidatePdfABase64Request : PdfBase64RequestBase;
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded Swiss QR Code extraction
|
||||
/// </summary>
|
||||
public record ExtractSwissQrCodeBase64Request : PdfBase64RequestBase;
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF ZUGFeRD check
|
||||
/// </summary>
|
||||
public record HasZugferdRequest : PdfBase64RequestBase;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF ZUGFeRD extraction
|
||||
/// </summary>
|
||||
public record ExtractZugferdRequest : PdfBase64RequestBase;
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Client.Models.Requests;
|
||||
using DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
namespace DocumentService.Client.Interfaces;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentService.Client.Models.Requests;
|
||||
using DocumentService.Application.Common.DTOs.Requests;
|
||||
|
||||
namespace DocumentService.Client.Interfaces;
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for converting a standard PDF to PDF/A format (Base64 JSON)
|
||||
/// </summary>
|
||||
public record ConvertToPdfARequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Target PDF/A conformance level. Defaults to "PDF/A-3b".
|
||||
/// </summary>
|
||||
/// <example>PDF/A-3b</example>
|
||||
public string? PdfALevel { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for converting a PDF/A document back to standard PDF (Base64 JSON)
|
||||
/// </summary>
|
||||
public record ConvertFromPdfARequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF/A document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using DocumentService.Client.Models.ValueObjects;
|
||||
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF validation
|
||||
/// </summary>
|
||||
public record ValidatePdfBase64Request
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF/A validation
|
||||
/// </summary>
|
||||
public record ValidatePdfABase64Request
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF ZUGFeRD check
|
||||
/// </summary>
|
||||
public record HasZugferdRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for Base64-encoded PDF ZUGFeRD extraction
|
||||
/// </summary>
|
||||
public record ExtractZugferdRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// PDF document encoded as Base64 string
|
||||
/// </summary>
|
||||
/// <example>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...</example>
|
||||
public required string Base64Pdf { get; init; }
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.FreeText,
|
||||
@@ -275,7 +275,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.StickyNote,
|
||||
@@ -335,7 +335,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.Square,
|
||||
@@ -363,7 +363,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
public async Task AnnotateFromBase64_InvalidBase64_Returns400()
|
||||
{
|
||||
// Arrange
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = "INVALID_BASE64!!!",
|
||||
AnnotationType = AnnotationType.Circle,
|
||||
@@ -390,7 +390,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.FreeText,
|
||||
@@ -418,7 +418,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.FreeText,
|
||||
@@ -446,7 +446,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.TextMarkup,
|
||||
@@ -474,7 +474,7 @@ public class PdfOperationsControllerTests : IClassFixture<WebApplicationFactory<
|
||||
// Arrange
|
||||
string base64Pdf = LoadTestPdfAsBase64("valid.pdf");
|
||||
|
||||
var request = new AddAnnotationBase64Command
|
||||
var request = new AddAnnotationBase64Request
|
||||
{
|
||||
Base64Pdf = base64Pdf,
|
||||
AnnotationType = AnnotationType.Circle,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Client.Clients;
|
||||
using DocumentService.Client.Interfaces;
|
||||
using DocumentService.Client.Models.Requests;
|
||||
using DocumentService.Application.Common.DTOs.Requests;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using System.IO.Compression;
|
||||
@@ -14,7 +14,7 @@ namespace DocumentService.Tests.Unit.Client;
|
||||
|
||||
/// <summary>
|
||||
/// Unit tests for <see cref="PdfAttachmentClient"/>.
|
||||
/// All tests use a fake <see cref="MockHttpMessageHandler"/> — no real HTTP calls are made.
|
||||
/// All tests use a fake <see cref="MockHttpMessageHandler"/> <EFBFBD> no real HTTP calls are made.
|
||||
/// </summary>
|
||||
public class PdfAttachmentClientTests
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public class PdfAttachmentClientTests
|
||||
doc.RootElement.GetProperty("base64Pdf").GetString().Should().NotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
// ?? ExtractAttachmentsAsync (Stream) — ZIP unzip ?????????????????????????
|
||||
// ?? ExtractAttachmentsAsync (Stream) <EFBFBD> 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[]) <EFBFBD> ZIP unzip ?????????????????????????
|
||||
|
||||
[Fact]
|
||||
public async Task ExtractAttachmentsAsync_Bytes_SendsJsonAndUnzips()
|
||||
|
||||
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Unit tests for <see cref="PdfOperationsClient"/>.
|
||||
/// All tests use a fake <see cref="MockHttpMessageHandler"/> — no real HTTP calls are made.
|
||||
/// All tests use a fake <see cref="MockHttpMessageHandler"/> <EFBFBD> no real HTTP calls are made.
|
||||
/// </summary>
|
||||
public class PdfOperationsClientTests
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user