refactor(AnnotationDto): split AnnotationDto into AnnotationCreateDto and AnnotationDto
- Introduced AnnotationCreateDto for creation-specific properties - AnnotationDto now inherits from AnnotationCreateDto and includes Id, AddedWhen, ChangedWhen, and ChangedWho - Added Type property to AnnotationCreateDto - remove CreateAnnotationCommand
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using EnvelopeGenerator.Application.Annotations.Commands;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.Common.Extensions;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
@@ -12,7 +12,7 @@ namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned;
|
||||
/// </summary>
|
||||
/// <param name="Instant"></param>
|
||||
/// <param name="Structured"></param>
|
||||
public record PsPdfKitAnnotation(ExpandoObject Instant, IEnumerable<CreateAnnotationCommand> Structured);
|
||||
public record PsPdfKitAnnotation(ExpandoObject Instant, IEnumerable<AnnotationCreateDto> Structured);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EnvelopeGenerator.Application.Annotations.Commands;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
||||
@@ -11,15 +12,15 @@ public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private readonly ISender _sender;
|
||||
private readonly IRepository<Annotation> _repo;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
public AnnotationHandler(ISender sender)
|
||||
/// <param name="repository"></param>
|
||||
public AnnotationHandler(IRepository<Annotation> repository)
|
||||
{
|
||||
_sender = sender;
|
||||
_repo = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -28,11 +29,6 @@ public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
||||
/// <param name="notification"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public Task Handle(DocSignedNotification notification, CancellationToken cancel) => _sender.Send(new CreateAnnotationCommand()
|
||||
{
|
||||
Envelope = new() { Id = notification.EnvelopeId },
|
||||
Receiver = new() { Id = notification.ReceiverId },
|
||||
PSPDFKitInstant = notification.PsPdfKitAnnotation.Instant
|
||||
}, cancel);
|
||||
}
|
||||
public Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
||||
=> _repo.CreateAsync(notification.PsPdfKitAnnotation.Structured, cancel);
|
||||
}
|
||||
Reference in New Issue
Block a user