Files
DocumentService/DocumentOperator.Application/ExtractPdfAttachments/ExtractPdfAttachmentsCommand.cs
TekH 0e88b349d7 Rebrand project: DocumentOperator to DocumentService
This commit implements a complete rebranding of the project:
- Updated all namespaces from `DocumentOperator` to `DocumentService`.
- Renamed file paths, embedded resources, and test data references.
- Updated configuration keys, logging paths, and Redis instance names.
- Revised documentation to reflect the new project name.
- Modified project and solution files to align with the new structure.
- Updated class names, DTOs, commands, queries, and handlers.
- Adjusted middleware, controllers, and API endpoints.
- Updated Swagger metadata and API titles to `DocumentService API`.
- Refactored test namespaces, resource paths, and embedded resources.
- Updated build and deployment configurations for the new name.
- Replaced all references to `DocumentOperator` in comments and literals.

These changes ensure consistency across the codebase and documentation.
2026-07-30 14:02:56 +02:00

44 lines
1.4 KiB
C#

using DocumentService.Application.Common.Interfaces;
using FluentValidation;
using MediatR;
namespace DocumentService.Application.ExtractPdfAttachments;
/// <summary>
/// Command to extract all embedded files from a PDF document and return as ZIP archive.
/// </summary>
public record ExtractPdfAttachmentsCommand : IRequest<byte[]>
{
/// <summary>
/// PDF document stream. Must be positioned at the beginning (Position = 0).
/// </summary>
public required Stream PdfStream { get; init; }
}
/// <summary>
/// Handler for ExtractPdfAttachmentsCommand.
/// Extracts all embedded files from PDF and returns as ZIP archive.
/// </summary>
public class ExtractPdfAttachmentsCommandHandler(IPdfProcessor pdfProcessor)
: IRequestHandler<ExtractPdfAttachmentsCommand, byte[]>
{
public async Task<byte[]> Handle(ExtractPdfAttachmentsCommand request, CancellationToken cancellationToken)
{
// Delegate to infrastructure layer
return await pdfProcessor.ExtractAttachmentsAsync(request.PdfStream);
}
}
/// <summary>
/// Validator for ExtractPdfAttachmentsCommand.
/// </summary>
public class ExtractPdfAttachmentsCommandValidator : AbstractValidator<ExtractPdfAttachmentsCommand>
{
public ExtractPdfAttachmentsCommandValidator()
{
RuleFor(x => x.PdfStream)
.NotNull()
.WithMessage("PDF stream is required");
}
}