38 lines
1.1 KiB
C#

using EnvelopeGenerator.Application.Annotations.Commands;
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 IMediator _mediator;
public TestAnnotationController(IMediator mediator)
{
_mediator = mediator;
}
[HttpDelete("{envelopeKey}")]
public async Task<IActionResult> Delete([FromRoute] string envelopeKey)
{
var uuid = envelopeKey.GetEnvelopeUuid();
if (uuid == null)
return BadRequest();
await _mediator.Publish(new RemoveSignatureNotification(uuid));
return Ok();
}
[HttpPost("{envelopeKey}")]
public async Task<IActionResult> Create([FromRoute] string envelopeKey, CancellationToken cancel)
{
var annot = await _mediator.CreateAnnotation(envelopeKey, cancel);
return Ok(annot);
}
}