Merge branch 'refactor/split-common'
This commit is contained in:
commit
408b1e9f0d
@ -7,7 +7,7 @@ namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
[Obsolete("Use IRepository")]
|
||||||
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
|
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Use IRepository")]
|
|
||||||
public interface IUserReceiverRepository : ICRUDRepository<UserReceiver, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstraction.Application;
|
||||||
using DigitalData.Core.Abstraction.Application;
|
|
||||||
using DigitalData.Core.Abstraction.Application.DTO;
|
using DigitalData.Core.Abstraction.Application.DTO;
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
@ -27,12 +26,4 @@ public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverRead
|
|||||||
/// <param name="signature"></param>
|
/// <param name="signature"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Result> DeleteByAsync(string? emailAddress = null, string? signature = null);
|
Task<Result> DeleteByAsync(string? emailAddress = null, string? signature = null);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TUpdateDto"></typeparam>
|
|
||||||
/// <param name="updateDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto);
|
|
||||||
}
|
}
|
||||||
@ -3,9 +3,21 @@
|
|||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
|
||||||
//TODO: move to DigitalData.Core
|
//TODO: move to DigitalData.Core
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface ISmsSender
|
public interface ISmsSender
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
string ServiceProvider { get; }
|
string ServiceProvider { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="recipient"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <returns></returns>
|
||||||
Task<SmsResponse> SendSmsAsync(string recipient, string message);
|
Task<SmsResponse> SendSmsAsync(string recipient, string message);
|
||||||
}
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using DigitalData.Core.Abstraction.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Use MediatR")]
|
|
||||||
public interface IUserReceiverService : IBasicCRUDService<UserReceiverDto, UserReceiver, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -8,11 +8,6 @@ namespace EnvelopeGenerator.Application.DTOs;
|
|||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public class ConfigDto
|
public class ConfigDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the path to the document.
|
|
||||||
/// </summary>
|
|
||||||
public string? DocumentPath { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the sending profile identifier.
|
/// Gets or sets the sending profile identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -21,7 +16,7 @@ public class ConfigDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the signature host URL or name.
|
/// Gets or sets the signature host URL or name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? SignatureHost { get; set; }
|
public required string SignatureHost { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the external program.
|
/// Gets or sets the name of the external program.
|
||||||
|
|||||||
@ -37,7 +37,6 @@ public class MappingProfile : Profile
|
|||||||
CreateMap<Domain.Entities.Receiver, ReceiverReadDto>();
|
CreateMap<Domain.Entities.Receiver, ReceiverReadDto>();
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverCreateDto>();
|
CreateMap<Domain.Entities.Receiver, ReceiverCreateDto>();
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverUpdateDto>();
|
CreateMap<Domain.Entities.Receiver, ReceiverUpdateDto>();
|
||||||
CreateMap<UserReceiver, UserReceiverDto>();
|
|
||||||
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
||||||
|
|
||||||
// DTO to Entity mappings
|
// DTO to Entity mappings
|
||||||
@ -55,7 +54,6 @@ public class MappingProfile : Profile
|
|||||||
CreateMap<ReceiverReadDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
CreateMap<ReceiverReadDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
||||||
CreateMap<ReceiverCreateDto, Domain.Entities.Receiver>();
|
CreateMap<ReceiverCreateDto, Domain.Entities.Receiver>();
|
||||||
CreateMap<ReceiverUpdateDto, Domain.Entities.Receiver>();
|
CreateMap<ReceiverUpdateDto, Domain.Entities.Receiver>();
|
||||||
CreateMap<UserReceiverDto, UserReceiver>();
|
|
||||||
CreateMap<EnvelopeReceiverBase, EnvelopeReceiverBasicDto>();
|
CreateMap<EnvelopeReceiverBase, EnvelopeReceiverBasicDto>();
|
||||||
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public record ReceiverCreateDto
|
|||||||
{
|
{
|
||||||
_sha256HexOfMail = new(() =>
|
_sha256HexOfMail = new(() =>
|
||||||
{
|
{
|
||||||
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());
|
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress!.ToUpper());
|
||||||
var hash_arr = SHA256.HashData(bytes_arr);
|
var hash_arr = SHA256.HashData(bytes_arr);
|
||||||
var hexa_str = BitConverter.ToString(hash_arr);
|
var hexa_str = BitConverter.ToString(hash_arr);
|
||||||
return hexa_str.Replace("-", string.Empty);
|
return hexa_str.Replace("-", string.Empty);
|
||||||
@ -37,7 +37,7 @@ public record ReceiverCreateDto
|
|||||||
public string? TotpSecretkey { get; init; }
|
public string? TotpSecretkey { get; init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());<br>
|
/// var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());<br/>
|
||||||
/// var hash_arr = SHA256.HashData(bytes_arr);
|
/// var hash_arr = SHA256.HashData(bytes_arr);
|
||||||
/// var hexa_str = BitConverter.ToString(hash_arr);
|
/// var hexa_str = BitConverter.ToString(hash_arr);
|
||||||
/// return hexa_str.Replace("-", string.Empty);
|
/// return hexa_str.Replace("-", string.Empty);
|
||||||
|
|||||||
@ -4,26 +4,57 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public class ReceiverReadDto
|
public class ReceiverReadDto
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string EmailAddress { get; set; }
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required string EmailAddress { get; set; }
|
||||||
|
|
||||||
public string Signature { get; set; }
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required string Signature { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public DateTime AddedWhen { get; set; }
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; set; }
|
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? TotpSecretkey { get; set; } = null;
|
public string? TotpSecretkey { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public DateTime? TfaRegDeadline { get; set; }
|
public DateTime? TfaRegDeadline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return Id.GetHashCode();
|
return Id.GetHashCode();
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data Transfer Object representing a user receiver with associated details.
|
|
||||||
/// </summary>
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public class UserReceiverDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the unique identifier of the user receiver.
|
|
||||||
/// </summary>
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the identifier of the user associated with the receiver.
|
|
||||||
/// </summary>
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the identifier of the receiver.
|
|
||||||
/// </summary>
|
|
||||||
public int ReceiverId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name of the receiver.
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the company name of the receiver.
|
|
||||||
/// </summary>
|
|
||||||
public string CompanyName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the job title of the receiver.
|
|
||||||
/// </summary>
|
|
||||||
public string JobTitle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the timestamp when the user receiver was added.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime AddedWhen { get; set; }
|
|
||||||
}
|
|
||||||
@ -5,20 +5,19 @@ namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ein Befehl zum Zurücksetzen einer E-Mail-Vorlage auf die Standardwerte.
|
/// Ein Befehl zum Zurücksetzen einer E-Mail-Vorlage auf die Standardwerte.
|
||||||
/// Erbt von <see cref="EmailTemplateQuery"/> und ermöglicht die Angabe einer optionalen ID und eines Typs der E-Mail-Vorlage.
|
/// Erbt von <see cref="EmailTemplateQuery"/> und ermöglicht die Angabe einer optionalen ID und eines Typs der E-Mail-Vorlage.<br/><br/>
|
||||||
|
/// Beispiele:<br/>
|
||||||
|
/// 0 - DocumentReceived: Benachrichtigung über den Empfang eines Dokuments.<br/>
|
||||||
|
/// 1 - DocumentSigned: Benachrichtigung über die Unterzeichnung eines Dokuments.<br/>
|
||||||
|
/// 2 - DocumentDeleted: Benachrichtigung über das Löschen eines Dokuments.<br/>
|
||||||
|
/// 3 - DocumentCompleted: Benachrichtigung über den Abschluss eines Dokuments.<br/>
|
||||||
|
/// 4 - DocumentAccessCodeReceived: Benachrichtigung über den Erhalt eines Zugangscodes.<br/>
|
||||||
|
/// 5 - DocumentShared: Benachrichtigung über das Teilen eines Dokuments.<br/>
|
||||||
|
/// 6 - TotpSecret: Benachrichtigung über ein TOTP-Geheimnis.<br/>
|
||||||
|
/// 7 - DocumentRejected_ADM (Für den Absender): Mail an den Absender, wenn das Dokument abgelehnt wird.<br/>
|
||||||
|
/// 8 - DocumentRejected_REC (Für den ablehnenden Empfänger): Mail an den ablehnenden Empfänger, wenn das Dokument abgelehnt wird.<br/>
|
||||||
|
/// 9 - DocumentRejected_REC_2 (Für sonstige Empfänger): Mail an andere Empfänger (Brief), wenn das Dokument abgelehnt wird.<br/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// Beispiele:
|
|
||||||
/// 0 - DocumentReceived: Benachrichtigung über den Empfang eines Dokuments.
|
|
||||||
/// 1 - DocumentSigned: Benachrichtigung über die Unterzeichnung eines Dokuments.
|
|
||||||
/// 2 - DocumentDeleted: Benachrichtigung über das Löschen eines Dokuments.
|
|
||||||
/// 3 - DocumentCompleted: Benachrichtigung über den Abschluss eines Dokuments.
|
|
||||||
/// 4 - DocumentAccessCodeReceived: Benachrichtigung über den Erhalt eines Zugangscodes.
|
|
||||||
/// 5 - DocumentShared: Benachrichtigung über das Teilen eines Dokuments.
|
|
||||||
/// 6 - TotpSecret: Benachrichtigung über ein TOTP-Geheimnis.
|
|
||||||
/// 7 - DocumentRejected_ADM (Für den Absender): Mail an den Absender, wenn das Dokument abgelehnt wird.
|
|
||||||
/// 8 - DocumentRejected_REC (Für den ablehnenden Empfänger): Mail an den ablehnenden Empfänger, wenn das Dokument abgelehnt wird.
|
|
||||||
/// 9 - DocumentRejected_REC_2 (Für sonstige Empfänger): Mail an andere Empfänger (Brief), wenn das Dokument abgelehnt wird.
|
|
||||||
/// </param>
|
|
||||||
public record ResetEmailTemplateCommand : EmailTemplateQuery, IRequest
|
public record ResetEmailTemplateCommand : EmailTemplateQuery, IRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -34,7 +33,7 @@ public record ResetEmailTemplateCommand : EmailTemplateQuery, IRequest
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Die optionale ID der E-Mail-Vorlage, die zurückgesetzt werden soll.</param>
|
/// <param name="Id">Die optionale ID der E-Mail-Vorlage, die zurückgesetzt werden soll.</param>
|
||||||
/// <param name="Type">Der Typ der E-Mail-Vorlage, z. B. <see cref="Constants.EmailTemplateType"/> (optional).
|
/// <param name="Type">Der Typ der E-Mail-Vorlage, z. B. <see cref="Constants.EmailTemplateType"/> (optional).</param>
|
||||||
public ResetEmailTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : base(Id, Type)
|
public ResetEmailTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : base(Id, Type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
|||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||||
private readonly IEmailTemplateRepository _repository;
|
private readonly IEmailTemplateRepository _repository;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -21,6 +22,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
|||||||
/// <param name="repository">
|
/// <param name="repository">
|
||||||
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||||
public ReadEmailTemplateQueryHandler(IMapper mapper, IEmailTemplateRepository repository)
|
public ReadEmailTemplateQueryHandler(IMapper mapper, IEmailTemplateRepository repository)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
@ -34,6 +36,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
|||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="InvalidOperationException"></exception>
|
/// <exception cref="InvalidOperationException"></exception>
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public async Task<ReadEmailTemplateResponse?> Handle(ReadEmailTemplateQuery request, CancellationToken cancellationToken)
|
public async Task<ReadEmailTemplateResponse?> Handle(ReadEmailTemplateQuery request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var temp = request.Id is int id
|
var temp = request.Id is int id
|
||||||
|
|||||||
@ -18,4 +18,4 @@ public record CreateEnvelopeReceiverCommand(
|
|||||||
[Required] DocumentCreateCommand Document,
|
[Required] DocumentCreateCommand Document,
|
||||||
[Required] IEnumerable<ReceiverGetOrCreateCommand> Receivers,
|
[Required] IEnumerable<ReceiverGetOrCreateCommand> Receivers,
|
||||||
bool TFAEnabled = false
|
bool TFAEnabled = false
|
||||||
) : CreateEnvelopeCommand(Title, Message, TFAEnabled), IRequest<CreateEnvelopeReceiverResponse?>;
|
) : CreateEnvelopeCommand(Title, Message, TFAEnabled), IRequest<CreateEnvelopeReceiverResponse>;
|
||||||
@ -1,131 +1,222 @@
|
|||||||
using Microsoft.Extensions.Caching.Distributed;
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Extensions
|
namespace EnvelopeGenerator.Application.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class CacheExtensions
|
||||||
{
|
{
|
||||||
public static class CacheExtensions
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetLongAsync(this IDistributedCache cache, string key, long value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> options is null
|
||||||
|
? cache.SetAsync(key, BitConverter.GetBytes(value), token: cToken)
|
||||||
|
: cache.SetAsync(key, BitConverter.GetBytes(value), options: options, token: cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<long?> GetLongAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
{
|
{
|
||||||
public static Task SetLongAsync(this IDistributedCache cache, string key, long value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
var value = await cache.GetAsync(key, cToken);
|
||||||
=> options is null
|
return value is null ? null : BitConverter.ToInt64(value, 0);
|
||||||
? cache.SetAsync(key, BitConverter.GetBytes(value), token: cToken)
|
|
||||||
: cache.SetAsync(key, BitConverter.GetBytes(value), options: options, token: cToken);
|
|
||||||
|
|
||||||
public static async Task<long?> GetLongAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
var value = await cache.GetAsync(key, cToken);
|
|
||||||
return value is null ? null : BitConverter.ToInt64(value, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Task SetDateTimeAsync(this IDistributedCache cache, string key, DateTime value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
|
||||||
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken: cToken);
|
|
||||||
|
|
||||||
public static async Task<DateTime?> GetDateTimeAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
var value = await cache.GetAsync(key, cToken);
|
|
||||||
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Task SetTimeSpanAsync(this IDistributedCache cache, string key, TimeSpan value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
|
||||||
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken);
|
|
||||||
|
|
||||||
public static async Task<TimeSpan?> GetTimeSpanAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
var value = await cache.GetAsync(key, cToken);
|
|
||||||
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: use code generator
|
|
||||||
#region GetOrSetAsync
|
|
||||||
|
|
||||||
#region string
|
|
||||||
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<string> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
var value = await cache.GetStringAsync(key, cToken);
|
|
||||||
if (value is null)
|
|
||||||
{
|
|
||||||
// create new and save
|
|
||||||
value = factory();
|
|
||||||
|
|
||||||
Task CacheAsync() => options is null
|
|
||||||
? cache.SetStringAsync(key, value, cToken)
|
|
||||||
: cache.SetStringAsync(key, value, options, cToken);
|
|
||||||
|
|
||||||
if (cacheInBackground)
|
|
||||||
_ = Task.Run(async () => await CacheAsync(), cToken);
|
|
||||||
else
|
|
||||||
await CacheAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<string>> factoryAsync, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
var value = await cache.GetStringAsync(key, cToken);
|
|
||||||
if(value is null)
|
|
||||||
{
|
|
||||||
// create new and save
|
|
||||||
value = await factoryAsync();
|
|
||||||
|
|
||||||
Task CacheAsync() => options is null
|
|
||||||
? cache.SetStringAsync(key: key, value: value, token: cToken)
|
|
||||||
: cache.SetStringAsync(key: key, value: value, options: options, token: cToken);
|
|
||||||
|
|
||||||
if (cacheInBackground)
|
|
||||||
_ = Task.Run(async () => await CacheAsync(), cToken);
|
|
||||||
else
|
|
||||||
await CacheAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region DateTime
|
|
||||||
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<DateTime> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
|
||||||
return dateTimeValue;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// create new and save
|
|
||||||
var newValue = factory();
|
|
||||||
|
|
||||||
Task CacheAsync() => options is null
|
|
||||||
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
|
||||||
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
|
||||||
|
|
||||||
if (cacheInBackground)
|
|
||||||
_ = Task.Run(async () => await CacheAsync(), cToken);
|
|
||||||
else
|
|
||||||
await CacheAsync();
|
|
||||||
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<DateTime>> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
|
||||||
{
|
|
||||||
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
|
||||||
return dateTimeValue;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// create new and save
|
|
||||||
var newValue = await factory();
|
|
||||||
|
|
||||||
Task CacheAsync() => options is null
|
|
||||||
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
|
||||||
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
|
||||||
|
|
||||||
if (cacheInBackground)
|
|
||||||
_ = Task.Run(async () => await CacheAsync(), cToken);
|
|
||||||
else
|
|
||||||
await CacheAsync();
|
|
||||||
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetDateTimeAsync(this IDistributedCache cache, string key, DateTime value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken: cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime?> GetDateTimeAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetAsync(key, cToken);
|
||||||
|
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetTimeSpanAsync(this IDistributedCache cache, string key, TimeSpan value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<TimeSpan?> GetTimeSpanAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetAsync(key, cToken);
|
||||||
|
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: use code generator
|
||||||
|
#region GetOrSetAsync
|
||||||
|
|
||||||
|
#region string
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<string> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetStringAsync(key, cToken);
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
value = factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetStringAsync(key, value, cToken)
|
||||||
|
: cache.SetStringAsync(key, value, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factoryAsync"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<string>> factoryAsync, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetStringAsync(key, cToken);
|
||||||
|
if(value is null)
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
value = await factoryAsync();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetStringAsync(key: key, value: value, token: cToken)
|
||||||
|
: cache.SetStringAsync(key: key, value: value, options: options, token: cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DateTime
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<DateTime> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
||||||
|
return dateTimeValue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
var newValue = factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
||||||
|
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<DateTime>> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
||||||
|
return dateTimeValue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
var newValue = await factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
||||||
|
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@ -1,14 +1,27 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Extensions
|
namespace EnvelopeGenerator.Application.Extensions;
|
||||||
{
|
|
||||||
public static class MappingExtensions
|
|
||||||
{
|
|
||||||
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
|
|
||||||
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
|
|
||||||
&& status?.ToString()?.ToLower() == "ok";
|
|
||||||
|
|
||||||
public static string ToBase64String(this byte[] bytes)
|
/// <summary>
|
||||||
=> Convert.ToBase64String(bytes);
|
/// Provides extension methods for common mapping and conversion operations.
|
||||||
}
|
/// </summary>
|
||||||
|
public static class MappingExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the response indicates a successful "OK" message status.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gtxMessagingResponse">The response object to evaluate.</param>
|
||||||
|
/// <returns><see langword="true"/> if the response contains a "message-status" key with a value of "ok" (case-insensitive);
|
||||||
|
/// otherwise, <see langword="false"/>.</returns>
|
||||||
|
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
|
||||||
|
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
|
||||||
|
&& status?.ToString()?.ToLower() == "ok";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the specified byte array to its equivalent string representation encoded in base-64.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">The byte array to encode.</param>
|
||||||
|
/// <returns>A base-64 encoded string representation of the input byte array.</returns>
|
||||||
|
public static string ToBase64String(this byte[] bytes)
|
||||||
|
=> Convert.ToBase64String(bytes);
|
||||||
}
|
}
|
||||||
@ -10,6 +10,7 @@ namespace EnvelopeGenerator.Application.Histories.Queries.Read;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumerable<ReadHistoryResponse>>
|
public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumerable<ReadHistoryResponse>>
|
||||||
{
|
{
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
private readonly IEnvelopeHistoryRepository _repository;
|
private readonly IEnvelopeHistoryRepository _repository;
|
||||||
|
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
@ -19,6 +20,7 @@ public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="repository"></param>
|
/// <param name="repository"></param>
|
||||||
/// <param name="mapper"></param>
|
/// <param name="mapper"></param>
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public ReadHistoryQueryHandler(IEnvelopeHistoryRepository repository, IMapper mapper)
|
public ReadHistoryQueryHandler(IEnvelopeHistoryRepository repository, IMapper mapper)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class ReadHistoryResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the reference identifier of the user who performed the action.
|
/// Gets or sets the reference identifier of the user who performed the action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UserReference { get; set; }
|
public required string UserReference { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the status code of the envelope.
|
/// Gets or sets the status code of the envelope.
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
using DigitalData.Core.Application;
|
|
||||||
using EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Services;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Use MediatR")]
|
|
||||||
public class UserReceiverService : BasicCRUDService<IUserReceiverRepository, UserReceiverDto, UserReceiver, int>, IUserReceiverService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="repository"></param>
|
|
||||||
/// <param name="mapper"></param>
|
|
||||||
public UserReceiverService(IUserReceiverRepository repository, IMapper mapper)
|
|
||||||
: base(repository, mapper)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,14 +6,12 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
[Table("TBSIG_CONFIG", Schema = "dbo")]
|
[Table("TBSIG_CONFIG", Schema = "dbo")]
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
[Column("DOCUMENT_PATH", TypeName = "nvarchar(256)")]
|
|
||||||
public string DocumentPath { get; set; }
|
|
||||||
|
|
||||||
[Column("SENDING_PROFILE", TypeName = "int")]
|
[Column("SENDING_PROFILE", TypeName = "int")]
|
||||||
[Required]
|
[Required]
|
||||||
public int SendingProfile { get; set; }
|
public int SendingProfile { get; set; }
|
||||||
|
|
||||||
[Column("SIGNATURE_HOST", TypeName = "nvarchar(128)")]
|
[Column("SIGNATURE_HOST", TypeName = "nvarchar(128)")]
|
||||||
|
[Required]
|
||||||
public string SignatureHost { get; set; }
|
public string SignatureHost { get; set; }
|
||||||
|
|
||||||
[Column("EXTERNAL_PROGRAM_NAME", TypeName = "nvarchar(30)")]
|
[Column("EXTERNAL_PROGRAM_NAME", TypeName = "nvarchar(30)")]
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
#if NETFRAMEWORK
|
|
||||||
using System;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain.Entities
|
|
||||||
{
|
|
||||||
[Table("TBSIG_USER_RECEIVER", Schema = "dbo")]
|
|
||||||
public class UserReceiver
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
[Column("GUID")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("USER_ID")]
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("RECEIVER_ID")]
|
|
||||||
public int ReceiverId { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("NAME", TypeName = "nvarchar(128)")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
|
|
||||||
public string CompanyName { get; set; }
|
|
||||||
|
|
||||||
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
|
|
||||||
public string JobTitle { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
|
||||||
public DateTime AddedWhen { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -16,6 +16,7 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers;
|
|||||||
public partial class AuthController : ControllerBase
|
public partial class AuthController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILogger<AuthController> _logger;
|
private readonly ILogger<AuthController> _logger;
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IDirectorySearchService _dirSearchService;
|
private readonly IDirectorySearchService _dirSearchService;
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ public partial class AuthController : ControllerBase
|
|||||||
/// <param name="logger">The logger instance.</param>
|
/// <param name="logger">The logger instance.</param>
|
||||||
/// <param name="userService">The user service instance.</param>
|
/// <param name="userService">The user service instance.</param>
|
||||||
/// <param name="dirSearchService">The directory search service instance.</param>
|
/// <param name="dirSearchService">The directory search service instance.</param>
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
public AuthController(ILogger<AuthController> logger, IUserService userService, IDirectorySearchService dirSearchService)
|
public AuthController(ILogger<AuthController> logger, IUserService userService, IDirectorySearchService dirSearchService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@ -27,6 +27,7 @@ public class EmailTemplateController : ControllerBase
|
|||||||
|
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
private readonly IEmailTemplateRepository _repository;
|
private readonly IEmailTemplateRepository _repository;
|
||||||
|
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
@ -38,6 +39,7 @@ public class EmailTemplateController : ControllerBase
|
|||||||
/// <param name="repository">
|
/// <param name="repository">
|
||||||
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public EmailTemplateController(IMapper mapper, IEmailTemplateRepository repository, ILogger<EmailTemplateController> logger, IMediator mediator)
|
public EmailTemplateController(IMapper mapper, IEmailTemplateRepository repository, ILogger<EmailTemplateController> logger, IMediator mediator)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
|
|||||||
@ -93,7 +93,7 @@ try
|
|||||||
Id = "Bearer"
|
Id = "Bearer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new string[] {}
|
Array.Empty<string>()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ try
|
|||||||
{
|
{
|
||||||
var clientParams = deferredProvider.GetOptions<ClientParams>();
|
var clientParams = deferredProvider.GetOptions<ClientParams>();
|
||||||
var publicKey = clientParams!.PublicKeys.Get(authTokenKeys.Issuer, authTokenKeys.Audience);
|
var publicKey = clientParams!.PublicKeys.Get(authTokenKeys.Issuer, authTokenKeys.Audience);
|
||||||
return new List<SecurityKey>() { publicKey.SecurityKey };
|
return [publicKey.SecurityKey];
|
||||||
},
|
},
|
||||||
ValidateIssuer = true,
|
ValidateIssuer = true,
|
||||||
ValidIssuer = authTokenKeys.Issuer,
|
ValidIssuer = authTokenKeys.Issuer,
|
||||||
@ -167,7 +167,9 @@ try
|
|||||||
});
|
});
|
||||||
|
|
||||||
// User manager
|
// User manager
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddUserManager<EGDbContext>();
|
builder.Services.AddUserManager<EGDbContext>();
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
// LDAP
|
// LDAP
|
||||||
builder.ConfigureBySection<DirectorySearchOptions>();
|
builder.ConfigureBySection<DirectorySearchOptions>();
|
||||||
@ -177,9 +179,11 @@ try
|
|||||||
builder.Services.AddCookieBasedLocalizer();
|
builder.Services.AddCookieBasedLocalizer();
|
||||||
|
|
||||||
// Envelope generator serives
|
// Envelope generator serives
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services
|
builder.Services
|
||||||
.AddEnvelopeGeneratorInfrastructureServices(sqlExecutorConfigureOptions: executor => executor.ConnectionString = connStr)
|
.AddEnvelopeGeneratorInfrastructureServices(sqlExecutorConfigureOptions: executor => executor.ConnectionString = connStr)
|
||||||
.AddEnvelopeGeneratorServices(config);
|
.AddEnvelopeGeneratorServices(config);
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@ -201,10 +205,10 @@ try
|
|||||||
app.UseCors("AllowSpecificOriginsPolicy");
|
app.UseCors("AllowSpecificOriginsPolicy");
|
||||||
|
|
||||||
// Localizer
|
// Localizer
|
||||||
string[] supportedCultureNames = { "de-DE", "en-US" };
|
string[] supportedCultureNames = ["de-DE", "en-US"];
|
||||||
IList<CultureInfo> list = supportedCultureNames.Select((string cn) => new CultureInfo(cn)).ToList();
|
IList<CultureInfo> list = [.. supportedCultureNames.Select(cn => new CultureInfo(cn))];
|
||||||
CultureInfo cultureInfo = list.FirstOrDefault() ?? throw new ArgumentNullException("supportedCultureNames", "Supported cultures cannot be empty.");
|
var cultureInfo = list.FirstOrDefault() ?? throw new InvalidOperationException("There is no supported culture.");
|
||||||
RequestLocalizationOptions requestLocalizationOptions = new RequestLocalizationOptions
|
var requestLocalizationOptions = new RequestLocalizationOptions
|
||||||
{
|
{
|
||||||
SupportedCultures = list,
|
SupportedCultures = list,
|
||||||
SupportedUICultures = list
|
SupportedUICultures = list
|
||||||
|
|||||||
@ -53,7 +53,6 @@ public static class DIExtensions
|
|||||||
services.TryAddScoped<IEnvelopeReceiverRepository, EnvelopeReceiverRepository>();
|
services.TryAddScoped<IEnvelopeReceiverRepository, EnvelopeReceiverRepository>();
|
||||||
services.TryAddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
services.TryAddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
||||||
services.TryAddScoped<IReceiverRepository, ReceiverRepository>();
|
services.TryAddScoped<IReceiverRepository, ReceiverRepository>();
|
||||||
services.TryAddScoped<IUserReceiverRepository, UserReceiverRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
services.TryAddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
||||||
|
|
||||||
services.AddDbRepository<EGDbContext, Config>(context => context.Configs).UseAutoMapper();
|
services.AddDbRepository<EGDbContext, Config>(context => context.Configs).UseAutoMapper();
|
||||||
@ -67,7 +66,6 @@ public static class DIExtensions
|
|||||||
services.AddDbRepository<EGDbContext, EnvelopeReceiver>(context => context.EnvelopeReceivers).UseAutoMapper();
|
services.AddDbRepository<EGDbContext, EnvelopeReceiver>(context => context.EnvelopeReceivers).UseAutoMapper();
|
||||||
services.AddDbRepository<EGDbContext, EnvelopeType>(context => context.EnvelopeTypes).UseAutoMapper();
|
services.AddDbRepository<EGDbContext, EnvelopeType>(context => context.EnvelopeTypes).UseAutoMapper();
|
||||||
services.AddDbRepository<EGDbContext, Receiver>(context => context.Receivers).UseAutoMapper();
|
services.AddDbRepository<EGDbContext, Receiver>(context => context.Receivers).UseAutoMapper();
|
||||||
services.AddDbRepository<EGDbContext, UserReceiver>(context => context.UserReceivers).UseAutoMapper();
|
|
||||||
services.AddDbRepository<EGDbContext, EnvelopeReceiverReadOnly>(context => context.EnvelopeReceiverReadOnlys).UseAutoMapper();
|
services.AddDbRepository<EGDbContext, EnvelopeReceiverReadOnly>(context => context.EnvelopeReceiverReadOnlys).UseAutoMapper();
|
||||||
|
|
||||||
services.AddSQLExecutor<Envelope>();
|
services.AddSQLExecutor<Envelope>();
|
||||||
|
|||||||
@ -17,8 +17,6 @@ namespace EnvelopeGenerator.Infrastructure;
|
|||||||
//TODO: Adding EmailOut instead of EmailOut.Abst is not correct for the arch. Re-design EmailPut consedering this. IMailDbContext shoud move to Abstraction layer (hint: in this case using DBSet in abst. will be problem because entity framework will have to be added.
|
//TODO: Adding EmailOut instead of EmailOut.Abst is not correct for the arch. Re-design EmailPut consedering this. IMailDbContext shoud move to Abstraction layer (hint: in this case using DBSet in abst. will be problem because entity framework will have to be added.
|
||||||
public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||||
{
|
{
|
||||||
public DbSet<UserReceiver> UserReceivers { get; set; }
|
|
||||||
|
|
||||||
public DbSet<Config> Configs { get; set; }
|
public DbSet<Config> Configs { get; set; }
|
||||||
|
|
||||||
public DbSet<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
public DbSet<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
||||||
@ -68,7 +66,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
|||||||
_triggers = triggerParamOptions.Value;
|
_triggers = triggerParamOptions.Value;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
UserReceivers = Set<UserReceiver>();
|
|
||||||
Configs = Set<Config>();
|
Configs = Set<Config>();
|
||||||
EnvelopeReceivers = Set<EnvelopeReceiver>();
|
EnvelopeReceivers = Set<EnvelopeReceiver>();
|
||||||
Envelopes = Set<Envelope>();
|
Envelopes = Set<Envelope>();
|
||||||
@ -106,7 +103,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
|||||||
modelBuilder.Entity<EnvelopeHistory>();
|
modelBuilder.Entity<EnvelopeHistory>();
|
||||||
modelBuilder.Entity<EnvelopeType>();
|
modelBuilder.Entity<EnvelopeType>();
|
||||||
modelBuilder.Entity<Receiver>();
|
modelBuilder.Entity<Receiver>();
|
||||||
modelBuilder.Entity<UserReceiver>();
|
|
||||||
modelBuilder.Entity<EmailOut>();
|
modelBuilder.Entity<EmailOut>();
|
||||||
|
|
||||||
// Configure the one-to-many relationship of Envelope
|
// Configure the one-to-many relationship of Envelope
|
||||||
@ -171,7 +167,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
|||||||
AddTrigger<EnvelopeReceiverReadOnly>();
|
AddTrigger<EnvelopeReceiverReadOnly>();
|
||||||
AddTrigger<EnvelopeType>();
|
AddTrigger<EnvelopeType>();
|
||||||
AddTrigger<Receiver>();
|
AddTrigger<Receiver>();
|
||||||
AddTrigger<UserReceiver>();
|
|
||||||
AddTrigger<EmailOut>();
|
AddTrigger<EmailOut>();
|
||||||
|
|
||||||
//configure model builder for user manager tables
|
//configure model builder for user manager tables
|
||||||
|
|||||||
@ -12,13 +12,16 @@ namespace EnvelopeGenerator.Infrastructure.Executor;
|
|||||||
|
|
||||||
public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
|
public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
|
||||||
{
|
{
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
private readonly IUserRepository _userRepository;
|
private readonly IUserRepository _userRepository;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public EnvelopeExecutor(IServiceProvider provider, IOptions<SQLExecutorParams> sqlExecutorParamsOptions, IUserRepository userRepository) : base(provider, sqlExecutorParamsOptions)
|
public EnvelopeExecutor(IServiceProvider provider, IOptions<SQLExecutorParams> sqlExecutorParamsOptions, IUserRepository userRepository) : base(provider, sqlExecutorParamsOptions)
|
||||||
{
|
{
|
||||||
_userRepository = userRepository;
|
_userRepository = userRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public async Task<Envelope> CreateEnvelopeAsync(int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default)
|
public async Task<Envelope> CreateEnvelopeAsync(int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default)
|
||||||
{
|
{
|
||||||
using var connection = new SqlConnection(Params.ConnectionString);
|
using var connection = new SqlConnection(Params.ConnectionString);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class ConfigRepository : CRUDRepository<Config, int, EGDbContext>, IConfigRepository
|
public class ConfigRepository : CRUDRepository<Config, int, EGDbContext>, IConfigRepository
|
||||||
{
|
{
|
||||||
public ConfigRepository(EGDbContext dbContext) : base(dbContext, dbContext.Configs)
|
public ConfigRepository(EGDbContext dbContext) : base(dbContext, dbContext.Configs)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class DocumentReceiverElementRepository : CRUDRepository<DocumentReceiverElement, int, EGDbContext>, IDocumentReceiverElementRepository
|
public class DocumentReceiverElementRepository : CRUDRepository<DocumentReceiverElement, int, EGDbContext>, IDocumentReceiverElementRepository
|
||||||
{
|
{
|
||||||
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
|
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class DocumentStatusRepository : CRUDRepository<DocumentStatus, int, EGDbContext>, IDocumentStatusRepository
|
public class DocumentStatusRepository : CRUDRepository<DocumentStatus, int, EGDbContext>, IDocumentStatusRepository
|
||||||
{
|
{
|
||||||
public DocumentStatusRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentStatus)
|
public DocumentStatusRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentStatus)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class EnvelopeCertificateRepository : CRUDRepository<EnvelopeCertificate, int, EGDbContext>, IEnvelopeCertificateRepository
|
public class EnvelopeCertificateRepository : CRUDRepository<EnvelopeCertificate, int, EGDbContext>, IEnvelopeCertificateRepository
|
||||||
{
|
{
|
||||||
public EnvelopeCertificateRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeCertificates)
|
public EnvelopeCertificateRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeCertificates)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class EnvelopeDocumentRepository : CRUDRepository<EnvelopeDocument, int, EGDbContext>, IEnvelopeDocumentRepository
|
public class EnvelopeDocumentRepository : CRUDRepository<EnvelopeDocument, int, EGDbContext>, IEnvelopeDocumentRepository
|
||||||
{
|
{
|
||||||
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
|
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceiverReadOnly, long, EGDbContext>, IEnvelopeReceiverReadOnlyRepository
|
public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceiverReadOnly, long, EGDbContext>, IEnvelopeReceiverReadOnlyRepository
|
||||||
{
|
{
|
||||||
private readonly IEnvelopeRepository _envRepo;
|
private readonly IEnvelopeRepository _envRepo;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class EnvelopeRepository : CRUDRepository<Envelope, int, EGDbContext>, IEnvelopeRepository
|
public class EnvelopeRepository : CRUDRepository<Envelope, int, EGDbContext>, IEnvelopeRepository
|
||||||
{
|
{
|
||||||
public EnvelopeRepository(EGDbContext dbContext) : base(dbContext, dbContext.Envelopes)
|
public EnvelopeRepository(EGDbContext dbContext) : base(dbContext, dbContext.Envelopes)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbContext>, IEnvelopeTypeRepository
|
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbContext>, IEnvelopeTypeRepository
|
||||||
{
|
{
|
||||||
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||||
|
|
||||||
|
[Obsolete("Use IRepository")]
|
||||||
public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IReceiverRepository
|
public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IReceiverRepository
|
||||||
{
|
{
|
||||||
public ReceiverRepository(EGDbContext dbContext) : base(dbContext, dbContext.Receivers)
|
public ReceiverRepository(EGDbContext dbContext) : base(dbContext, dbContext.Receivers)
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
|
||||||
|
|
||||||
public class UserReceiverRepository : CRUDRepository<UserReceiver, int, EGDbContext>, IUserReceiverRepository
|
|
||||||
{
|
|
||||||
public UserReceiverRepository(EGDbContext dbContext) : base(dbContext, dbContext.UserReceivers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,9 +13,11 @@ public class CommandManager
|
|||||||
{
|
{
|
||||||
WriteIndented = true
|
WriteIndented = true
|
||||||
};
|
};
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
private readonly IEnvelopeReceiverService _envelopeReceiverService;
|
private readonly IEnvelopeReceiverService _envelopeReceiverService;
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
public CommandManager(IEnvelopeReceiverService envelopeReceiverService, IMediator mediator)
|
public CommandManager(IEnvelopeReceiverService envelopeReceiverService, IMediator mediator)
|
||||||
{
|
{
|
||||||
_envelopeReceiverService = envelopeReceiverService;
|
_envelopeReceiverService = envelopeReceiverService;
|
||||||
@ -29,6 +31,7 @@ public class CommandManager
|
|||||||
Console.WriteLine($"v{Assembly.GetExecutingAssembly().GetName().Version}");
|
Console.WriteLine($"v{Assembly.GetExecutingAssembly().GetName().Version}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
[Subcommand]
|
[Subcommand]
|
||||||
public IEnvelopeReceiverService EnvelopeReceiver => _envelopeReceiverService;
|
public IEnvelopeReceiverService EnvelopeReceiver => _envelopeReceiverService;
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public static class DependencyInjection
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add envelope generator services
|
// Add envelope generator services
|
||||||
services.AddEnvelopeGeneratorInfrastructureServices(options => options.UseSqlServer(connStr));
|
services.AddEnvelopeGeneratorInfrastructureServices((provider, options) => options.UseSqlServer(connStr));
|
||||||
|
|
||||||
return services
|
return services
|
||||||
.AddSingleton<CommandManager>()
|
.AddSingleton<CommandManager>()
|
||||||
|
|||||||
@ -15,7 +15,9 @@ public class Program
|
|||||||
|
|
||||||
var config = builder.Configuration;
|
var config = builder.Configuration;
|
||||||
|
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddCommandManagerRunner(config);
|
builder.Services.AddCommandManagerRunner(config);
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ public class DocumentController : BaseController
|
|||||||
_envDocService = envDocService;
|
_envDocService = envDocService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
||||||
{
|
{
|
||||||
@ -53,6 +54,7 @@ public class DocumentController : BaseController
|
|||||||
|
|
||||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost("{envelopeKey}")]
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> Open(string envelopeKey)
|
public async Task<IActionResult> Open(string envelopeKey)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -171,6 +171,7 @@ public class HomeController : ViewControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
private async Task<IActionResult> CreateShowEnvelopeView(string envelopeReceiverId, EnvelopeReceiverDto er)
|
private async Task<IActionResult> CreateShowEnvelopeView(string envelopeReceiverId, EnvelopeReceiverDto er)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -259,6 +260,7 @@ public class HomeController : ViewControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
[NonAction]
|
[NonAction]
|
||||||
private async Task<IActionResult?> HandleAccessCodeAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
private async Task<IActionResult?> HandleAccessCodeAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
@ -331,6 +333,7 @@ public class HomeController : ViewControllerBase
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[HttpPost("EnvelopeKey/{envelopeReceiverId}/Locked")]
|
[HttpPost("EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> LogInEnvelope([FromRoute] string envelopeReceiverId, [FromForm] Auth auth)
|
public async Task<IActionResult> LogInEnvelope([FromRoute] string envelopeReceiverId, [FromForm] Auth auth)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -3,13 +3,13 @@ using EnvelopeGenerator.Domain.Entities;
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
using EnvelopeGenerator.Application.Contracts.Services;
|
using EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||||
{
|
|
||||||
public class TestConfigController : ReadControllerBase<IConfigService, ConfigDto, Config, int>
|
[Obsolete("Use MediatR")]
|
||||||
{
|
public class TestConfigController : ReadControllerBase<IConfigService, ConfigDto, Config, int>
|
||||||
public TestConfigController(ILogger<TestConfigController> logger, IConfigService service) : base(logger, service)
|
{
|
||||||
{
|
public TestConfigController(ILogger<TestConfigController> logger, IConfigService service) : base(logger, service)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Domain.Entities;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
public class TestDocumentReceiverElementController : TestControllerBase<IDocumentReceiverElementService, DocumentReceiverElementDto, DocumentReceiverElement, int>
|
public class TestDocumentReceiverElementController : TestControllerBase<IDocumentReceiverElementService, DocumentReceiverElementDto, DocumentReceiverElement, int>
|
||||||
{
|
{
|
||||||
public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service)
|
public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service)
|
||||||
|
|||||||
@ -4,53 +4,53 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using EnvelopeGenerator.Extensions;
|
using EnvelopeGenerator.Extensions;
|
||||||
using EnvelopeGenerator.Application.Contracts.Services;
|
using EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||||
|
|
||||||
|
[Obsolete("Use MediatR")]
|
||||||
|
public class TestEnvelopeController : TestControllerBase<IEnvelopeService, EnvelopeDto, Envelope, int>
|
||||||
{
|
{
|
||||||
public class TestEnvelopeController : TestControllerBase<IEnvelopeService, EnvelopeDto, Envelope, int>
|
public TestEnvelopeController(ILogger<TestEnvelopeController> logger, IEnvelopeService service) : base(logger, service)
|
||||||
{
|
{
|
||||||
public TestEnvelopeController(ILogger<TestEnvelopeController> logger, IEnvelopeService service) : base(logger, service)
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override Task<IActionResult> GetAll() => base.GetAll();
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetAll([FromQuery] string? envelopeKey = default, [FromQuery] bool withDocuments = false, [FromQuery] bool withHistory = false, [FromQuery] bool withDocumentReceiverElement = false, [FromQuery] bool withUser = false, [FromQuery] bool withAll = true)
|
||||||
|
{
|
||||||
|
if (envelopeKey is not null)
|
||||||
{
|
{
|
||||||
|
(var uuid, var signature) = envelopeKey.DecodeEnvelopeReceiverId();
|
||||||
|
if (uuid is null)
|
||||||
|
return BadRequest("UUID is null");
|
||||||
|
var envlopeServiceResult = await _service.ReadByUuidAsync(
|
||||||
|
uuid: uuid,
|
||||||
|
withDocuments: withDocuments, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement, withUser: withUser, withAll: withAll);
|
||||||
|
|
||||||
|
if (envlopeServiceResult.IsSuccess)
|
||||||
|
{
|
||||||
|
return Ok(envlopeServiceResult.Data);
|
||||||
|
}
|
||||||
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
var result = await _service.ReadAllWithAsync(documents: withDocuments, history: withHistory);
|
||||||
public override Task<IActionResult> GetAll() => base.GetAll();
|
if (result.IsSuccess)
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<IActionResult> GetAll([FromQuery] string? envelopeKey = default, [FromQuery] bool withDocuments = false, [FromQuery] bool withHistory = false, [FromQuery] bool withDocumentReceiverElement = false, [FromQuery] bool withUser = false, [FromQuery] bool withAll = true)
|
|
||||||
{
|
{
|
||||||
if(envelopeKey is not null)
|
return Ok(result);
|
||||||
{
|
|
||||||
(var uuid, var signature) = envelopeKey.DecodeEnvelopeReceiverId();
|
|
||||||
if (uuid is null)
|
|
||||||
return BadRequest("UUID is null");
|
|
||||||
var envlopeServiceResult = await _service.ReadByUuidAsync(
|
|
||||||
uuid: uuid,
|
|
||||||
withDocuments: withDocuments, withHistory: withHistory, withDocumentReceiverElement:withDocumentReceiverElement, withUser:withUser, withAll:withAll);
|
|
||||||
|
|
||||||
if (envlopeServiceResult.IsSuccess)
|
|
||||||
{
|
|
||||||
return Ok(envlopeServiceResult.Data);
|
|
||||||
}
|
|
||||||
return NotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = await _service.ReadAllWithAsync(documents: withDocuments, history: withHistory);
|
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
return NotFound(result);
|
|
||||||
}
|
}
|
||||||
|
return NotFound(result);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("decode")]
|
[HttpGet("decode")]
|
||||||
public IActionResult DecodeEnvelopeReceiverId(string envelopeReceiverId, int type = 0)
|
public IActionResult DecodeEnvelopeReceiverId(string envelopeReceiverId, int type = 0)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
{
|
{
|
||||||
return type switch
|
1 => Ok(envelopeReceiverId.GetEnvelopeUuid()),
|
||||||
{
|
2 => Ok(envelopeReceiverId.GetReceiverSignature()),
|
||||||
1 => Ok(envelopeReceiverId.GetEnvelopeUuid()),
|
_ => Ok(envelopeReceiverId.DecodeEnvelopeReceiverId()),
|
||||||
2 => Ok(envelopeReceiverId.GetReceiverSignature()),
|
};
|
||||||
_ => Ok(envelopeReceiverId.DecodeEnvelopeReceiverId()),
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -3,13 +3,13 @@ using EnvelopeGenerator.Application.Contracts.Services;
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||||
{
|
|
||||||
public class TestReceiverController : CRUDControllerBase<IReceiverService, ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, Receiver, int>
|
[Obsolete("Use MediatR")]
|
||||||
{
|
public class TestReceiverController : CRUDControllerBase<IReceiverService, ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, Receiver, int>
|
||||||
public TestReceiverController(ILogger<TestReceiverController> logger, IReceiverService service) : base(logger, service)
|
{
|
||||||
{
|
public TestReceiverController(ILogger<TestReceiverController> logger, IReceiverService service) : base(logger, service)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,36 +2,34 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/test/[controller]")]
|
||||||
|
public class TestSanitizeController : ControllerBase
|
||||||
{
|
{
|
||||||
[ApiController]
|
private readonly HtmlEncoder _htmlEncoder;
|
||||||
[Route("api/test/[controller]")]
|
private readonly HtmlSanitizer _sanitizer;
|
||||||
public class TestSanitizeController : ControllerBase
|
|
||||||
|
public TestSanitizeController(HtmlEncoder htmlEncoder, HtmlSanitizer sanitizer)
|
||||||
{
|
{
|
||||||
private readonly HtmlEncoder _htmlEncoder;
|
_htmlEncoder = htmlEncoder;
|
||||||
private readonly HtmlSanitizer _sanitizer;
|
_sanitizer = sanitizer;
|
||||||
|
|
||||||
public TestSanitizeController(HtmlEncoder htmlEncoder, HtmlSanitizer sanitizer)
|
|
||||||
{
|
|
||||||
_htmlEncoder = htmlEncoder;
|
|
||||||
_sanitizer = sanitizer;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("sanitize")]
|
|
||||||
public IActionResult Sanitize([FromQuery] string? input = null) => Ok(new
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
Sanitized = _sanitizer.Sanitize(input),
|
|
||||||
SanitizedDocument = _sanitizer.SanitizeDocument(input),
|
|
||||||
SanitizedDom = _sanitizer.SanitizeDom(input)
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("encode")]
|
|
||||||
public IActionResult Encoder([FromQuery] string? input = null) => Ok(new
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
Encoded = _htmlEncoder.Encode(input)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("sanitize")]
|
||||||
|
public IActionResult Sanitize([FromQuery] string input) => Ok(new
|
||||||
|
{
|
||||||
|
input,
|
||||||
|
Sanitized = _sanitizer.Sanitize(input),
|
||||||
|
SanitizedDocument = _sanitizer.SanitizeDocument(input),
|
||||||
|
SanitizedDom = _sanitizer.SanitizeDom(input)
|
||||||
|
});
|
||||||
|
|
||||||
|
[HttpGet("encode")]
|
||||||
|
public IActionResult Encoder([FromQuery] string input) => Ok(new
|
||||||
|
{
|
||||||
|
input,
|
||||||
|
Encoded = _htmlEncoder.Encode(input)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
using EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
|
||||||
|
|
||||||
[Obsolete("Use MediatR")]
|
|
||||||
public class TestUserReceiverController : TestControllerBase< IUserReceiverService, UserReceiverDto, UserReceiver, int>
|
|
||||||
{
|
|
||||||
public TestUserReceiverController(ILogger<TestUserReceiverController> logger, IUserReceiverService service) : base(logger, service)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -98,6 +98,7 @@ try
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add envelope generator services
|
// Add envelope generator services
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddEnvelopeGeneratorInfrastructureServices((provider, options) =>
|
builder.Services.AddEnvelopeGeneratorInfrastructureServices((provider, options) =>
|
||||||
{
|
{
|
||||||
var logger = provider.GetRequiredService<ILogger<EGDbContext>>();
|
var logger = provider.GetRequiredService<ILogger<EGDbContext>>();
|
||||||
@ -106,8 +107,11 @@ try
|
|||||||
.EnableSensitiveDataLogging()
|
.EnableSensitiveDataLogging()
|
||||||
.EnableDetailedErrors();
|
.EnableDetailedErrors();
|
||||||
});
|
});
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddEnvelopeGeneratorServices(config);
|
builder.Services.AddEnvelopeGeneratorServices(config);
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
builder.Services.Configure<CookiePolicyOptions>(options =>
|
builder.Services.Configure<CookiePolicyOptions>(options =>
|
||||||
{
|
{
|
||||||
@ -174,7 +178,10 @@ try
|
|||||||
builder.Services.AddSingleton(sp => sp.GetRequiredService<IOptions<Cultures>>().Value);
|
builder.Services.AddSingleton(sp => sp.GetRequiredService<IOptions<Cultures>>().Value);
|
||||||
|
|
||||||
// Register mail services
|
// Register mail services
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddScoped<IEnvelopeMailService, EnvelopeMailService>();
|
builder.Services.AddScoped<IEnvelopeMailService, EnvelopeMailService>();
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
builder.Services.AddDispatcher<EGDbContext>();
|
builder.Services.AddDispatcher<EGDbContext>();
|
||||||
|
|
||||||
builder.Services.AddMemoryCache();
|
builder.Services.AddMemoryCache();
|
||||||
@ -183,7 +190,9 @@ try
|
|||||||
|
|
||||||
builder.ConfigureBySection<AnnotationParams>();
|
builder.ConfigureBySection<AnnotationParams>();
|
||||||
|
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
builder.Services.AddUserManager<EGDbContext>();
|
builder.Services.AddUserManager<EGDbContext>();
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user