Updated TestAnnotationController.Delete to extract the receiver signature from the envelope key and pass it along with the envelope UUID when publishing RemoveSignatureNotification. Returns BadRequest if the signature is missing.
35 lines
983 B
C#
35 lines
983 B
C#
using EnvelopeGenerator.Application.Common.Extensions;
|
|
using EnvelopeGenerator.Application.Common.Notifications.RemoveSignature;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
|
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class TestAnnotationController : ControllerBase
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public TestAnnotationController(IMediator mediator)
|
|
{
|
|
_mediator = mediator;
|
|
}
|
|
|
|
[HttpDelete("{envelopeKey}")]
|
|
public async Task<IActionResult> Delete([FromRoute] string envelopeKey)
|
|
{
|
|
if (envelopeKey.GetEnvelopeUuid() is not string uuid)
|
|
return BadRequest();
|
|
|
|
if (envelopeKey.GetReceiverSignature() is not string signature)
|
|
return BadRequest();
|
|
|
|
await _mediator.Publish(new RemoveSignatureNotification()
|
|
{
|
|
EnvelopeUuid = uuid,
|
|
ReceiverSignature = signature
|
|
});
|
|
return Ok();
|
|
}
|
|
} |