Refactor: Rename DocumentOperator to DocumentService

Updated project and solution files to rename and restructure
`DocumentOperator` to `DocumentService`. Modified project
references in `DocumentService.API.csproj`, `DocumentService.Application.csproj`,
and `DocumentService.Infrastructure.csproj` to reflect the new
naming convention. Updated `DocumentService.sln` to remove
old project references, add new ones, and adjust configuration
and nested project mappings accordingly. This change aligns
the project structure with the new naming convention.
This commit is contained in:
2026-08-30 21:33:25 +02:00
parent 050cb55bf9
commit 207c778f3a
108 changed files with 37 additions and 37 deletions

View File

@@ -0,0 +1,44 @@
using AutoMapper;
using DocumentService.Application.Common.DTOs;
using DocumentService.Application.Common.Interfaces;
using MediatR;
namespace DocumentService.Application.SwissQrCode.Queries;
/// <summary>
/// Query for extracting Swiss QR Code from PDF (Stream-based)
/// </summary>
public record ExtractSwissQrCodeQuery : IRequest<SwissQrCodeExtractionResult>
{
/// <summary>
/// PDF as stream (caller is responsible for disposal)
/// </summary>
public required Stream PdfStream { get; init; }
}
/// <summary>
/// Handler for ExtractSwissQrCodeQuery
/// Orchestrates Swiss QR Code extraction using ISwissQrCodeProcessor and AutoMapper
/// </summary>
public class ExtractSwissQrCodeQueryHandler(ISwissQrCodeProcessor qrCodeProcessor, IMapper mapper)
: IRequestHandler<ExtractSwissQrCodeQuery, SwissQrCodeExtractionResult>
{
/// <summary>
/// Extracts and parses Swiss QR Code from the PDF (default: scans all pages starting with last)
/// Returns both parsed Bill DTO and raw QR text lines
/// </summary>
public async Task<SwissQrCodeExtractionResult> Handle(ExtractSwissQrCodeQuery request, CancellationToken cancellationToken)
{
// Extract: returns (Bill, RawLines) - pass stream directly
var (bill, rawLines) = await qrCodeProcessor.ExtractSwissQrCodeAsync(request.PdfStream, pageNumbers: null, cancellationToken);
// Map Codecrete Bill to DTO using AutoMapper
var billDto = mapper.Map<SwissQrBillDto>(bill);
// Return references (passed through) + Bill DTO + raw lines
return new SwissQrCodeExtractionResult(
Bill: billDto,
RawLines: rawLines
);
}
}

View File

@@ -0,0 +1,19 @@
using DocumentService.Application.SwissQrCode.Queries;
using FluentValidation;
namespace DocumentService.Application.SwissQrCode.Queries;
/// <summary>
/// Validates ExtractSwissQrCodeQuery before handler execution.
/// Ensures PdfStream is not null.
/// </summary>
public sealed class ExtractSwissQrCodeQueryValidator : AbstractValidator<ExtractSwissQrCodeQuery>
{
public ExtractSwissQrCodeQueryValidator()
{
// Rule: PdfStream must be provided
RuleFor(x => x.PdfStream)
.NotNull()
.WithMessage("PdfStream is required");
}
}