diff --git a/EnvelopeGenerator.Application/Documents/Queries/ReadDocumentQuery.cs b/EnvelopeGenerator.Application/Documents/Queries/ReadDocumentQuery.cs index 7e80a9fe..4dac7e74 100644 --- a/EnvelopeGenerator.Application/Documents/Queries/ReadDocumentQuery.cs +++ b/EnvelopeGenerator.Application/Documents/Queries/ReadDocumentQuery.cs @@ -32,6 +32,7 @@ public class ReadDocumentQueryHandler : IRequestHandler class. /// /// The repository used to access entities. + /// public ReadDocumentQueryHandler(IRepository envelopeDocumentRepository, IMapper mapper) { _repo = envelopeDocumentRepository; @@ -42,24 +43,23 @@ public class ReadDocumentQueryHandler : IRequestHandler and returns a based on the provided identifiers. /// /// The query containing the document ID or envelope ID to search for. - /// A token to monitor for cancellation requests. + /// A token to monitor for cancellation requests. /// /// A if a matching document is found; otherwise, null. /// /// /// Thrown when neither nor is provided. /// - [Obsolete("Use MediatR")] - public async Task Handle(ReadDocumentQuery query, CancellationToken cancellationToken) + public async Task Handle(ReadDocumentQuery query, CancellationToken cancel) { if (query.Id is not null) { - var doc = await _repo.ReadOnly().Where(d => d.Id == query.Id).FirstOrDefaultAsync(); + var doc = await _repo.ReadOnly().Where(d => d.Id == query.Id).FirstOrDefaultAsync(cancel); return _mapper.Map(doc); } else if (query.EnvelopeId is not null) { - var doc = await _repo.ReadOnly().Where(d => d.EnvelopeId == query.EnvelopeId).FirstOrDefaultAsync(); + var doc = await _repo.ReadOnly().Where(d => d.EnvelopeId == query.EnvelopeId).FirstOrDefaultAsync(cancel); return _mapper.Map(doc); }