refactor: Receiver-Service in CRUD-Service umgewandelt und DTOs aktualisiert
- Receiver-Service von einfachem CRUD zu generischem CRUD-Service umgewandelt. - `ReceiverDto` in `ReceiverReadDto` umbenannt. - Neues `ReceiverCreateDto` mit automatischer SHA-256-Signaturerstellung und aktuellem Zeitstempel erstellt. - Leeres `ReceiverUpdateDto` für zukünftige Updates hinzugefügt.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
@@ -12,7 +13,7 @@ namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
DateTime AddedWhen,
|
||||
DateTime? ActionDate,
|
||||
UserCreateDto? Sender,
|
||||
ReceiverDto? Receiver,
|
||||
ReceiverReadDto? Receiver,
|
||||
ReferenceType ReferenceType,
|
||||
string? Comment = null) : BaseDTO<long>(Id);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
@@ -25,6 +26,6 @@ namespace EnvelopeGenerator.Application.DTOs
|
||||
|
||||
public EnvelopeDto? Envelope { get; set; }
|
||||
|
||||
public ReceiverDto? Receiver { get; set; }
|
||||
public ReceiverReadDto? Receiver { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
public record ReceiverCreateDto(string EmailAddress)
|
||||
{
|
||||
public string Signature => sha256HexOfMail.Value;
|
||||
|
||||
private readonly Lazy<string> sha256HexOfMail = new(() =>
|
||||
{
|
||||
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());
|
||||
var hash_arr = SHA256.HashData(bytes_arr);
|
||||
var hexa_str = BitConverter.ToString(hash_arr);
|
||||
return hexa_str.Replace("-", string.Empty);
|
||||
});
|
||||
|
||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
public record ReceiverDto(
|
||||
public record ReceiverReadDto(
|
||||
int Id,
|
||||
string EmailAddress,
|
||||
string Signature,
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
public record ReceiverUpdateDto();
|
||||
}
|
||||
Reference in New Issue
Block a user