Compare commits
8 Commits
feat/signF
...
feat/locat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46f1633f79 | ||
|
|
1af07f0df8 | ||
|
|
55c9dfb9c2 | ||
|
|
1a230306a3 | ||
|
|
28022bc669 | ||
|
|
ad5843b7c9 | ||
|
|
173b691e56 | ||
|
|
8a0fe70a88 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -363,5 +363,3 @@ MigrationBackup/
|
||||
FodyWeavers.xsd
|
||||
/EnvelopeGenerator.Web/.config/dotnet-tools.json
|
||||
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
||||
/EnvelopeGenerator.Tests.Application/Services/BugFixTests.cs
|
||||
/EnvelopeGenerator.Tests.Application/annotations.json
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations
|
||||
{
|
||||
public class AuthenticatorParams
|
||||
{
|
||||
public string CharPool { get; init; } = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789012345678901234567890123456789";
|
||||
|
||||
//TODO: Increase the DefaultTotpSecretKeyLength (e.g. to 32) but make sure that the QR code is generated correctly and can be scanned by the authenticator.
|
||||
public int DefaultTotpSecretKeyLength { get; init; } = 20;
|
||||
|
||||
public string TotpIssuer { get; init; } = "signFlow";
|
||||
|
||||
/// <summary>
|
||||
/// 0 is user email, 1 is secret key and 2 is issuer.
|
||||
/// </summary>
|
||||
public string TotpUrlFormat { get; init; } = "otpauth://totp/{0}?secret={1}&issuer={2}";
|
||||
|
||||
public int TotpQRPixelsPerModule { get; init; } = 20;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations;
|
||||
|
||||
public class DbTriggerParams : Dictionary<string, IEnumerable<string>>
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations
|
||||
{
|
||||
public class DispatcherConfig
|
||||
{
|
||||
public int SendingProfile { get; init; } = 1;
|
||||
|
||||
public string AddedWho { get; init; } = "DDEnvelopGenerator";
|
||||
|
||||
public int ReminderTypeId { get; init; } = 202377;
|
||||
|
||||
public string EmailAttmt1 { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations;
|
||||
|
||||
public class DispatcherParams
|
||||
{
|
||||
public int SendingProfile { get; init; } = 1;
|
||||
|
||||
public string AddedWho { get; init; } = "DDEnvelopGenerator";
|
||||
|
||||
public int ReminderTypeId { get; init; } = 202377;
|
||||
|
||||
public string EmailAttmt1 { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Client;
|
||||
namespace EnvelopeGenerator.Application.Configurations;
|
||||
|
||||
/// <summary>
|
||||
/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/
|
||||
/// </summary>
|
||||
public class GtxMessagingParams : IHttpClientOptions
|
||||
{
|
||||
public required string Uri { get; init; }
|
||||
|
||||
public string? Path { get; init; }
|
||||
|
||||
public Dictionary<string, object>? Headers { get; init; }
|
||||
|
||||
public Dictionary<string, object?>? QueryParams { get; init; }
|
||||
|
||||
public string RecipientQueryParamName { get; init; } = "to";
|
||||
|
||||
public string MessageQueryParamName { get; init; } = "text";
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations
|
||||
{
|
||||
public class MailConfig
|
||||
{
|
||||
public required Dictionary<string, string> Placeholders { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Configurations;
|
||||
|
||||
public class MailParams
|
||||
{
|
||||
public required Dictionary<string, string> Placeholders { get; init; }
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using OtpNet;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Configurations
|
||||
{
|
||||
public class TotpSmsParams
|
||||
{
|
||||
/// <summary>
|
||||
/// The unit is second.
|
||||
/// </summary>
|
||||
public int TotpStep { get; init; } = 90;
|
||||
|
||||
public string Format { get; init; } = "Ihr 2FA-Passwort lautet {0}. Gültig bis {1}";
|
||||
|
||||
public ExpirationHandler Expiration { get; init; } = new();
|
||||
|
||||
public VerificationWindow? TotpVerificationWindow { get; private init; } = VerificationWindow.RfcSpecifiedNetworkDelay;
|
||||
|
||||
private IEnumerable<int>? _tvwParams;
|
||||
|
||||
public IEnumerable<int>? TotpVerificationWindowParams
|
||||
{
|
||||
get => _tvwParams;
|
||||
init
|
||||
{
|
||||
_tvwParams = value;
|
||||
if(_tvwParams is not null)
|
||||
TotpVerificationWindow = new(previous: _tvwParams.ElementAtOrDefault(0), future: _tvwParams.ElementAtOrDefault(0));
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpirationHandler
|
||||
{
|
||||
public string CacheKeyFormat { get; init; } = "e{0}_r{1}_sms_code_expiration";
|
||||
|
||||
public string Format { get; init; } = "HH:mm:ss";
|
||||
|
||||
public string CultureName
|
||||
{
|
||||
get => _cultureInfo.Name;
|
||||
init => _cultureInfo = new(value);
|
||||
}
|
||||
|
||||
private CultureInfo _cultureInfo = new("de-DE");
|
||||
|
||||
public CultureInfo CultureInfo => _cultureInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
EnvelopeGenerator.Application/Contracts/IConfigService.cs
Normal file
17
EnvelopeGenerator.Application/Contracts/IConfigService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IConfigService : IReadService<ConfigDto, Config, int>
|
||||
{
|
||||
Task<DataResult<ConfigDto>> ReadFirstAsync();
|
||||
|
||||
Task<ConfigDto> ReadDefaultAsync();
|
||||
|
||||
Task<string> ReadDefaultSignatureHost();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IDocumentReceiverElementService : IBasicCRUDService<DocumentReceiverElementDto, DocumentReceiverElement, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IDocumentStatusService : IBasicCRUDService<DocumentStatusDto, DocumentStatus, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEmailTemplateService : IBasicCRUDService<EmailTemplateDto, EmailTemplate, int>
|
||||
{
|
||||
Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeCertificateService : IBasicCRUDService<EnvelopeCertificateDto, EnvelopeCertificate, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeDocumentService : IBasicCRUDService<EnvelopeDocumentDto, EnvelopeDocument, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeHistoryService : ICRUDService<EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
{
|
||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||
|
||||
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
||||
|
||||
Task<bool> IsSigned(int envelopeId, string userReference);
|
||||
|
||||
Task<bool> IsRejected(int envelopeId, string? userReference = null);
|
||||
|
||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadAsync(int? envelopeId = null, string? userReference = null, ReferenceType? referenceType = null, int? status = null, bool withSender = false, bool withReceiver = false);
|
||||
|
||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null);
|
||||
|
||||
Task<IEnumerable<ReceiverReadDto>> ReadRejectingReceivers(int envelopeId);
|
||||
|
||||
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
using EnvelopeGenerator.Common;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeMailService : IEmailOutService
|
||||
{
|
||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverDto envelopeReceiverDto, Constants.EmailTemplateType tempType);
|
||||
|
||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverReadOnlyDto dto);
|
||||
|
||||
Task<DataResult<int>> SendAccessCodeAsync(EnvelopeReceiverDto envelopeReceiverDto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeReceiverReadOnlyService : ICRUDService<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnlyDto, EnvelopeReceiverReadOnlyUpdateDto, EnvelopeReceiverReadOnly, long>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeReceiverService : IBasicCRUDService<EnvelopeReceiverDto, EnvelopeReceiver, (int Envelope, int Receiver)>
|
||||
{
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverSecretDto>>> ReadSecretByUuidAsync(string uuid, bool withEnvelope = false, bool withReceiver = true);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true);
|
||||
|
||||
Task<DataResult<EnvelopeReceiverDto>> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true);
|
||||
|
||||
Task<DataResult<EnvelopeReceiverDto>> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true);
|
||||
|
||||
Task<DataResult<string>> ReadAccessCodeByIdAsync(int envelopeId, int receiverId);
|
||||
|
||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string uuid, string signature, string accessCode);
|
||||
|
||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode);
|
||||
|
||||
Task<DataResult<bool>> IsExisting(string envelopeReceiverId);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
||||
|
||||
Task<DataResult<string?>> ReadLastUsedReceiverNameByMail(string mail);
|
||||
}
|
||||
}
|
||||
16
EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs
Normal file
16
EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeService : IBasicCRUDService<EnvelopeDto, Envelope, int>
|
||||
{
|
||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false);
|
||||
|
||||
Task<DataResult<EnvelopeDto>> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadByUserAsync(int userId, int? min_status = null, int? max_status = null, params int[]ignore_statuses);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
24
EnvelopeGenerator.Application/Contracts/IJWTService.cs
Normal file
24
EnvelopeGenerator.Application/Contracts/IJWTService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IJWTService<TClaimValue>
|
||||
{
|
||||
public static SymmetricSecurityKey GenerateSecurityKey(int byteSize = 32)
|
||||
{
|
||||
using var rng = RandomNumberGenerator.Create();
|
||||
var randomBytes = new byte[byteSize];
|
||||
rng.GetBytes(randomBytes);
|
||||
var securityKey = new SymmetricSecurityKey(randomBytes);
|
||||
|
||||
return securityKey;
|
||||
}
|
||||
|
||||
string GenerateToken(TClaimValue claimValue);
|
||||
|
||||
JwtSecurityToken? ReadSecurityToken(string token);
|
||||
}
|
||||
}
|
||||
14
EnvelopeGenerator.Application/Contracts/IReceiverService.cs
Normal file
14
EnvelopeGenerator.Application/Contracts/IReceiverService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, Receiver, int>
|
||||
{
|
||||
public Task<DataResult<ReceiverReadDto>> ReadByAsync(string? emailAddress = null, string? signature = null);
|
||||
|
||||
public Task<Result> DeleteByAsync(string? emailAddress = null, string? signature = null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IUserReceiverService : IBasicCRUDService<UserReceiverDto, UserReceiver, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IConfigRepository : ICRUDRepository<Config, int>
|
||||
{
|
||||
Task<Config?> ReadFirstAsync();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IDocumentReceiverElementRepository : ICRUDRepository<DocumentReceiverElement, int>
|
||||
{
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IDocumentStatusRepository : ICRUDRepository<DocumentStatus, int>
|
||||
{
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
||||
{
|
||||
Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeCertificateRepository : ICRUDRepository<EnvelopeCertificate, int>
|
||||
{
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeDocumentRepository : ICRUDRepository<EnvelopeDocument, int>
|
||||
{
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeHistoryRepository : ICRUDRepository<EnvelopeHistory, long>
|
||||
{
|
||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||
|
||||
Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeReceiverReadOnlyRepository : ICRUDRepository<EnvelopeReceiverReadOnly, long>
|
||||
{
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
|
||||
{
|
||||
Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true);
|
||||
|
||||
Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = true);
|
||||
|
||||
Task<int> CountAsync(string uuid, string signature);
|
||||
|
||||
Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
|
||||
|
||||
Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
|
||||
|
||||
Task<IEnumerable<EnvelopeReceiver>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
||||
|
||||
Task<EnvelopeReceiver?> ReadLastByReceiverAsync(string? email = null, int? id = null, string? signature = null);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeRepository : ICRUDRepository<Envelope, int>
|
||||
{
|
||||
Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false);
|
||||
|
||||
Task<Envelope?> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false);
|
||||
|
||||
Task<IEnumerable<Envelope>> ReadByUserAsync(int userId, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeType, int>
|
||||
{
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IReceiverRepository : ICRUDRepository<Receiver, int>
|
||||
{
|
||||
Task<Receiver?> ReadByAsync(string? emailAddress = null, string? signature = null);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
|
||||
public interface IUserReceiverRepository : ICRUDRepository<UserReceiver, int>
|
||||
{
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IDocumentExecutor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="base64"></param>
|
||||
/// <param name="envelope_uuid"></param>
|
||||
/// <param name="cancellation"></param>
|
||||
/// <returns></returns>
|
||||
Task<EnvelopeDocument> CreateDocumentAsync(string base64, string envelope_uuid, CancellationToken cancellation = default);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using Dapper;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IEnvelopeExecutor : ISQLExecutor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="tfaEnabled"></param>
|
||||
/// <param name="cancellation"></param>
|
||||
/// <returns></returns>
|
||||
Task<Envelope> CreateEnvelopeAsync(int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IEnvelopeReceiverExecutor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="envelope_uuid"></param>
|
||||
/// <param name="emailAddress"></param>
|
||||
/// <param name="salutation"></param>
|
||||
/// <param name="phone"></param>
|
||||
/// <param name="cancellation"></param>
|
||||
/// <returns></returns>
|
||||
Task<EnvelopeReceiver?> AddEnvelopeReceiverAsync(string envelope_uuid, string emailAddress, string? salutation = null, string? phone = null, CancellationToken cancellation = default);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
/// Provides methods for executing common queries on a given entity type.
|
||||
/// This interface abstracts away the direct usage of ORM libraries (such as Entity Framework) for querying data
|
||||
/// and provides asynchronous and synchronous operations for querying a collection or single entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the entity being queried.</typeparam>
|
||||
public interface IQuery<TEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the first entity or a default value if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the entity or a default value.</returns>
|
||||
public Task<TEntity?> FirstOrDefaultAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a single entity or a default value if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the entity or a default value.</returns>
|
||||
public Task<TEntity?> SingleOrDefaultAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of entities.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of entities.</returns>
|
||||
public Task<IEnumerable<TEntity>> ToListAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the first entity. Throws an exception if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the first entity.</returns>
|
||||
public Task<TEntity> FirstAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a single entity. Throws an exception if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the single entity.</returns>
|
||||
public Task<TEntity> SingleAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously retrieves the first entity or a default value if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>The first entity or a default value.</returns>
|
||||
public TEntity? FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously retrieves a single entity or a default value if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>The single entity or a default value.</returns>
|
||||
public TEntity? SingleOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously retrieves a list of entities.
|
||||
/// </summary>
|
||||
/// <returns>The list of entities.</returns>
|
||||
public IEnumerable<TEntity> ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously retrieves the first entity. Throws an exception if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>The first entity.</returns>
|
||||
public TEntity First();
|
||||
|
||||
/// <summary>
|
||||
/// Synchronously retrieves a single entity. Throws an exception if no entity is found.
|
||||
/// </summary>
|
||||
/// <returns>The single entity.</returns>
|
||||
public TEntity Single();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a raw SQL query contract.
|
||||
/// </summary>
|
||||
public interface ISQL
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the raw SQL query string.
|
||||
/// </summary>
|
||||
string Raw { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a typed SQL query contract for a specific entity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the entity associated with the SQL query.</typeparam>
|
||||
public interface ISQL<TEntity> : ISQL
|
||||
{
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
/// Defines methods for executing raw SQL queries or custom SQL query classes and returning query executors for further operations.
|
||||
/// Provides abstraction for raw SQL execution as well as mapping the results to <typeparamref name="TEntity"/> objects.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The entity type to which the SQL query results will be mapped.</typeparam>
|
||||
public interface ISQLExecutor<TEntity>: ISQLExecutor
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a raw SQL query and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
||||
/// </summary>
|
||||
/// <param name="sql">The raw SQL query to execute.</param>
|
||||
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
||||
/// <param name="parameters">Optional parameters for the SQL query.</param>
|
||||
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
||||
IQuery<TEntity> Execute(string sql, CancellationToken cancellation = default, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// Executes a custom SQL query defined by a class that implements <see cref="ISQL{TEntity}"/> and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSQL">The type of the custom SQL query class implementing <see cref="ISQL{TEntity}"/>.</typeparam>
|
||||
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
||||
/// <param name="parameters">Optional parameters for the SQL query.</param>
|
||||
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
||||
IQuery<TEntity> Execute<TSQL>(CancellationToken cancellation = default, params object[] parameters) where TSQL : ISQL<TEntity>;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using Dapper;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface ISQLExecutor
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a raw SQL query and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The entity type to which the SQL query results will be mapped.</typeparam>
|
||||
/// <param name="sql">The raw SQL query to execute.</param>
|
||||
/// <param name="parameters">Parameters for the SQL query.</param>
|
||||
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
||||
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
||||
Task<IEnumerable<TEntity>> Execute<TEntity>(string sql, DynamicParameters parameters, CancellationToken cancellation = default);
|
||||
|
||||
/// <summary>
|
||||
/// Executes a custom SQL query defined by a class that implements <see cref="ISQL{TEntity}"/> and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The entity type to which the SQL query results will be mapped.</typeparam>
|
||||
/// <typeparam name="TSQL">The type of the custom SQL query class implementing <see cref="ISQL{TEntity}"/>.</typeparam>
|
||||
/// <param name="parameters">Parameters for the SQL query.</param>
|
||||
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
||||
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
||||
Task<IEnumerable<TEntity>> Execute<TEntity, TSQL>(DynamicParameters parameters, CancellationToken cancellation = default) where TSQL : ISQL;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using OtpNet;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IAuthenticator
|
||||
{
|
||||
string GenerateCode(int length);
|
||||
|
||||
string GenerateTotpSecretKey(int? length = null);
|
||||
|
||||
byte[] GenerateTotpQrCode(string userEmail, string secretKey, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
||||
|
||||
byte[] GenerateTotpQrCode(string userEmail, int? length = null, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
||||
|
||||
string GenerateTotp(string secretKey, int step = 30);
|
||||
|
||||
bool VerifyTotp(string totpCode, string secretKey, int step = 30, VerificationWindow? window = null);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IConfigService : IReadService<ConfigDto, Config, int>
|
||||
{
|
||||
Task<DataResult<ConfigDto>> ReadFirstAsync();
|
||||
|
||||
Task<ConfigDto> ReadDefaultAsync();
|
||||
|
||||
Task<string> ReadDefaultSignatureHost();
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IDocumentReceiverElementService : IBasicCRUDService<DocumentReceiverElementDto, DocumentReceiverElement, int>
|
||||
{
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IDocumentStatusService : IBasicCRUDService<DocumentStatusDto, DocumentStatus, int>
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEmailTemplateService : IBasicCRUDService<EmailTemplateDto, EmailTemplate, int>
|
||||
{
|
||||
Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeCertificateService : IBasicCRUDService<EnvelopeCertificateDto, EnvelopeCertificate, int>
|
||||
{
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeDocumentService : IBasicCRUDService<EnvelopeDocumentDto, EnvelopeDocument, int>
|
||||
{
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeHistoryService : ICRUDService<EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
{
|
||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||
|
||||
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
||||
|
||||
Task<bool> IsSigned(int envelopeId, string userReference);
|
||||
|
||||
Task<bool> IsRejected(int envelopeId, string? userReference = null);
|
||||
|
||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadAsync(int? envelopeId = null, string? userReference = null, ReferenceType? referenceType = null, int? status = null, bool withSender = false, bool withReceiver = false);
|
||||
|
||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null);
|
||||
|
||||
Task<IEnumerable<ReceiverReadDto>> ReadRejectingReceivers(int envelopeId);
|
||||
|
||||
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
using EnvelopeGenerator.Common;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeMailService : IEmailOutService
|
||||
{
|
||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverDto envelopeReceiverDto, Constants.EmailTemplateType tempType, Dictionary<string, object>? optionalPlaceholders = null);
|
||||
|
||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverReadOnlyDto dto, Dictionary<string, object>? optionalPlaceholders = null);
|
||||
|
||||
Task<DataResult<int>> SendAccessCodeAsync(EnvelopeReceiverDto envelopeReceiverDto);
|
||||
|
||||
Task<DataResult<int>> SendTFAQrCodeAsync(EnvelopeReceiverDto envelopeReceiverDto);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeReceiverReadOnlyService : ICRUDService<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnlyDto, EnvelopeReceiverReadOnly, long>
|
||||
{
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using CommandDotNet;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||
using EnvelopeGenerator.Application.Envelopes;
|
||||
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeReceiverService : IBasicCRUDService<EnvelopeReceiverDto, EnvelopeReceiver, (int Envelope, int Receiver)>
|
||||
{
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true);
|
||||
|
||||
Task<DataResult<IEnumerable<string?>>> ReadAccessCodeByUuidAsync(string uuid, bool withEnvelope = false, bool withReceiver = true);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<DataResult<EnvelopeReceiverDto>> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<DataResult<EnvelopeReceiverSecretDto>> ReadWithSecretByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<DataResult<EnvelopeReceiverDto>> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
||||
|
||||
Task<DataResult<string>> ReadAccessCodeByIdAsync(int envelopeId, int receiverId);
|
||||
|
||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string uuid, string signature, string accessCode);
|
||||
|
||||
[Command("verify-access-code-async-by-id")]
|
||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode);
|
||||
|
||||
Task<DataResult<bool>> IsExisting(string envelopeReceiverId);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, EnvelopeQuery? envelopeQuery = null, ReadReceiverQuery? receiverQuery = null, params int[] ignore_statuses);
|
||||
|
||||
Task<DataResult<string?>> ReadLastUsedReceiverNameByMailAsync(string? mail = null, int? id = null, string? signature = null);
|
||||
|
||||
Task<DataResult<SmsResponse>> SendSmsAsync(string envelopeReceiverId, string message);
|
||||
Task<DataResult<IEnumerable<EnvelopeReceiverSecretDto>>> ReadWithSecretByUuidAsync(string uuid);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeService : IBasicCRUDService<EnvelopeDto, Envelope, int>
|
||||
{
|
||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false);
|
||||
|
||||
Task<DataResult<EnvelopeDto>> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false);
|
||||
|
||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadByUserAsync(int userId, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeSmsHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// If expiration is passed then, sends sms and returns smsResponse and up-to-date expiration; otherwise send expiration.
|
||||
/// </summary>
|
||||
/// <param name="er_secret"></param>
|
||||
/// <param name="cToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<(SmsResponse? SmsResponse, DateTime Expiration)> SendTotpAsync(EnvelopeReceiverSecretDto er_secret, CancellationToken cToken = default);
|
||||
|
||||
bool VerifyTotp(string totpCode, string secretKey);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
|
||||
{
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverReadDto, Receiver, int>
|
||||
{
|
||||
Task<DataResult<ReceiverReadDto>> ReadByAsync(string? emailAddress = null, string? signature = null);
|
||||
|
||||
Task<Result> DeleteByAsync(string? emailAddress = null, string? signature = null);
|
||||
|
||||
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto) where TUpdateDto : IUnique<int>;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
//TODO: move to DigitalData.Core
|
||||
public interface ISmsSender
|
||||
{
|
||||
string ServiceProvider { get; }
|
||||
|
||||
Task<SmsResponse> SendSmsAsync(string recipient, string message);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
public interface IUserReceiverService : IBasicCRUDService<UserReceiverDto, UserReceiver, int>
|
||||
{
|
||||
}
|
||||
63
EnvelopeGenerator.Application/DIExtensions.cs
Normal file
63
EnvelopeGenerator.Application/DIExtensions.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using DigitalData.UserManager.Application.MappingProfiles;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.MappingProfiles;
|
||||
using EnvelopeGenerator.Application.Configurations;
|
||||
using EnvelopeGenerator.Application.Services;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using EnvelopeGenerator.Infrastructure.Repositories;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace EnvelopeGenerator.Application
|
||||
{
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration dispatcherConfigSection, IConfiguration mailConfigSection)
|
||||
{
|
||||
//Inject CRUD Service and repositoriesad
|
||||
services.AddScoped<IConfigRepository, ConfigRepository>();
|
||||
services.AddScoped<IDocumentReceiverElementRepository, DocumentReceiverElementRepository>();
|
||||
services.AddScoped<IEnvelopeDocumentRepository, EnvelopeDocumentRepository>();
|
||||
services.AddScoped<IConfigRepository, ConfigRepository>();
|
||||
services.AddScoped<IDocumentReceiverElementRepository, DocumentReceiverElementRepository>();
|
||||
services.AddScoped<IDocumentStatusRepository, DocumentStatusRepository>();
|
||||
services.AddScoped<IEmailTemplateRepository, EmailTemplateRepository>();
|
||||
services.AddScoped<IEnvelopeRepository, EnvelopeRepository>();
|
||||
services.AddScoped<IEnvelopeCertificateRepository, EnvelopeCertificateRepository>();
|
||||
services.AddScoped<IEnvelopeDocumentRepository, EnvelopeDocumentRepository>();
|
||||
services.AddScoped<IEnvelopeHistoryRepository, EnvelopeHistoryRepository>();
|
||||
services.AddScoped<IEnvelopeReceiverRepository, EnvelopeReceiverRepository>();
|
||||
services.AddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
||||
services.AddScoped<IReceiverRepository, ReceiverRepository>();
|
||||
services.AddScoped<IUserReceiverRepository, UserReceiverRepository>();
|
||||
services.AddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
||||
services.AddScoped<IConfigService, ConfigService>();
|
||||
services.AddScoped<IDocumentReceiverElementService, DocumentReceiverElementService>();
|
||||
services.AddScoped<IEnvelopeDocumentService, EnvelopeDocumentService>();
|
||||
services.AddScoped<IEnvelopeHistoryService, EnvelopeHistoryService>();
|
||||
services.AddScoped<IDocumentStatusService, DocumentStatusService>();
|
||||
services.AddScoped<IEmailTemplateService, EmailTemplateService>();
|
||||
services.AddScoped<IEnvelopeService, EnvelopeService>();
|
||||
services.AddScoped<IEnvelopeCertificateService, EnvelopeCertificateService>();
|
||||
services.AddScoped<IEnvelopeDocumentService, EnvelopeDocumentService>();
|
||||
services.AddScoped<IEnvelopeReceiverService, EnvelopeReceiverService>();
|
||||
services.AddScoped<IEnvelopeTypeService, EnvelopeTypeService>();
|
||||
services.AddScoped<IReceiverService, ReceiverService>();
|
||||
services.AddScoped<IUserReceiverService, UserReceiverService>();
|
||||
services.AddScoped<IEnvelopeReceiverReadOnlyService, EnvelopeReceiverReadOnlyService>();
|
||||
|
||||
//Auto mapping profiles
|
||||
services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly);
|
||||
services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
|
||||
|
||||
services.Configure<DispatcherConfig>(dispatcherConfigSection);
|
||||
services.Configure<MailConfig>(mailConfigSection);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config) => services.AddEnvelopeGenerator(
|
||||
dispatcherConfigSection: config.GetSection("DispatcherConfig"),
|
||||
mailConfigSection: config.GetSection("MailConfig"));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ConfigDto(
|
||||
string DocumentPath,
|
||||
int SendingProfile,
|
||||
string SignatureHost,
|
||||
string ExternalProgramName,
|
||||
string ExportPath) : IUnique<int>
|
||||
string ExportPath,
|
||||
string DocumentPathDmz,
|
||||
string ExportPathDmz,
|
||||
string DocumentPathMoveAftsend) : IUnique<int>
|
||||
{
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
[Obsolete("Configuration does not have an ID; it represents a single table in the database.")]
|
||||
public int Id => throw new InvalidOperationException("This configuration does not support an ID as it represents a single row in the database.");
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record DocumentReceiverElementDto(
|
||||
int Id,
|
||||
int DocumentId,
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record DocumentStatusDto(
|
||||
int Id,
|
||||
int EnvelopeId,
|
||||
int ReceiverId,
|
||||
int Status,
|
||||
DateTime? StatusChangedWhen,
|
||||
string Value,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ChangedWhen) : IUnique<int>
|
||||
{
|
||||
public string? Value { get; set; }
|
||||
};
|
||||
DateTime? ChangedWhen) : IUnique<int>;
|
||||
}
|
||||
@@ -1,32 +1,10 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EmailTemplateDto : IUnique<int>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Id{ get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public required string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public required string Subject { get; set; }
|
||||
};
|
||||
public record EmailTemplateDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string Body,
|
||||
string Subject) : IUnique<int>;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeCertificateDto(
|
||||
int Id,
|
||||
int EnvelopeId,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeDocumentDto
|
||||
(
|
||||
int Id,
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeDto() : IUnique<int>
|
||||
{
|
||||
public int Id { get; set; }
|
||||
@@ -21,9 +19,9 @@ namespace EnvelopeGenerator.Application.DTOs
|
||||
|
||||
[TemplatePlaceholder("[MESSAGE]")]
|
||||
public string Message { get; set; }
|
||||
|
||||
public DateTime? ExpiresWhen { get; set; }
|
||||
public DateTime? ExpiresWarningWhen { get; set; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
||||
@@ -33,24 +31,37 @@ namespace EnvelopeGenerator.Application.DTOs
|
||||
|
||||
public string Language { get; set; }
|
||||
|
||||
public bool? SendReminderEmails { get; set; }
|
||||
|
||||
public int? FirstReminderDays { get; set; }
|
||||
|
||||
public int? ReminderIntervalDays { get; set; }
|
||||
|
||||
public int? EnvelopeTypeId { get; set; }
|
||||
|
||||
public int? CertificationType { get; set; }
|
||||
|
||||
public bool? UseAccessCode { get; set; }
|
||||
|
||||
public bool TFAEnabled { get; init; }
|
||||
public int? FinalEmailToCreator { get; set; }
|
||||
|
||||
public int? FinalEmailToReceivers { get; set; }
|
||||
|
||||
public int? ExpiresWhenDays { get; set; }
|
||||
|
||||
public int? ExpiresWarningWhenDays { get; set; }
|
||||
|
||||
public bool DmzMoved { get; set; }
|
||||
public UserReadDto? User { get; set; }
|
||||
|
||||
public EnvelopeType? EnvelopeType { get; set; }
|
||||
|
||||
public string? EnvelopeTypeTitle { get; set; }
|
||||
|
||||
public bool IsAlreadySent { get; set; }
|
||||
|
||||
public byte[]? DocResult { get; init; }
|
||||
public string? StatusTranslated { get; set; }
|
||||
|
||||
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
|
||||
public string? ContractTypeTranslated { get; set; }
|
||||
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeHistoryCreateDto(
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
|
||||
@@ -2,35 +2,20 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <param name="EnvelopeId"></param>
|
||||
/// <param name="UserReference"></param>
|
||||
/// <param name="Status"></param>
|
||||
/// <param name="StatusName"></param>
|
||||
/// <param name="AddedWhen"></param>
|
||||
/// <param name="ActionDate"></param>
|
||||
/// <param name="Sender"></param>
|
||||
/// <param name="Receiver"></param>
|
||||
/// <param name="ReferenceType"></param>
|
||||
/// <param name="Comment"></param>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeHistoryDto(
|
||||
long Id,
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
int Status,
|
||||
string? StatusName,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ActionDate,
|
||||
UserCreateDto? Sender,
|
||||
ReceiverReadDto? Receiver,
|
||||
ReferenceType ReferenceType,
|
||||
string? Comment = null) : BaseDTO<long>(Id), IUnique<long>;
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
{
|
||||
public record EnvelopeHistoryDto(
|
||||
long Id,
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
int Status,
|
||||
string? StatusName,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ActionDate,
|
||||
UserCreateDto? Sender,
|
||||
ReceiverReadDto? Receiver,
|
||||
ReferenceType ReferenceType,
|
||||
string? Comment = null) : BaseDTO<long>(Id), IUnique<long>;
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
|
||||
{
|
||||
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
||||
@@ -27,7 +25,5 @@ namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||
public DateTime AddedWhen { get; init; }
|
||||
|
||||
public DateTime? ChangedWhen { get; init; }
|
||||
|
||||
public bool HasPhoneNumber { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
|
||||
{
|
||||
public EnvelopeDto? Envelope { get; set; }
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
|
||||
{
|
||||
public string? AccessCode { get; init; }
|
||||
|
||||
public string? PhoneNumber { get; init; }
|
||||
}
|
||||
public record EnvelopeReceiverSecretDto(string? AccessCode) : EnvelopeReceiverDto;
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverReadOnlyCreateDto(
|
||||
DateTime DateValid)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverReadOnlyDto(
|
||||
long Id,
|
||||
long EnvelopeId,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverReadOnlyUpdateDto(
|
||||
long Id,
|
||||
DateTime DateValid,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeTypeDto(
|
||||
int Id,
|
||||
string Title,
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the AutoMapper profile configuration for mapping between
|
||||
/// domain entities and data transfer objects (DTOs) used within the EnvelopeGenerator application.
|
||||
/// </summary>
|
||||
public class MappingProfile : Profile
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingProfile"/> class.
|
||||
/// Configures the mappings between entities and DTOs used throughout the application.
|
||||
/// </summary>
|
||||
public MappingProfile()
|
||||
{
|
||||
// Entity to DTO mappings
|
||||
CreateMap<Config, ConfigDto>();
|
||||
CreateMap<DocumentReceiverElement, DocumentReceiverElementDto>();
|
||||
CreateMap<DocumentStatus, DocumentStatusDto>();
|
||||
CreateMap<EmailTemplate, EmailTemplateDto>();
|
||||
CreateMap<Envelope, EnvelopeDto>();
|
||||
CreateMap<EnvelopeCertificate, EnvelopeCertificateDto>();
|
||||
CreateMap<EnvelopeDocument, EnvelopeDocumentDto>();
|
||||
CreateMap<Domain.Entities.EnvelopeHistory, EnvelopeHistoryDto>();
|
||||
CreateMap<Domain.Entities.EnvelopeHistory, EnvelopeHistoryCreateDto>();
|
||||
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverDto>();
|
||||
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverSecretDto>();
|
||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
||||
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
|
||||
CreateMap<ConfigDto, Config>();
|
||||
CreateMap<DocumentReceiverElementDto, DocumentReceiverElement>();
|
||||
CreateMap<DocumentStatusDto, DocumentStatus>();
|
||||
CreateMap<EmailTemplateDto, EmailTemplate>();
|
||||
CreateMap<EnvelopeDto, Envelope>();
|
||||
CreateMap<EnvelopeCertificateDto, EnvelopeCertificate>();
|
||||
CreateMap<EnvelopeDocumentDto, EnvelopeDocument>();
|
||||
CreateMap<EnvelopeHistoryDto, Domain.Entities.EnvelopeHistory>();
|
||||
CreateMap<EnvelopeHistoryCreateDto, Domain.Entities.EnvelopeHistory>();
|
||||
CreateMap<EnvelopeReceiverDto, Domain.Entities.EnvelopeReceiver>();
|
||||
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
||||
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>();
|
||||
|
||||
// Messaging mappings
|
||||
// for GTX messaging
|
||||
CreateMap<GtxMessagingResponse, SmsResponse>()
|
||||
.ConstructUsing(gtxRes => gtxRes.Ok()
|
||||
? new SmsResponse() { Ok = true }
|
||||
: new SmsResponse() { Ok = false, Errors = gtxRes });
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class GtxMessagingResponse : Dictionary<string, object?> { }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record SmsResponse
|
||||
{
|
||||
public required bool Ok { get; init; }
|
||||
|
||||
public bool Failed => !Ok;
|
||||
|
||||
public dynamic? Errors { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null)
|
||||
public record ReceiverCreateDto([EmailAddress] string EmailAddress)
|
||||
{
|
||||
public string Signature => sha256HexOfMail.Value;
|
||||
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverReadDto(
|
||||
int Id,
|
||||
string EmailAddress,
|
||||
string Signature,
|
||||
DateTime AddedWhen
|
||||
) : BaseDTO<int>(Id), IUnique<int>
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
[JsonIgnore]
|
||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; init; }
|
||||
public record ReceiverReadDto(
|
||||
int Id,
|
||||
string EmailAddress,
|
||||
string Signature,
|
||||
DateTime AddedWhen
|
||||
) : BaseDTO<int>(Id)
|
||||
{
|
||||
[JsonIgnore]
|
||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; init; }
|
||||
|
||||
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||
|
||||
public string? TotpSecretkey { get; set; } = null;
|
||||
|
||||
public DateTime? TfaRegDeadline { get; set; }
|
||||
};
|
||||
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TfaRegDeadline = null) : IUnique<int>;
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
public record ReceiverUpdateDto(int Id) : IUnique<int>;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record UserReceiverDto(
|
||||
int Id,
|
||||
int UserId,
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
using EnvelopeGenerator.Application.Configurations;
|
||||
using EnvelopeGenerator.Application.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using DigitalData.Core.Client;
|
||||
using QRCoder;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using System.Reflection;
|
||||
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands.Create;
|
||||
|
||||
namespace EnvelopeGenerator.Application;
|
||||
|
||||
/// <summary>
|
||||
/// Extensions method for dependency injection
|
||||
/// </summary>
|
||||
public static class DependencyInjection
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds all required services for envelope generator application
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddEnvelopeGeneratorServices(this IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
//Inject CRUD Service and repositoriesad
|
||||
services.TryAddScoped<IConfigService, ConfigService>();
|
||||
services.TryAddScoped<IDocumentReceiverElementService, DocumentReceiverElementService>();
|
||||
services.TryAddScoped<IEnvelopeDocumentService, EnvelopeDocumentService>();
|
||||
services.TryAddScoped<IEnvelopeHistoryService, EnvelopeHistoryService>();
|
||||
services.TryAddScoped<IDocumentStatusService, DocumentStatusService>();
|
||||
services.TryAddScoped<IEmailTemplateService, EmailTemplateService>();
|
||||
services.TryAddScoped<IEnvelopeService, EnvelopeService>();
|
||||
services.TryAddScoped<IEnvelopeCertificateService, EnvelopeCertificateService>();
|
||||
services.TryAddScoped<IEnvelopeDocumentService, EnvelopeDocumentService>();
|
||||
services.TryAddScoped<IEnvelopeReceiverService, EnvelopeReceiverService>();
|
||||
services.TryAddScoped<IEnvelopeTypeService, EnvelopeTypeService>();
|
||||
services.TryAddScoped<IReceiverService, ReceiverService>();
|
||||
services.TryAddScoped<IUserReceiverService, UserReceiverService>();
|
||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyService, EnvelopeReceiverReadOnlyService>();
|
||||
|
||||
//Auto mapping profiles
|
||||
services.AddAutoMapper(Assembly.GetExecutingAssembly());
|
||||
services.AddAutoMapper(typeof(DigitalData.UserManager.Application.DIExtensions));
|
||||
|
||||
services.Configure<DispatcherParams>(config.GetSection(nameof(DispatcherParams)));
|
||||
services.Configure<MailParams>(config.GetSection(nameof(MailParams)));
|
||||
services.Configure<AuthenticatorParams>(config.GetSection(nameof(AuthenticatorParams)));
|
||||
services.Configure<TotpSmsParams>(config.GetSection(nameof(TotpSmsParams)));
|
||||
services.Configure<DbTriggerParams>(config.GetSection(nameof(DbTriggerParams)));
|
||||
|
||||
services.AddHttpClientService<GtxMessagingParams>(config.GetSection(nameof(GtxMessagingParams)));
|
||||
services.TryAddSingleton<ISmsSender, GTXSmsSender>();
|
||||
services.TryAddSingleton<IEnvelopeSmsHandler, EnvelopeSmsHandler>();
|
||||
services.TryAddSingleton<IAuthenticator, Authenticator>();
|
||||
services.TryAddSingleton<QRCodeGenerator>();
|
||||
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
|
||||
cfg.RegisterServicesFromAssembly(typeof(CreateEnvelopeReceiverCommandHandler).Assembly);
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ReadDocumentMappingProfile : Profile
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ReadDocumentMappingProfile()
|
||||
{
|
||||
CreateMap<EnvelopeDocument, ReadDocumentResponse>();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a query to read a document based on its unique identifier or associated envelope identifier.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the document. Optional.</param>
|
||||
/// <param name="EnvelopeId">The identifier of the envelope associated with the document. Optional.</param>
|
||||
public record ReadDocumentQuery(int? Id = null, int? EnvelopeId = null) : IRequest<ReadDocumentResponse?>
|
||||
{
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Handles queries for reading <see cref="EnvelopeDocument"/> data based on either the document ID or the envelope ID.
|
||||
/// </summary>
|
||||
public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, ReadDocumentResponse?>
|
||||
{
|
||||
/// <summary>
|
||||
/// Repository for accessing <see cref="EnvelopeDocument"/> entities.
|
||||
/// </summary>
|
||||
private readonly IRepository<EnvelopeDocument> _repo;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReadDocumentQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="envelopeDocumentRepository">The repository used to access <see cref="EnvelopeDocument"/> entities.</param>
|
||||
public ReadDocumentQueryHandler(IRepository<EnvelopeDocument> envelopeDocumentRepository)
|
||||
{
|
||||
_repo = envelopeDocumentRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the <see cref="ReadDocumentQuery"/> and returns a <see cref="ReadDocumentResponse"/> based on the provided identifiers.
|
||||
/// </summary>
|
||||
/// <param name="query">The query containing the document ID or envelope ID to search for.</param>
|
||||
/// <param name="cancellationToken">A token to monitor for cancellation requests.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="ReadDocumentResponse"/> if a matching document is found; otherwise, <c>null</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when neither <see cref="ReadDocumentQuery.Id"/> nor <see cref="ReadDocumentQuery.EnvelopeId"/> is provided.
|
||||
/// </exception>
|
||||
public async Task<ReadDocumentResponse?> Handle(ReadDocumentQuery query, CancellationToken cancellationToken)
|
||||
{
|
||||
if (query.Id is not null)
|
||||
return await _repo.ReadOrDefaultAsync<ReadDocumentResponse>(d => d.Id == query.Id);
|
||||
else if (query.EnvelopeId is not null)
|
||||
return await _repo.ReadOrDefaultAsync<ReadDocumentResponse>(d => d.EnvelopeId == query.EnvelopeId);
|
||||
|
||||
throw new InvalidOperationException(
|
||||
$"Invalid {nameof(ReadDocumentQuery)}: either {nameof(query.Id)} or {nameof(query.EnvelopeId)} must be provided.");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response for reading a document.
|
||||
/// </summary>
|
||||
public class ReadDocumentResponse : ReadDocumentResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The binary data of the document, if available.
|
||||
/// </summary>
|
||||
public byte[]? ByteData { get; init; }
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response for reading a document.
|
||||
/// </summary>
|
||||
public class ReadDocumentResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The unique identifier of the document.
|
||||
/// </summary>
|
||||
public int Guid { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The identifier of the associated envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The date and time when the document was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; init; }
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using EnvelopeGenerator.Common;
|
||||
using MediatR;
|
||||
|
||||
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.
|
||||
/// </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>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="orginal"></param>
|
||||
public ResetEmailTemplateCommand(EmailTemplateQuery? orginal = null) : base(orginal ?? new())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </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).
|
||||
public ResetEmailTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : base(Id, Type)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -1,114 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ResetEmailTemplateCommandHandler : IRequestHandler<ResetEmailTemplateCommand>
|
||||
{
|
||||
private readonly IRepository<EmailTemplate> _repository;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
public ResetEmailTemplateCommandHandler(IRepository<EmailTemplate> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Handle(ResetEmailTemplateCommand request, CancellationToken cancel)
|
||||
{
|
||||
var temps = request.Id is not null
|
||||
? await _repository.ReadAllAsync<EmailTemplateDto>(t => t.Id == request.Id, cancel)
|
||||
: request.Type is not null
|
||||
? await _repository.ReadAllAsync<EmailTemplateDto>(t => t.Name == request.Type.ToString(), cancel)
|
||||
: await _repository.ReadAllAsync<EmailTemplateDto>(ct: cancel);
|
||||
|
||||
foreach (var temp in temps)
|
||||
{
|
||||
var def = Defaults.Where(t => t.Name == temp.Name).FirstOrDefault();
|
||||
if(def is not null)
|
||||
await _repository.UpdateAsync(def, t => t.Id == temp.Id, cancel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly IEnumerable<EmailTemplateDto> Defaults = new List<EmailTemplateDto>()
|
||||
{
|
||||
new(){
|
||||
Id = 1,
|
||||
Name = "DocumentReceived",
|
||||
Body = "Guten Tag [NAME_RECEIVER],<br />\r\n<br /><B><I>\r\n[NAME_SENDER]</I></B> hat Ihnen ein Dokument zum [SIGNATURE_TYPE] gesendet.<br />\r\n<br />\r\nÜber den folgenden Link können Sie das Dokument einsehen und elektronisch unterschreiben: <a href=\"[LINK_TO_DOCUMENT]\">[LINK_TO_DOCUMENT_TEXT]</a><br />\r\n<br />\r\n[MESSAGE]<br />\r\n<br />\r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "Dokument erhalten: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 2,
|
||||
Name = "DocumentDeleted",
|
||||
Body = "Guten Tag [NAME_RECEIVER],<br />\r\n<br /><B><I>\r\n[NAME_SENDER]</I></B> hat den Umschlag <B><I>'[DOCUMENT_TITLE]'</I></B> gelöscht/zurückgezogen.<br /><p>\rBegründung: <br /> <I>[REASON]</I> <p>\r\n<br />\r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "Umschlag zurückgezogen: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 3,
|
||||
Name = "DocumentSigned",
|
||||
Body = "Guten Tag [NAME_RECEIVER],<br />\r\n<br />\r\nhiermit bestätigen wir Ihnen die erfolgreiche Signatur für den Vorgang <B><I>'[DOCUMENT_TITLE]'</I></B>.<br />\r\nWenn alle Vertragspartner unterzeichnet haben, erhalten Sie ebenfalls per email ein unterschriebenes Exemplar mit dem Signierungszertifikat!\r\n<br />\r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "Dokument unterschrieben: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 4,
|
||||
Name = "DocumentCompleted",
|
||||
Body = "Guten Tag [NAME_RECEIVER],<br />\r\n<br />\r\nDer Signaturvorgang <B><I>'[DOCUMENT_TITLE]'</I></B> wurde erfolgreich abgeschlossen.<br />\r\n<br />\r\nSie erhalten das Dokument mit einem detaillierten Ergebnisbericht als Anhang zu dieser Email.<br />\r\n<br />\r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "Umschlag abgeschlossen: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 5,
|
||||
Name = "DocumentAccessCodeReceived",
|
||||
Body = "Guten Tag [NAME_RECEIVER],<br />\r\n<br /><B><I>\r\n[NAME_SENDER]</I></B> hat Ihnen ein Dokument zum [SIGNATURE_TYPE] gesendet. <br />\r\n<br />\r\nVerwenden Sie den folgenden Zugriffscode, um das Dokument einzusehen:<br />\r\n<br />\r\n[DOCUMENT_ACCESS_CODE]<br />\r\n<br />\r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "Zugriffscode für Dokument erhalten: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 6,
|
||||
Name = "DocumentRejected_ADM",
|
||||
Body = "Guten Tag [NAME_SENDER],<p><B><I>[NAME_RECEIVER]</I></B> hat den Umschlag <B><I>'[DOCUMENT_TITLE]'</I></B> mit folgendem Grund abgelehnt: <p>\r\n[REASON] \r\n<p>Der Umschlag wurde auf den Status Rejected gesetzt. <p> \r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "'[DOCUMENT_TITLE]' - Unterzeichnungsvorgang zurückgezogen"
|
||||
},
|
||||
new(){
|
||||
Id = 9,
|
||||
Name = "DocumentRejected_REC",
|
||||
Body = "Guten Tag [NAME_RECEIVER],\r\n<p>Hiermit bestätigen wir Ihnen die Ablehnung des Unterzeichnungsvorganges <B><I>'[DOCUMENT_TITLE]'</I></B>!<p>Der Vertragsinhaber <B><I>[NAME_SENDER]</I></B> wurde über die Ablehnung informiert. <p> \r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "'[DOCUMENT_TITLE]' - Bestätigung Ablehnung"
|
||||
},
|
||||
new(){
|
||||
Id = 10,
|
||||
Name = "DocumentRejected_REC_2",
|
||||
Body = "Guten Tag [NAME_RECEIVER],\r\n<p>Der Unterzeichnungsvorganges <B><I>'[DOCUMENT_TITLE]'</I></B> wurde durch einen anderen Vertragspartner abgelehnt! Ihre notwendige Unterzeichnung wurde verworfen.<p> Der Vertragsinhaber <B><I>[NAME_SENDER]</I></B> wird sich bei Bedarf mit Ihnen in Verbindung setzen. <p> \r\nMit freundlichen Grüßen<br />\r\n<br />\r\n[NAME_PORTAL]",
|
||||
Subject = "'[DOCUMENT_TITLE]' - Unterzeichnungsvorgang abgelehnt."
|
||||
},
|
||||
new(){
|
||||
Id = 11,
|
||||
Name = "DocumentShared",
|
||||
Body = "Guten Tag,<br /> <br /><B><I> [NAME_RECEIVER]</I></B> hat Ihnen ein Dokument zum Ansehen gesendet.<br /> <br /> Über den folgenden Link können Sie das Dokument einsehen: <a href=\"[LINK_TO_DOCUMENT]\">[LINK_TO_DOCUMENT_TEXT]</a><br /> <br /> <br /> Mit freundlichen Grüßen<br /> <br /> [NAME_PORTAL]",
|
||||
Subject = "Dokument geteilt: '[DOCUMENT_TITLE]'"
|
||||
},
|
||||
new(){
|
||||
Id = 12,
|
||||
Name = "TotpSecret",
|
||||
Body = "Guten Tag,<br /> <br />Sie können auf Ihren Zwei-Faktor-Authentifizierungscode zugreifen, indem Sie den unten stehenden QR-Code mit einer beliebigen Authentifizierungs-App auf Ihrem Telefon scannen (Google Authenticator, Microsoft Authenticator usw.). Dieser Code ist bis zum [TFA_EXPIRATION] gültig.<br /> <br /> <img src=\"data:image/png;base64,[TFA_QR_CODE]\" style=\"width: 13rem; height: 13rem;\"><br /> <br />\r\n<br /> Mit freundlichen Grüßen<br /> <br /> [NAME_PORTAL]",
|
||||
Subject = "2-Faktor-Verifizierung QR-Code"
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using MediatR;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Update;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Befehl zum Aktualisieren einer E-Mail-Vorlage.
|
||||
/// </summary>
|
||||
/// <param name="Body">
|
||||
/// (Optional)Der neue Inhalt des E-Mail-Textkörpers. Wenn null, bleibt der vorhandene Inhalt unverändert.
|
||||
/// </param>
|
||||
/// <param name="Subject">
|
||||
/// (Optional) Der neue Betreff der E-Mail. Wenn null, bleibt der vorhandene Betreff unverändert.
|
||||
/// </param>
|
||||
public record UpdateEmailTemplateCommand(string? Body = null, string? Subject = null) : IRequest
|
||||
{
|
||||
/// <param>
|
||||
/// Die Abfrage, die die E-Mail-Vorlage darstellt, die aktualisiert werden soll.
|
||||
/// </param>
|
||||
[JsonIgnore]
|
||||
public EmailTemplateQuery? EmailTemplateQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DateTime ChangedWhen { get; init; } = DateTime.Now;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.Exceptions;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Update;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class UpdateEmailTemplateCommandHandler : IRequestHandler<UpdateEmailTemplateCommand>
|
||||
{
|
||||
private readonly IRepository<EmailTemplate> _repository;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
public UpdateEmailTemplateCommandHandler(IRepository<EmailTemplate> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
/// <exception cref="NotFoundException"></exception>
|
||||
public async Task Handle(UpdateEmailTemplateCommand request, CancellationToken cancel)
|
||||
{
|
||||
EmailTemplateDto? temp;
|
||||
|
||||
if (request.EmailTemplateQuery?.Id is int id)
|
||||
{
|
||||
temp = await _repository.ReadOrDefaultAsync<EmailTemplateDto>(t => t.Id == id, single: false, cancel);
|
||||
}
|
||||
else if (request!.EmailTemplateQuery!.Type is Common.Constants.EmailTemplateType type)
|
||||
{
|
||||
temp = await _repository.ReadOrDefaultAsync<EmailTemplateDto>(t => t.Name == type.ToString(), single: false, cancel);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Both id and type is null. Id: " + request.EmailTemplateQuery.Id +". Type: " + request.EmailTemplateQuery.Type.ToString());
|
||||
}
|
||||
|
||||
if (temp == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (request.Body is not null)
|
||||
temp.Body = request.Body;
|
||||
|
||||
if (request.Subject is not null)
|
||||
temp.Subject = request.Subject;
|
||||
|
||||
await _repository.UpdateAsync(temp, t => t.Id == temp.Id, cancel);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using EnvelopeGenerator.Common;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates;
|
||||
|
||||
/// <summary>
|
||||
/// Repräsentiert eine Abfrage für E-Mail-Vorlagen, die für Absender und Empfänger von Umschlägen verwendet werden.
|
||||
/// Die Standardkultur ist "de-DE".
|
||||
/// </summary>
|
||||
/// <param name="Id">Die eindeutige Kennung der E-Mail-Vorlage (optional).</param>
|
||||
/// <param name="Type">Der Typ der E-Mail-Vorlage, z. B. <see cref="Constants.EmailTemplateType"/> (optional). 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 EmailTemplateQuery(int? Id = null, Constants.EmailTemplateType? Type = null)
|
||||
{
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ReadEmailTemplateMappingProfile : Profile
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ReadEmailTemplateMappingProfile()
|
||||
{
|
||||
CreateMap<EmailTemplate, ReadEmailTemplateResponse>();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Abfrage dar, um eine E-Mail-Vorlage zu lesen.
|
||||
/// Diese Klasse erbt von <see cref="EmailTemplateQuery"/>.
|
||||
/// </summary>
|
||||
public record ReadEmailTemplateQuery : EmailTemplateQuery, IRequest<ReadEmailTemplateResponse?>
|
||||
{
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Common;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQuery, ReadEmailTemplateResponse?>
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
private readonly IEmailTemplateRepository _repository;
|
||||
|
||||
/// <summary>
|
||||
/// Initialisiert eine neue Instanz der <see cref="EmailTemplateController"/>-Klasse.
|
||||
/// </summary>
|
||||
/// <param name="mapper">
|
||||
/// <param name="repository">
|
||||
/// Die AutoMapper-Instanz, die zum Zuordnen von Objekten verwendet wird.
|
||||
/// </param>
|
||||
public ReadEmailTemplateQueryHandler(IMapper mapper, IEmailTemplateRepository repository)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public async Task<ReadEmailTemplateResponse?> Handle(ReadEmailTemplateQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var temp = request.Id is int id
|
||||
? await _repository.ReadByIdAsync(id)
|
||||
: request.Type is Constants.EmailTemplateType type
|
||||
? await _repository.ReadByNameAsync(type)
|
||||
: throw new InvalidOperationException("Either a valid integer ID or a valid EmailTemplateType must be provided in the request.");
|
||||
|
||||
var res = _mapper.Map<ReadEmailTemplateResponse>(temp);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt die Antwort für eine Abfrage von E-Mail-Vorlagen bereit.
|
||||
/// </summary>
|
||||
public class ReadEmailTemplateResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Die eindeutige Kennung der E-Mail-Vorlage.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name des Typs
|
||||
/// </summary>
|
||||
public required string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Das Datum und die Uhrzeit, wann die Vorlage hinzugefügt wurde.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Der Inhalt (Body) der E-Mail-Vorlage. Kann null sein.
|
||||
/// </summary>
|
||||
public string? Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Der Betreff der E-Mail-Vorlage. Kann null sein.
|
||||
/// </summary>
|
||||
public string? Subject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Das Datum und die Uhrzeit, wann die Vorlage zuletzt geändert wurde. Kann null sein.
|
||||
/// </summary>
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user