add DocSignedNotificationStatusHandler and implement the natification into EnveloepControler

This commit is contained in:
2025-09-03 16:24:51 +02:00
parent aafed0f4f4
commit fb5d2110bd
5 changed files with 48 additions and 38 deletions

View File

@@ -1,4 +1,7 @@
using MediatR;
using EnvelopeGenerator.Application.DocStatus.Commands;
using EnvelopeGenerator.Domain.Constants;
using MediatR;
using Newtonsoft.Json;
namespace EnvelopeGenerator.Application.Common.Notifications.Handlers;
@@ -7,15 +10,30 @@ namespace EnvelopeGenerator.Application.Common.Notifications.Handlers;
/// </summary>
public class DocSignedNotificationStatusHandler : INotificationHandler<DocSignedNotification>
{
private readonly ISender _sender;
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
public DocSignedNotificationStatusHandler(ISender sender)
{
_sender = sender;
}
/// <summary>
///
/// </summary>
/// <param name="notification"></param>
/// <param name="cancellationToken"></param>
/// <param name="cancel"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public Task Handle(DocSignedNotification notification, CancellationToken cancellationToken)
public async Task Handle(DocSignedNotification notification, CancellationToken cancel)
{
throw new NotImplementedException();
await _sender.Send(new SaveDocStatusCommand()
{
Envelope = new() { Id = notification.EnvelopeId },
Receiver = new() { Id = notification.ReceiverId},
Value = JsonConvert.SerializeObject(notification.Annotations, Format.Json.ForAnnotations)
}, cancel);
}
}
}