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:
2026-08-31 01:19:52 +02:00
parent af0fca198a
commit 2c98558131
30 changed files with 97 additions and 440 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;

View File

@@ -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()

View File

@@ -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
{