refactor: move CreateAnnotationCommand extension to separate static class
This commit is contained in:
parent
d10f19d92a
commit
ecc7552951
@ -1,5 +1,4 @@
|
|||||||
using AngleSharp.Dom;
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
|
||||||
using EnvelopeGenerator.Application.Common.Extensions;
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
using EnvelopeGenerator.Application.Common.Query;
|
using EnvelopeGenerator.Application.Common.Query;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
@ -48,6 +47,22 @@ public record CreateAnnotationCommand : EnvelopeReceiverQueryBase, IRequest<IEnu
|
|||||||
public ExpandoObject PSPDFKitInstant => _lazyPSPDFKitInstant.Value;
|
public ExpandoObject PSPDFKitInstant => _lazyPSPDFKitInstant.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class CreateAnnotationCommandExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="envelopeKey"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task<IEnumerable<Signature>> CreateAnnotation(this ISender sender, string envelopeKey, CancellationToken cancel = default)
|
||||||
|
=> sender.Send(new CreateAnnotationCommand() { Key = envelopeKey }, cancel);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using EnvelopeGenerator.Application.Common.Extensions;
|
using EnvelopeGenerator.Application.Annotations.Commands;
|
||||||
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
using EnvelopeGenerator.Application.Common.Notifications.RemoveSignature;
|
using EnvelopeGenerator.Application.Common.Notifications.RemoveSignature;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -27,4 +28,11 @@ public class TestAnnotationController : ControllerBase
|
|||||||
await _mediator.Publish(new RemoveSignatureNotification(uuid));
|
await _mediator.Publish(new RemoveSignatureNotification(uuid));
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("{envelopeKey}")]
|
||||||
|
public async Task<IActionResult> Create([FromRoute] string envelopeKey, CancellationToken cancel)
|
||||||
|
{
|
||||||
|
var annot = await _mediator.CreateAnnotation(envelopeKey, cancel);
|
||||||
|
return Ok(annot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user