ReadDocumentQuery und Handler zum Abrufen von Dokumenten hinzufügen
Führt die Struktur `ReadDocumentQuery` zur Abfrage von Dokumenten anhand ihrer eindeutigen Kennung oder der zugehörigen Umschlagkennung ein und implementiert die Schnittstelle `IRequest<ReadDocumentResponse>` von MediatR. Eine neue Handler-Klasse, `ReadDocumentQueryHandler`, wird erstellt, um die Abfrage zu verarbeiten, obwohl die Verarbeitungslogik noch nicht implementiert ist. Außerdem wird eine Antwortstruktur, `ReadDocumentResponse`, definiert, um die Daten zu kapseln, die beim Lesen eines Dokuments zurückgegeben werden, einschließlich der Eigenschaften für die ID des Dokuments, die Umschlag-ID, das Hinzufügedatum und die Binärdaten. Die erforderlichen Namespaces werden für die richtige Organisation und Funktionalität hinzugefügt.
This commit is contained in:
parent
44aeb53413
commit
11f4896556
@ -0,0 +1,12 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a query to read a document based on its unique identifier or associated envelope identifier.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the document. Optional.</param>
|
||||
/// <param name="EnvelopeId">The identifier of the envelope associated with the document. Optional.</param>
|
||||
public record ReadDocumentQuery(int? Id = null, int? EnvelopeId = null) : IRequest<ReadDocumentResponse>
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, ReadDocumentResponse>
|
||||
{
|
||||
public IEnvelopeDocumentRepository _repo;
|
||||
|
||||
public ReadDocumentQueryHandler(IEnvelopeDocumentRepository envelopeDocumentRepository)
|
||||
{
|
||||
_repo = envelopeDocumentRepository;
|
||||
}
|
||||
|
||||
public Task<ReadDocumentResponse> Handle(ReadDocumentQuery query, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response for reading a document.
|
||||
/// </summary>
|
||||
/// <param name="Guid">The unique identifier of the document.</param>
|
||||
/// <param name="EnvelopeId">The identifier of the associated envelope.</param>
|
||||
/// <param name="AddedWhen">The date and time when the document was added.</param>
|
||||
/// <param name="ByteData">The binary data of the document, if available.</param>
|
||||
public record ReadDocumentResponse(
|
||||
int Guid,
|
||||
int EnvelopeId,
|
||||
DateTime AddedWhen,
|
||||
byte[]? ByteData
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user