Refactor DTOs and tests; add framework-specific handling

Refactored the codebase to use shared DTOs from `DocumentService.Application.Common.DTOs`, removing inline DTO definitions in client interfaces and tests. Introduced conditional compilation to handle framework-specific differences in DTOs and handlers.

Updated test cases to align with the new DTO structures, including `SwissQrCodeExtractionResult`, `PdfValidationResult`, and `ZugferdExtractionResult`. Adjusted test data to match updated DTO properties.

Cleaned up solution and project files, ensuring proper references and organization. Removed unused files and fixed project references in `DocumentService.Tests.csproj`. Improved maintainability and consistency across the codebase.
This commit is contained in:
2026-08-31 00:54:38 +02:00
parent 108e522316
commit 75bea9ef29
18 changed files with 65 additions and 133 deletions

View File

@@ -1,3 +1,4 @@
using DocumentService.Application.Common.DTOs;
using DocumentService.Client.Models.Requests;
namespace DocumentService.Client.Interfaces;
@@ -60,30 +61,4 @@ public interface IPdfAttachmentClient
/// <returns>Modified PDF as stream</returns>
[Obsolete("API endpoint not implemented yet")]
Task<Stream> AddAttachmentsAsync(byte[] pdfBytes, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default);
}
/// <summary>
/// DTO for attachment check result
/// </summary>
public record AttachmentCheckResult
{
/// <summary>Whether the document contains any embedded file attachments.</summary>
public bool HasAttachments { get; init; }
/// <summary>Number of embedded file attachments found.</summary>
public int AttachmentCount { get; init; }
/// <summary>Metadata for each attachment found in the document.</summary>
public List<AttachmentMetadata> Attachments { get; init; } = new();
}
/// <summary>
/// DTO for attachment metadata
/// </summary>
public record AttachmentMetadata
{
/// <summary>Name of the embedded file.</summary>
public string FileName { get; init; } = string.Empty;
/// <summary>MIME type of the embedded file (e.g. "application/xml"), or <c>null</c> if unknown.</summary>
public string? MimeType { get; init; }
/// <summary>Size of the embedded file in bytes.</summary>
public long Size { get; init; }
}
}