Merge branch 'refactor/split-common'
This commit is contained in:
commit
408b1e9f0d
@ -7,7 +7,7 @@ namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -6,6 +6,7 @@ namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
|
||||
{
|
||||
/// <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 EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
@ -27,12 +26,4 @@ public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverRead
|
||||
/// <param name="signature"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
|
||||
//TODO: move to DigitalData.Core
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface ISmsSender
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string ServiceProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="recipient"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
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)]
|
||||
public class ConfigDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the document.
|
||||
/// </summary>
|
||||
public string? DocumentPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sending profile identifier.
|
||||
/// </summary>
|
||||
@ -21,7 +16,7 @@ public class ConfigDto
|
||||
/// <summary>
|
||||
/// Gets or sets the signature host URL or name.
|
||||
/// </summary>
|
||||
public string? SignatureHost { get; set; }
|
||||
public required string SignatureHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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, ReceiverCreateDto>();
|
||||
CreateMap<Domain.Entities.Receiver, ReceiverUpdateDto>();
|
||||
CreateMap<UserReceiver, UserReceiverDto>();
|
||||
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
||||
|
||||
// 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<ReceiverCreateDto, Domain.Entities.Receiver>();
|
||||
CreateMap<ReceiverUpdateDto, Domain.Entities.Receiver>();
|
||||
CreateMap<UserReceiverDto, UserReceiver>();
|
||||
CreateMap<EnvelopeReceiverBase, EnvelopeReceiverBasicDto>();
|
||||
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||
|
||||
@ -18,7 +18,7 @@ public record ReceiverCreateDto
|
||||
{
|
||||
_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 hexa_str = BitConverter.ToString(hash_arr);
|
||||
return hexa_str.Replace("-", string.Empty);
|
||||
@ -37,7 +37,7 @@ public record ReceiverCreateDto
|
||||
public string? TotpSecretkey { get; init; }
|
||||
|
||||
/// <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 hexa_str = BitConverter.ToString(hash_arr);
|
||||
/// return hexa_str.Replace("-", string.Empty);
|
||||
|
||||
@ -4,26 +4,57 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class ReceiverReadDto
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string? TotpSecretkey { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime? TfaRegDeadline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int 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>
|
||||
/// 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>
|
||||
/// 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
|
||||
{
|
||||
/// <summary>
|
||||
@ -34,7 +33,7 @@ public record ResetEmailTemplateCommand : EmailTemplateQuery, IRequest
|
||||
///
|
||||
/// </summary>
|
||||
/// <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)
|
||||
{
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
private readonly IEmailTemplateRepository _repository;
|
||||
|
||||
/// <summary>
|
||||
@ -21,6 +22,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
||||
/// <param name="repository">
|
||||
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
||||
/// </param>
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
public ReadEmailTemplateQueryHandler(IMapper mapper, IEmailTemplateRepository repository)
|
||||
{
|
||||
_mapper = mapper;
|
||||
@ -34,6 +36,7 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
[Obsolete("Use IRepository")]
|
||||
public async Task<ReadEmailTemplateResponse?> Handle(ReadEmailTemplateQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var temp = request.Id is int id
|
||||
|
||||
@ -18,4 +18,4 @@ public record CreateEnvelopeReceiverCommand(
|
||||
[Required] DocumentCreateCommand Document,
|
||||
[Required] IEnumerable<ReceiverGetOrCreateCommand> Receivers,
|
||||
bool TFAEnabled = false
|
||||
) : CreateEnvelopeCommand(Title, Message, TFAEnabled), IRequest<CreateEnvelopeReceiverResponse?>;
|
||||
) : CreateEnvelopeCommand(Title, Message, TFAEnabled), IRequest<CreateEnvelopeReceiverResponse>;
|
||||
@ -1,32 +1,83 @@
|
||||
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)
|
||||
{
|
||||
var value = await cache.GetAsync(key, cToken);
|
||||
return value is null ? null : 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 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);
|
||||
@ -37,6 +88,17 @@ namespace EnvelopeGenerator.Application.Extensions
|
||||
#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);
|
||||
@ -58,6 +120,16 @@ namespace EnvelopeGenerator.Application.Extensions
|
||||
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);
|
||||
@ -81,6 +153,16 @@ namespace EnvelopeGenerator.Application.Extensions
|
||||
#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)
|
||||
@ -103,6 +185,16 @@ namespace EnvelopeGenerator.Application.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
/// <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)
|
||||
@ -127,5 +219,4 @@ namespace EnvelopeGenerator.Application.Extensions
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,27 @@
|
||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Extensions
|
||||
namespace EnvelopeGenerator.Application.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides extension methods for common mapping and conversion operations.
|
||||
/// </summary>
|
||||
public static class MappingExtensions
|
||||
{
|
||||
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>
|
||||
public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumerable<ReadHistoryResponse>>
|
||||
{
|
||||
[Obsolete("Use IRepository")]
|
||||
private readonly IEnvelopeHistoryRepository _repository;
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
@ -19,6 +20,7 @@ public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumer
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="mapper"></param>
|
||||
[Obsolete("Use IRepository")]
|
||||
public ReadHistoryQueryHandler(IEnvelopeHistoryRepository repository, IMapper mapper)
|
||||
{
|
||||
_repository = repository;
|
||||
|
||||
@ -20,7 +20,7 @@ public class ReadHistoryResponse
|
||||
/// <summary>
|
||||
/// Gets or sets the reference identifier of the user who performed the action.
|
||||
/// </summary>
|
||||
public string UserReference { get; set; }
|
||||
public required string UserReference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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")]
|
||||
public class Config
|
||||
{
|
||||
[Column("DOCUMENT_PATH", TypeName = "nvarchar(256)")]
|
||||
public string DocumentPath { get; set; }
|
||||
|
||||
[Column("SENDING_PROFILE", TypeName = "int")]
|
||||
[Required]
|
||||
public int SendingProfile { get; set; }
|
||||
|
||||
[Column("SIGNATURE_HOST", TypeName = "nvarchar(128)")]
|
||||
[Required]
|
||||
public string SignatureHost { get; set; }
|
||||
|
||||
[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
|
||||
{
|
||||
private readonly ILogger<AuthController> _logger;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IUserService _userService;
|
||||
private readonly IDirectorySearchService _dirSearchService;
|
||||
|
||||
@ -25,6 +26,7 @@ public partial class AuthController : ControllerBase
|
||||
/// <param name="logger">The logger instance.</param>
|
||||
/// <param name="userService">The user service instance.</param>
|
||||
/// <param name="dirSearchService">The directory search service instance.</param>
|
||||
[Obsolete("Use MediatR")]
|
||||
public AuthController(ILogger<AuthController> logger, IUserService userService, IDirectorySearchService dirSearchService)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
@ -27,6 +27,7 @@ public class EmailTemplateController : ControllerBase
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
private readonly IEmailTemplateRepository _repository;
|
||||
|
||||
private readonly IMediator _mediator;
|
||||
@ -38,6 +39,7 @@ public class EmailTemplateController : ControllerBase
|
||||
/// <param name="repository">
|
||||
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
||||
/// </param>
|
||||
[Obsolete("Use IRepository")]
|
||||
public EmailTemplateController(IMapper mapper, IEmailTemplateRepository repository, ILogger<EmailTemplateController> logger, IMediator mediator)
|
||||
{
|
||||
_mapper = mapper;
|
||||
|
||||
@ -93,7 +93,7 @@ try
|
||||
Id = "Bearer"
|
||||
}
|
||||
},
|
||||
new string[] {}
|
||||
Array.Empty<string>()
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,7 +129,7 @@ try
|
||||
{
|
||||
var clientParams = deferredProvider.GetOptions<ClientParams>();
|
||||
var publicKey = clientParams!.PublicKeys.Get(authTokenKeys.Issuer, authTokenKeys.Audience);
|
||||
return new List<SecurityKey>() { publicKey.SecurityKey };
|
||||
return [publicKey.SecurityKey];
|
||||
},
|
||||
ValidateIssuer = true,
|
||||
ValidIssuer = authTokenKeys.Issuer,
|
||||
@ -167,7 +167,9 @@ try
|
||||
});
|
||||
|
||||
// User manager
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddUserManager<EGDbContext>();
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
// LDAP
|
||||
builder.ConfigureBySection<DirectorySearchOptions>();
|
||||
@ -177,9 +179,11 @@ try
|
||||
builder.Services.AddCookieBasedLocalizer();
|
||||
|
||||
// Envelope generator serives
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services
|
||||
.AddEnvelopeGeneratorInfrastructureServices(sqlExecutorConfigureOptions: executor => executor.ConnectionString = connStr)
|
||||
.AddEnvelopeGeneratorServices(config);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@ -201,10 +205,10 @@ try
|
||||
app.UseCors("AllowSpecificOriginsPolicy");
|
||||
|
||||
// Localizer
|
||||
string[] supportedCultureNames = { "de-DE", "en-US" };
|
||||
IList<CultureInfo> list = supportedCultureNames.Select((string cn) => new CultureInfo(cn)).ToList();
|
||||
CultureInfo cultureInfo = list.FirstOrDefault() ?? throw new ArgumentNullException("supportedCultureNames", "Supported cultures cannot be empty.");
|
||||
RequestLocalizationOptions requestLocalizationOptions = new RequestLocalizationOptions
|
||||
string[] supportedCultureNames = ["de-DE", "en-US"];
|
||||
IList<CultureInfo> list = [.. supportedCultureNames.Select(cn => new CultureInfo(cn))];
|
||||
var cultureInfo = list.FirstOrDefault() ?? throw new InvalidOperationException("There is no supported culture.");
|
||||
var requestLocalizationOptions = new RequestLocalizationOptions
|
||||
{
|
||||
SupportedCultures = list,
|
||||
SupportedUICultures = list
|
||||
|
||||
@ -53,7 +53,6 @@ public static class DIExtensions
|
||||
services.TryAddScoped<IEnvelopeReceiverRepository, EnvelopeReceiverRepository>();
|
||||
services.TryAddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
||||
services.TryAddScoped<IReceiverRepository, ReceiverRepository>();
|
||||
services.TryAddScoped<IUserReceiverRepository, UserReceiverRepository>();
|
||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
||||
|
||||
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, EnvelopeType>(context => context.EnvelopeTypes).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.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.
|
||||
public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
{
|
||||
public DbSet<UserReceiver> UserReceivers { get; set; }
|
||||
|
||||
public DbSet<Config> Configs { get; set; }
|
||||
|
||||
public DbSet<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
||||
@ -68,7 +66,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
_triggers = triggerParamOptions.Value;
|
||||
_logger = logger;
|
||||
|
||||
UserReceivers = Set<UserReceiver>();
|
||||
Configs = Set<Config>();
|
||||
EnvelopeReceivers = Set<EnvelopeReceiver>();
|
||||
Envelopes = Set<Envelope>();
|
||||
@ -106,7 +103,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
modelBuilder.Entity<EnvelopeHistory>();
|
||||
modelBuilder.Entity<EnvelopeType>();
|
||||
modelBuilder.Entity<Receiver>();
|
||||
modelBuilder.Entity<UserReceiver>();
|
||||
modelBuilder.Entity<EmailOut>();
|
||||
|
||||
// Configure the one-to-many relationship of Envelope
|
||||
@ -171,7 +167,6 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
AddTrigger<EnvelopeReceiverReadOnly>();
|
||||
AddTrigger<EnvelopeType>();
|
||||
AddTrigger<Receiver>();
|
||||
AddTrigger<UserReceiver>();
|
||||
AddTrigger<EmailOut>();
|
||||
|
||||
//configure model builder for user manager tables
|
||||
|
||||
@ -12,13 +12,16 @@ namespace EnvelopeGenerator.Infrastructure.Executor;
|
||||
|
||||
public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
|
||||
{
|
||||
[Obsolete("Use IRepository")]
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public EnvelopeExecutor(IServiceProvider provider, IOptions<SQLExecutorParams> sqlExecutorParamsOptions, IUserRepository userRepository) : base(provider, sqlExecutorParamsOptions)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public async Task<Envelope> CreateEnvelopeAsync(int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default)
|
||||
{
|
||||
using var connection = new SqlConnection(Params.ConnectionString);
|
||||
|
||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class ConfigRepository : CRUDRepository<Config, int, EGDbContext>, IConfigRepository
|
||||
{
|
||||
public ConfigRepository(EGDbContext dbContext) : base(dbContext, dbContext.Configs)
|
||||
|
||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class DocumentReceiverElementRepository : CRUDRepository<DocumentReceiverElement, int, EGDbContext>, IDocumentReceiverElementRepository
|
||||
{
|
||||
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class DocumentStatusRepository : CRUDRepository<DocumentStatus, int, EGDbContext>, IDocumentStatusRepository
|
||||
{
|
||||
public DocumentStatusRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentStatus)
|
||||
|
||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeCertificateRepository : CRUDRepository<EnvelopeCertificate, int, EGDbContext>, IEnvelopeCertificateRepository
|
||||
{
|
||||
public EnvelopeCertificateRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeCertificates)
|
||||
|
||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeDocumentRepository : CRUDRepository<EnvelopeDocument, int, EGDbContext>, IEnvelopeDocumentRepository
|
||||
{
|
||||
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
|
||||
|
||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceiverReadOnly, long, EGDbContext>, IEnvelopeReceiverReadOnlyRepository
|
||||
{
|
||||
private readonly IEnvelopeRepository _envRepo;
|
||||
|
||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeRepository : CRUDRepository<Envelope, int, EGDbContext>, IEnvelopeRepository
|
||||
{
|
||||
public EnvelopeRepository(EGDbContext dbContext) : base(dbContext, dbContext.Envelopes)
|
||||
|
||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbContext>, IEnvelopeTypeRepository
|
||||
{
|
||||
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
||||
|
||||
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IReceiverRepository
|
||||
{
|
||||
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
|
||||
};
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IEnvelopeReceiverService _envelopeReceiverService;
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public CommandManager(IEnvelopeReceiverService envelopeReceiverService, IMediator mediator)
|
||||
{
|
||||
_envelopeReceiverService = envelopeReceiverService;
|
||||
@ -29,6 +31,7 @@ public class CommandManager
|
||||
Console.WriteLine($"v{Assembly.GetExecutingAssembly().GetName().Version}");
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
[Subcommand]
|
||||
public IEnvelopeReceiverService EnvelopeReceiver => _envelopeReceiverService;
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public static class DependencyInjection
|
||||
});
|
||||
|
||||
// Add envelope generator services
|
||||
services.AddEnvelopeGeneratorInfrastructureServices(options => options.UseSqlServer(connStr));
|
||||
services.AddEnvelopeGeneratorInfrastructureServices((provider, options) => options.UseSqlServer(connStr));
|
||||
|
||||
return services
|
||||
.AddSingleton<CommandManager>()
|
||||
|
||||
@ -15,7 +15,9 @@ public class Program
|
||||
|
||||
var config = builder.Configuration;
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddCommandManagerRunner(config);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ public class DocumentController : BaseController
|
||||
_envDocService = envDocService;
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
[NonAction]
|
||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
||||
{
|
||||
@ -53,6 +54,7 @@ public class DocumentController : BaseController
|
||||
|
||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||
[HttpPost("{envelopeKey}")]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> Open(string envelopeKey)
|
||||
{
|
||||
try
|
||||
|
||||
@ -171,6 +171,7 @@ public class HomeController : ViewControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
private async Task<IActionResult> CreateShowEnvelopeView(string envelopeReceiverId, EnvelopeReceiverDto er)
|
||||
{
|
||||
try
|
||||
@ -259,6 +260,7 @@ public class HomeController : ViewControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
[NonAction]
|
||||
private async Task<IActionResult?> HandleAccessCodeAsync(Auth auth, EnvelopeReceiverSecretDto er_secret, string envelopeReceiverId)
|
||||
{
|
||||
@ -331,6 +333,7 @@ public class HomeController : ViewControllerBase
|
||||
#endregion
|
||||
|
||||
[HttpPost("EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> LogInEnvelope([FromRoute] string envelopeReceiverId, [FromForm] Auth auth)
|
||||
{
|
||||
try
|
||||
|
||||
@ -3,13 +3,13 @@ using EnvelopeGenerator.Domain.Entities;
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public class TestConfigController : ReadControllerBase<IConfigService, ConfigDto, Config, int>
|
||||
{
|
||||
public class TestConfigController : ReadControllerBase<IConfigService, ConfigDto, Config, int>
|
||||
{
|
||||
public TestConfigController(ILogger<TestConfigController> logger, IConfigService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public class TestDocumentReceiverElementController : TestControllerBase<IDocumentReceiverElementService, DocumentReceiverElementDto, DocumentReceiverElement, int>
|
||||
{
|
||||
public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service)
|
||||
|
||||
@ -4,10 +4,11 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using EnvelopeGenerator.Extensions;
|
||||
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)
|
||||
{
|
||||
}
|
||||
@ -18,14 +19,14 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
[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)
|
||||
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);
|
||||
withDocuments: withDocuments, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement, withUser: withUser, withAll: withAll);
|
||||
|
||||
if (envlopeServiceResult.IsSuccess)
|
||||
{
|
||||
@ -52,5 +53,4 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
_ => Ok(envelopeReceiverId.DecodeEnvelopeReceiverId()),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,13 +3,13 @@ using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public class TestReceiverController : CRUDControllerBase<IReceiverService, ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, Receiver, int>
|
||||
{
|
||||
public class TestReceiverController : CRUDControllerBase<IReceiverService, ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, Receiver, int>
|
||||
{
|
||||
public TestReceiverController(ILogger<TestReceiverController> logger, IReceiverService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
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]
|
||||
[Route("api/test/[controller]")]
|
||||
public class TestSanitizeController : ControllerBase
|
||||
{
|
||||
private readonly HtmlEncoder _htmlEncoder;
|
||||
private readonly HtmlSanitizer _sanitizer;
|
||||
|
||||
@ -18,7 +18,7 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
}
|
||||
|
||||
[HttpGet("sanitize")]
|
||||
public IActionResult Sanitize([FromQuery] string? input = null) => Ok(new
|
||||
public IActionResult Sanitize([FromQuery] string input) => Ok(new
|
||||
{
|
||||
input,
|
||||
Sanitized = _sanitizer.Sanitize(input),
|
||||
@ -26,12 +26,10 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
SanitizedDom = _sanitizer.SanitizeDom(input)
|
||||
});
|
||||
|
||||
|
||||
[HttpGet("encode")]
|
||||
public IActionResult Encoder([FromQuery] string? input = null) => Ok(new
|
||||
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
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddEnvelopeGeneratorInfrastructureServices((provider, options) =>
|
||||
{
|
||||
var logger = provider.GetRequiredService<ILogger<EGDbContext>>();
|
||||
@ -106,8 +107,11 @@ try
|
||||
.EnableSensitiveDataLogging()
|
||||
.EnableDetailedErrors();
|
||||
});
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddEnvelopeGeneratorServices(config);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
builder.Services.Configure<CookiePolicyOptions>(options =>
|
||||
{
|
||||
@ -174,7 +178,10 @@ try
|
||||
builder.Services.AddSingleton(sp => sp.GetRequiredService<IOptions<Cultures>>().Value);
|
||||
|
||||
// Register mail services
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddScoped<IEnvelopeMailService, EnvelopeMailService>();
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
builder.Services.AddDispatcher<EGDbContext>();
|
||||
|
||||
builder.Services.AddMemoryCache();
|
||||
@ -183,7 +190,9 @@ try
|
||||
|
||||
builder.ConfigureBySection<AnnotationParams>();
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddUserManager<EGDbContext>();
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user