implement receiver already signed method

This commit is contained in:
2025-08-22 21:38:53 +02:00
parent bd7c1d4e36
commit e61d626bf3
2 changed files with 6 additions and 6 deletions

View File

@@ -44,9 +44,10 @@ public static class ReceiverAlreadySignedQueryExtensions
/// </summary> /// </summary>
/// <param name="mediator"></param> /// <param name="mediator"></param>
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="cancel"></param>
/// <returns></returns> /// <returns></returns>
public static Task<bool> ReceiverAlreadySigned(IMediator mediator, string key) public static Task<bool> ReceiverAlreadySigned(this IMediator mediator, string key, CancellationToken cancel = default)
=> mediator.Send(new ReceiverAlreadySignedQuery { Key = key }); => mediator.Send(new ReceiverAlreadySignedQuery { Key = key }, cancel);
} }
/// <summary> /// <summary>

View File

@@ -22,7 +22,6 @@ using DigitalData.Core.Abstraction.Application.DTO;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using MediatR; using MediatR;
using EnvelopeGenerator.Application.EnvelopeReceivers.Queries; using EnvelopeGenerator.Application.EnvelopeReceivers.Queries;
using EnvelopeGenerator.Application.Extensions;
namespace EnvelopeGenerator.Web.Controllers; namespace EnvelopeGenerator.Web.Controllers;
@@ -406,7 +405,7 @@ public class HomeController : ViewControllerBase
[Authorize(Roles = ReceiverRole.FullyAuth)] [Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")] [HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")] [Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId) public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId, CancellationToken cancel)
{ {
try try
{ {
@@ -417,8 +416,8 @@ public class HomeController : ViewControllerBase
if(!isExisting) if(!isExisting)
return this.ViewEnvelopeNotFound(); return this.ViewEnvelopeNotFound();
EnvelopeReceiver response = await envelopeOldService.LoadEnvelope(envelopeReceiverId); var signed = await _mediator.ReceiverAlreadySigned(envelopeReceiverId, cancel);
if (!envelopeOldService.ReceiverAlreadySigned((Envelope)response.Envelope, (int)response.Receiver.Id)) if (signed)
return base.Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked"); return base.Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);