Compare commits
19 Commits
59e73dbcf0
...
8a4d3ff6f9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a4d3ff6f9 | ||
|
|
783d91a658 | ||
|
|
ad032b2bdf | ||
|
|
f2876d8995 | ||
|
|
5468d7b2aa | ||
|
|
b005c194d3 | ||
|
|
dee6608390 | ||
|
|
8b53eae6da | ||
|
|
405b619bdc | ||
|
|
c5918b8e49 | ||
|
|
05cd8a05f4 | ||
|
|
2355a566e4 | ||
|
|
c887f857cd | ||
|
|
f114144d34 | ||
|
|
5c09601e3f | ||
|
|
18b05a3c63 | ||
|
|
ce35b0fea1 | ||
|
|
7f18cd64c5 | ||
|
|
0083c1b6c1 |
@@ -1,47 +1,13 @@
|
|||||||
using DigitalData.Core.Exceptions;
|
using EnvelopeGenerator.Application.Model;
|
||||||
using EnvelopeGenerator.Domain;
|
using EnvelopeGenerator.Domain;
|
||||||
using EnvelopeGenerator.Extensions;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record ModifyDocStatusCommandBase
|
public record ModifyDocStatusCommandBase : EnvelopeReceiverQueryBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string? Key
|
|
||||||
{
|
|
||||||
get => Envelope?.Uuid is string uuid && Receiver?.Signature is string signature
|
|
||||||
? (uuid, signature).EncodeEnvelopeReceiverId()
|
|
||||||
: null;
|
|
||||||
init
|
|
||||||
{
|
|
||||||
if (value is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
(string? EnvelopeUuid, string? ReceiverSignature) = value.DecodeEnvelopeReceiverId();
|
|
||||||
if (string.IsNullOrEmpty(EnvelopeUuid) || string.IsNullOrEmpty(ReceiverSignature))
|
|
||||||
{
|
|
||||||
throw new BadRequestException("Der EnvelopeReceiverKey muss ein gültiger Base64-kodierter String sein, der die EnvelopeUuid und die ReceiverSignature enthält.");
|
|
||||||
}
|
|
||||||
Envelope.Uuid = EnvelopeUuid;
|
|
||||||
Receiver.Signature = ReceiverSignature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Der Umschlag, der mit dem Empfänger verknüpft ist.
|
|
||||||
/// </summary>
|
|
||||||
public EnvelopeQuery Envelope { get; set; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Der Empfänger, der mit dem Umschlag verknüpft ist.
|
|
||||||
/// </summary>
|
|
||||||
public ReceiverQuery Receiver { get; set; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current status code.
|
/// Gets the current status code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -71,43 +37,3 @@ public record ModifyDocStatusCommandBase
|
|||||||
Value = Value
|
Value = Value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Queries
|
|
||||||
/// <summary>
|
|
||||||
/// Repräsentiert eine Abfrage für Umschläge.
|
|
||||||
/// </summary>
|
|
||||||
public record EnvelopeQuery
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Die eindeutige Kennung des Umschlags.
|
|
||||||
/// </summary>
|
|
||||||
public int? Id { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Die universell eindeutige Kennung des Umschlags.
|
|
||||||
/// </summary>
|
|
||||||
public string? Uuid { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
|
||||||
/// um spezifische Informationen über einen Empfänger abzurufen.
|
|
||||||
/// </summary>
|
|
||||||
public record ReceiverQuery
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ID des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public int? Id { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// E-Mail Adresse des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public string? EmailAddress { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Eindeutige Signatur des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public string? Signature { get; set; }
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
using DigitalData.Core.Exceptions;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Linq.Expressions;
|
using EnvelopeGenerator.Application.Extensions;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
||||||
|
|
||||||
@@ -60,30 +59,13 @@ public class SaveDocStatusCommandHandler : IRequestHandler<SaveDocStatusCommand,
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<int?> Handle(SaveDocStatusCommand request, CancellationToken cancel)
|
public async Task<int?> Handle(SaveDocStatusCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
// envelope filter
|
|
||||||
Expression<Func<DocumentStatus, bool>>? eExp =
|
|
||||||
request.Envelope.Id is not null
|
|
||||||
? ds => ds.EnvelopeId == request.Envelope.Id
|
|
||||||
: !string.IsNullOrWhiteSpace(request.Envelope.Uuid)
|
|
||||||
? ds => ds.Envelope.Uuid == request.Envelope.Uuid
|
|
||||||
: throw new BadRequestException();
|
|
||||||
|
|
||||||
// receiver filter
|
|
||||||
Expression<Func<DocumentStatus, bool>>? rExp =
|
|
||||||
request.Receiver.Id is not null
|
|
||||||
? ds => ds.ReceiverId == request.Receiver.Id
|
|
||||||
: request.Receiver.EmailAddress is not null
|
|
||||||
? ds => ds.Receiver.EmailAddress == request.Receiver.EmailAddress
|
|
||||||
: !string.IsNullOrWhiteSpace(request.Receiver.Signature) ? ds => ds.Receiver.Signature == request.Receiver.Signature
|
|
||||||
: throw new BadRequestException();
|
|
||||||
|
|
||||||
// ceck if exists
|
// ceck if exists
|
||||||
bool isExists = await _repo.ReadOnly().Where(eExp).Where(rExp).AnyAsync(cancel);
|
bool isExists = await _repo.ReadOnly().Where(request).AnyAsync(cancel);
|
||||||
|
|
||||||
if (isExists)
|
if (isExists)
|
||||||
{
|
{
|
||||||
var uReq = request.To<UpdateDocStatusCommand>();
|
var uReq = request.To<UpdateDocStatusCommand>();
|
||||||
await _repo.UpdateAsync(uReq, q => q.Where(eExp).Where(rExp), cancel);
|
await _repo.UpdateAsync(uReq, q => q.Where(request), cancel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -91,7 +73,7 @@ public class SaveDocStatusCommandHandler : IRequestHandler<SaveDocStatusCommand,
|
|||||||
await _repo.CreateAsync(cReq, cancel);
|
await _repo.CreateAsync(cReq, cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
var docStatus = await _repo.ReadOnly().Where(eExp).Where(rExp).SingleOrDefaultAsync(cancel);
|
var docStatus = await _repo.ReadOnly().Where(request).SingleOrDefaultAsync(cancel);
|
||||||
return docStatus?.Id;
|
return docStatus?.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,5 @@ public class MappingProfile : Profile
|
|||||||
{
|
{
|
||||||
CreateMap<CreateDocStatusCommand, DocumentStatus>();
|
CreateMap<CreateDocStatusCommand, DocumentStatus>();
|
||||||
CreateMap<UpdateDocStatusCommand, DocumentStatus>();
|
CreateMap<UpdateDocStatusCommand, DocumentStatus>();
|
||||||
CreateMap<EnvelopeQuery, Envelope>();
|
|
||||||
CreateMap<ReceiverQuery, Receiver>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
using DigitalData.Core.Exceptions;
|
using DigitalData.Core.Exceptions;
|
||||||
|
using EnvelopeGenerator.Application.Model;
|
||||||
using EnvelopeGenerator.Domain;
|
using EnvelopeGenerator.Domain;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using EnvelopeGenerator.Extensions;
|
using EnvelopeGenerator.Extensions;
|
||||||
@@ -11,58 +12,7 @@ namespace EnvelopeGenerator.Application.EnvelopeReceivers.Queries;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record ReceiverAlreadySignedQuery : IRequest<bool>
|
public record ReceiverAlreadySignedQuery : EnvelopeReceiverQueryBase, IRequest<bool>;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Key
|
|
||||||
{
|
|
||||||
get => (Envelope.Uuid, Receiver.Signature).EncodeEnvelopeReceiverId();
|
|
||||||
init
|
|
||||||
{
|
|
||||||
(string? EnvelopeUuid, string? ReceiverSignature) = value.DecodeEnvelopeReceiverId();
|
|
||||||
if (string.IsNullOrEmpty(EnvelopeUuid) || string.IsNullOrEmpty(ReceiverSignature))
|
|
||||||
{
|
|
||||||
throw new BadRequestException("Der EnvelopeReceiverKey muss ein gültiger Base64-kodierter String sein, der die EnvelopeUuid und die ReceiverSignature enthält.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public EnvelopeQuery Envelope { get; set; } = new EnvelopeQuery();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public ReceiverQuery Receiver { get; set; } = new ReceiverQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Queries
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public record EnvelopeQuery()
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Uuid { get; set; } = null!;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public record ReceiverQuery()
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Signature { get; set; } = null!;
|
|
||||||
};
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
77
EnvelopeGenerator.Application/Extensions/QueryExtensions.cs
Normal file
77
EnvelopeGenerator.Application/Extensions/QueryExtensions.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using DigitalData.Core.Exceptions;
|
||||||
|
using EnvelopeGenerator.Application.Model;
|
||||||
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class QueryExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity>(this IQueryable<TEntity> root, EnvelopeQueryBase query, bool notnull = true)
|
||||||
|
where TEntity : IHasEnvelope
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Envelope!.Id == query.Id);
|
||||||
|
else if (query.Uuid is not null)
|
||||||
|
root = root.Where(e => e.Envelope!.Uuid == query.Uuid);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Either Envelope Id or Envelope Uuid must be provided in the query."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity>(this IQueryable<TEntity> root, ReceiverQueryBase query, bool notnull = true)
|
||||||
|
where TEntity : IHasReceiver
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.Id == query.Id);
|
||||||
|
else if (query.EmailAddress is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.EmailAddress == query.EmailAddress);
|
||||||
|
else if (query.Signature is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.Signature == query.Signature);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Receiver must have at least one identifier (Id, EmailAddress, or Signature)."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <typeparam name="TEnvelopeQuery"></typeparam>
|
||||||
|
/// <typeparam name="TReceiverQuery"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity, TEnvelopeQuery, TReceiverQuery>(this IQueryable<TEntity> root, EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery> query, bool notnull = true)
|
||||||
|
where TEntity : IHasEnvelope, IHasReceiver
|
||||||
|
where TEnvelopeQuery : EnvelopeQueryBase, new()
|
||||||
|
where TReceiverQuery : ReceiverQueryBase, new()
|
||||||
|
=> root.Where(query.Envelope, notnull).Where(query.Receiver, notnull);
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
|
using EnvelopeGenerator.Application.Model;
|
||||||
using EnvelopeGenerator.Domain;
|
using EnvelopeGenerator.Domain;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
@@ -44,54 +45,14 @@ public record CreateHistoryCommand : IRequest<long?>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EnvelopeQuery? Envelope { get; init; }
|
public EnvelopeQueryBase? Envelope { get; init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// /
|
/// /
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReceiverQuery? Receiver { get; init; }
|
public ReceiverQueryBase? Receiver { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Queries
|
|
||||||
/// <summary>
|
|
||||||
/// Repräsentiert eine Abfrage für Umschläge.
|
|
||||||
/// </summary>
|
|
||||||
public record EnvelopeQuery
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Die eindeutige Kennung des Umschlags.
|
|
||||||
/// </summary>
|
|
||||||
public int? Id { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Die universell eindeutige Kennung des Umschlags.
|
|
||||||
/// </summary>
|
|
||||||
public string? Uuid { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
|
||||||
/// um spezifische Informationen über einen Empfänger abzurufen.
|
|
||||||
/// </summary>
|
|
||||||
public record ReceiverQuery
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ID des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public int? Id { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// E-Mail Adresse des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public string? EmailAddress { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Eindeutige Signatur des Empfängers
|
|
||||||
/// </summary>
|
|
||||||
public string? Signature { get; set; }
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
17
EnvelopeGenerator.Application/Model/EnvelopeQueryBase.cs
Normal file
17
EnvelopeGenerator.Application/Model/EnvelopeQueryBase.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Model;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
|
/// </summary>
|
||||||
|
public record EnvelopeQueryBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Die eindeutige Kennung des Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? Id { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die universell eindeutige Kennung des Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Uuid { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using DigitalData.Core.Exceptions;
|
||||||
|
using EnvelopeGenerator.Extensions;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Model;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public record EnvelopeReceiverQueryBase : EnvelopeReceiverQueryBase<EnvelopeQueryBase, ReceiverQueryBase>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEnvelopeQuery"></typeparam>
|
||||||
|
/// <typeparam name="TReceiverQuery"></typeparam>
|
||||||
|
public record EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery>
|
||||||
|
where TEnvelopeQuery : EnvelopeQueryBase, new()
|
||||||
|
where TReceiverQuery : ReceiverQueryBase, new()
|
||||||
|
{
|
||||||
|
private string? _key;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Key
|
||||||
|
{
|
||||||
|
get => _key;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
_key = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(string? EnvelopeUuid, string? ReceiverSignature) = value.DecodeEnvelopeReceiverId();
|
||||||
|
if (string.IsNullOrEmpty(EnvelopeUuid) || string.IsNullOrEmpty(ReceiverSignature))
|
||||||
|
throw new BadRequestException("Der EnvelopeReceiverKey muss ein gültiger Base64-kodierter String sein, der die EnvelopeUuid und die ReceiverSignature enthält.");
|
||||||
|
|
||||||
|
Envelope = new TEnvelopeQuery()
|
||||||
|
{
|
||||||
|
Uuid = EnvelopeUuid
|
||||||
|
};
|
||||||
|
Receiver = new TReceiverQuery()
|
||||||
|
{
|
||||||
|
Signature = ReceiverSignature
|
||||||
|
};
|
||||||
|
_key = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
|
/// </summary>
|
||||||
|
public virtual TEnvelopeQuery Envelope { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||||
|
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||||
|
/// </summary>
|
||||||
|
public virtual TReceiverQuery Receiver { get; set; } = new();
|
||||||
|
}
|
||||||
20
EnvelopeGenerator.Application/Model/MappingProfile.cs
Normal file
20
EnvelopeGenerator.Application/Model/MappingProfile.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Model;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class MappingProfile : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public MappingProfile()
|
||||||
|
{
|
||||||
|
CreateMap<EnvelopeQueryBase, Envelope>();
|
||||||
|
CreateMap<ReceiverQueryBase, Receiver>();
|
||||||
|
CreateMap<EnvelopeReceiverQueryBase, EnvelopeReceiver>();
|
||||||
|
}
|
||||||
|
}
|
||||||
23
EnvelopeGenerator.Application/Model/ReceiverQueryBase.cs
Normal file
23
EnvelopeGenerator.Application/Model/ReceiverQueryBase.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Model;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||||
|
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||||
|
/// </summary>
|
||||||
|
public record ReceiverQueryBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ID des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? Id { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// E-Mail Adresse des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? EmailAddress { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eindeutige Signatur des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Signature { get; set; }
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
using System;
|
using System;
|
||||||
#endif
|
#endif
|
||||||
@@ -12,7 +14,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Table("TBSIG_DOCUMENT_STATUS", Schema = "dbo")]
|
[Table("TBSIG_DOCUMENT_STATUS", Schema = "dbo")]
|
||||||
public class DocumentStatus
|
public class DocumentStatus : IHasEnvelope, IHasReceiver
|
||||||
{
|
{
|
||||||
public DocumentStatus()
|
public DocumentStatus()
|
||||||
{
|
{
|
||||||
@@ -43,10 +45,18 @@ public class DocumentStatus
|
|||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
[ForeignKey("EnvelopeId")]
|
[ForeignKey("EnvelopeId")]
|
||||||
public virtual Envelope Envelope { get; set; }
|
public virtual Envelope
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Envelope { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ReceiverId")]
|
[ForeignKey("ReceiverId")]
|
||||||
public virtual Receiver Receiver { get; set; }
|
public virtual Receiver
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Receiver { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Drawing;
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
using System;
|
using System;
|
||||||
#endif
|
#endif
|
||||||
@@ -13,7 +14,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
|
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
|
||||||
public class EnvelopeReceiver
|
public class EnvelopeReceiver : IHasEnvelope, IHasReceiver
|
||||||
{
|
{
|
||||||
public EnvelopeReceiver()
|
public EnvelopeReceiver()
|
||||||
{
|
{
|
||||||
@@ -70,10 +71,18 @@ public class EnvelopeReceiver
|
|||||||
public bool HasPhoneNumber => !string.IsNullOrWhiteSpace(PhoneNumber);
|
public bool HasPhoneNumber => !string.IsNullOrWhiteSpace(PhoneNumber);
|
||||||
|
|
||||||
[ForeignKey("EnvelopeId")]
|
[ForeignKey("EnvelopeId")]
|
||||||
public Envelope Envelope { get; set; }
|
public Envelope
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Envelope { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ReceiverId")]
|
[ForeignKey("ReceiverId")]
|
||||||
public Receiver Receiver { get; set; }
|
public Receiver
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Receiver { get; set; }
|
||||||
|
|
||||||
#region Model of old serice
|
#region Model of old serice
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@@ -86,8 +95,8 @@ public class EnvelopeReceiver
|
|||||||
public bool HasEmailAndName =>
|
public bool HasEmailAndName =>
|
||||||
!string.IsNullOrWhiteSpace(Receiver.EmailAddress) &&
|
!string.IsNullOrWhiteSpace(Receiver.EmailAddress) &&
|
||||||
!string.IsNullOrWhiteSpace(Name);
|
!string.IsNullOrWhiteSpace(Name);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
}
|
}
|
||||||
|
|||||||
22
EnvelopeGenerator.Domain/Interfaces/IHasEnvelope.cs
Normal file
22
EnvelopeGenerator.Domain/Interfaces/IHasEnvelope.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Interfaces
|
||||||
|
#if NET
|
||||||
|
;
|
||||||
|
#elif NETFRAMEWORK
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public interface IHasEnvelope
|
||||||
|
{
|
||||||
|
#if NET
|
||||||
|
public
|
||||||
|
#endif
|
||||||
|
Entities.Envelope
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Envelope { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NETFRAMEWORK
|
||||||
|
}
|
||||||
|
#endif
|
||||||
22
EnvelopeGenerator.Domain/Interfaces/IHasReceiver.cs
Normal file
22
EnvelopeGenerator.Domain/Interfaces/IHasReceiver.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Interfaces
|
||||||
|
#if NET
|
||||||
|
;
|
||||||
|
#elif NETFRAMEWORK
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public interface IHasReceiver
|
||||||
|
{
|
||||||
|
#if NET
|
||||||
|
public
|
||||||
|
#endif
|
||||||
|
Entities.Receiver
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Receiver { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NETFRAMEWORK
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user