Compare commits
240 Commits
ee49538f1e
...
bugfix/sig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c57b7e332 | ||
|
|
4bf91df85f | ||
|
|
50796b22d9 | ||
|
|
2974ddb985 | ||
|
|
54f39103e1 | ||
|
|
8b505ae39a | ||
|
|
d75da655d2 | ||
|
|
e72ea534e5 | ||
|
|
e95d1d782e | ||
|
|
32be5077f9 | ||
|
|
d80fa0b023 | ||
|
|
ea6ee11a4e | ||
|
|
13a87f29d9 | ||
|
|
5f8df74b9d | ||
|
|
ebb248969c | ||
|
|
4040741e6f | ||
|
|
4077786ef7 | ||
|
|
ba8394c749 | ||
|
|
97dcc0f0a1 | ||
|
|
8785505a91 | ||
|
|
975beff416 | ||
|
|
45d39069aa | ||
|
|
d3db1e74fa | ||
|
|
4d34eb7adc | ||
|
|
ba4a57512f | ||
|
|
11f4896556 | ||
|
|
44aeb53413 | ||
|
|
d56aa1a778 | ||
|
|
a012396dd4 | ||
|
|
42a1016607 | ||
|
|
4b616896f8 | ||
|
|
54c17f106e | ||
|
|
e171b50868 | ||
|
|
a20c2b556f | ||
|
|
a070a0f64c | ||
|
|
c0608b457c | ||
|
|
927b89554d | ||
|
|
160005e230 | ||
|
|
2848425625 | ||
|
|
c61b497ef2 | ||
|
|
1ece216a27 | ||
|
|
8f6847c060 | ||
|
|
0dc65a53b5 | ||
|
|
7b75a373bd | ||
|
|
fe252b9979 | ||
|
|
f17820e011 | ||
|
|
a21c993cb5 | ||
|
|
dd4afc5ddf | ||
|
|
c220b9e1c8 | ||
|
|
778a498e00 | ||
|
|
48240f2f30 | ||
|
|
e3dfa8dd39 | ||
|
|
6e641395d5 | ||
|
|
fbd09cb570 | ||
|
|
7389909d77 | ||
|
|
ded88383b3 | ||
|
|
1b9b51fbd2 | ||
|
|
afa6dda16f | ||
|
|
994c844f25 | ||
|
|
4551e5dc64 | ||
|
|
ff34e6afab | ||
|
|
a78912260a | ||
|
|
c1e81c546f | ||
|
|
9a950ae37d | ||
|
|
6cec82abd5 | ||
|
|
26616b4cab | ||
|
|
178ec9226d | ||
|
|
0147f525fa | ||
|
|
f0ed6137d1 | ||
|
|
b4ab2c4423 | ||
|
|
5715343651 | ||
|
|
6550be0235 | ||
|
|
99b0dba79f | ||
|
|
2f8d5f1fc8 | ||
|
|
6969f5f93e | ||
|
|
7bbed3890e | ||
|
|
98290c7b28 | ||
|
|
d55006fdda | ||
|
|
b2cc0cb65a | ||
|
|
049827a133 | ||
|
|
b8e4dfdf26 | ||
|
|
8a9d5f92f3 | ||
|
|
b02ab585cb | ||
|
|
c8a5a8627d | ||
|
|
ecf0771f9e | ||
|
|
02c7040b39 | ||
|
|
2cb5d0c0d5 | ||
|
|
9f186afdff | ||
|
|
ec76014ce7 | ||
|
|
e7bc43b339 | ||
|
|
26be8d4565 | ||
|
|
17902c4824 | ||
|
|
115cb86968 | ||
|
|
4a898e40ac | ||
|
|
bdc0286253 | ||
|
|
8bdc305b82 | ||
|
|
396c6014fb | ||
|
|
06175b0c95 | ||
|
|
5375d89d5b | ||
|
|
abd1807b18 | ||
|
|
3f33be452c | ||
|
|
7481691b4e | ||
|
|
0d635830f9 | ||
|
|
9b72a7b472 | ||
|
|
9a4931781a | ||
|
|
b3a2e1559a | ||
|
|
261d1b3db9 | ||
|
|
401d03aac2 | ||
|
|
7871bf72f6 | ||
|
|
7e07afa384 | ||
|
|
251420134a | ||
|
|
701b26289b | ||
|
|
754e3ddc7a | ||
|
|
a0e8cc6989 | ||
|
|
b9f25a0ac4 | ||
|
|
f40ee49977 | ||
|
|
d08e93cbef | ||
|
|
4a48bbb3e2 | ||
|
|
9725e2a729 | ||
|
|
031f0d4cce | ||
|
|
ea09edbc7f | ||
|
|
bd150bf0c0 | ||
|
|
4a53e24618 | ||
|
|
7c969c8950 | ||
|
|
77831592f9 | ||
|
|
55290c93e7 | ||
|
|
77713997bf | ||
|
|
8824bfef00 | ||
|
|
cc6b4e63a9 | ||
|
|
99f7a5ee43 | ||
|
|
b566785668 | ||
|
|
0e0f3f412d | ||
|
|
f8920a573b | ||
|
|
cc07a65f09 | ||
|
|
fbba7f2bfc | ||
|
|
ba392eb128 | ||
|
|
e4906ad9be | ||
|
|
98773eb888 | ||
|
|
943481da80 | ||
|
|
b5579a68cd | ||
|
|
fb069d0ee2 | ||
|
|
559c4b6340 | ||
|
|
891436ceef | ||
|
|
88777e0c27 | ||
|
|
7eb8ae6697 | ||
|
|
deda2480b0 | ||
|
|
269be5109c | ||
|
|
3b40a889a3 | ||
|
|
5b60326fbe | ||
|
|
6083eea496 | ||
|
|
88c2721ba5 | ||
|
|
db5a2a8640 | ||
|
|
fb0022bd2c | ||
|
|
c45e6875d0 | ||
|
|
0f855158c3 | ||
|
|
e9cb49c6a7 | ||
|
|
9ae1efb946 | ||
|
|
eef6bf27f1 | ||
|
|
2dfe508552 | ||
|
|
a7b980bd28 | ||
|
|
2d7c0a292b | ||
|
|
91f1296e9b | ||
|
|
80e1e7dcf3 | ||
|
|
eb024acfa7 | ||
|
|
210ce072f8 | ||
|
|
036e1f68a8 | ||
|
|
0b87a3746a | ||
|
|
db84abf0e7 | ||
|
|
14be46d3d6 | ||
|
|
78b5e3f5cc | ||
|
|
093e64de81 | ||
|
|
43db4e275b | ||
|
|
353f7698f4 | ||
|
|
d5b4ea46d3 | ||
|
|
b6563d71b0 | ||
|
|
8a6a11c1bc | ||
|
|
cbd71aa2b9 | ||
|
|
df019a7243 | ||
|
|
6c222ca9ad | ||
|
|
53c64ef83e | ||
|
|
3ac0cbeaae | ||
|
|
b471c469b5 | ||
|
|
31a1c0e3a8 | ||
|
|
08dd6a9aa7 | ||
|
|
b6e15dbf03 | ||
|
|
146dd2e9d3 | ||
|
|
2cca1b6d4d | ||
|
|
ddc96b96e7 | ||
|
|
fa70360c9e | ||
|
|
da3c7bc0c2 | ||
|
|
0692922f12 | ||
|
|
e15e27db16 | ||
|
|
ac279148ba | ||
|
|
ab5fdbd41e | ||
|
|
0b93f96a20 | ||
|
|
1a8d3c2e76 | ||
|
|
43019e6710 | ||
|
|
2f634f18bd | ||
|
|
41b5b62f2c | ||
|
|
1e34042f77 | ||
|
|
54e3eed557 | ||
|
|
934414c3b6 | ||
|
|
f9c34ef8fd | ||
|
|
4615205aa5 | ||
|
|
a5a8a9e416 | ||
|
|
255843d760 | ||
|
|
121f0568ad | ||
|
|
5d95f2f221 | ||
|
|
3d5053d177 | ||
|
|
b79bc2e418 | ||
|
|
b4154b60a7 | ||
|
|
0090fc0dfa | ||
|
|
6eac92b7cb | ||
|
|
1b1edca23c | ||
|
|
57ea9e01f8 | ||
|
|
1a99041c60 | ||
|
|
56c735890d | ||
|
|
3688373481 | ||
|
|
b8fbeee322 | ||
|
|
57e4dfb3fb | ||
|
|
afc8d3baf0 | ||
|
|
51d77367ca | ||
|
|
614f3768d9 | ||
|
|
5f780f8d1e | ||
|
|
20825aa3ea | ||
|
|
c5b508d274 | ||
|
|
4eec4451b2 | ||
|
|
ca4718e159 | ||
|
|
33fcb5b70e | ||
|
|
82d8521a25 | ||
|
|
2f9d07312b | ||
|
|
fa36593b26 | ||
|
|
9cdb1409c0 | ||
|
|
95785e8c8b | ||
|
|
6d6e62c8d0 | ||
|
|
1720e137f9 | ||
|
|
3e6e2078bb | ||
|
|
6b0ec9386c | ||
|
|
c63f369bd6 | ||
|
|
c50e16d74f |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -363,3 +363,5 @@ MigrationBackup/
|
|||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
/EnvelopeGenerator.Web/.config/dotnet-tools.json
|
/EnvelopeGenerator.Web/.config/dotnet-tools.json
|
||||||
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
||||||
|
/EnvelopeGenerator.Tests.Application/Services/BugFixTests.cs
|
||||||
|
/EnvelopeGenerator.Tests.Application/annotations.json
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Configurations;
|
||||||
|
|
||||||
|
public class DbTriggerParams : Dictionary<string, IEnumerable<string>>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using OtpNet;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
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,17 +0,0 @@
|
|||||||
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IDocumentReceiverElementService : IBasicCRUDService<DocumentReceiverElementDto, DocumentReceiverElement, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IDocumentStatusService : IBasicCRUDService<DocumentStatusDto, DocumentStatus, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +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
|
|
||||||
{
|
|
||||||
public interface IEmailTemplateService : IBasicCRUDService<EmailTemplateDto, EmailTemplate, int>
|
|
||||||
{
|
|
||||||
Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IEnvelopeCertificateService : IBasicCRUDService<EnvelopeCertificateDto, EnvelopeCertificate, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IEnvelopeDocumentService : IBasicCRUDService<EnvelopeDocumentDto, EnvelopeDocument, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +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
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +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
|
|
||||||
{
|
|
||||||
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,10 +0,0 @@
|
|||||||
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>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
|
||||||
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, 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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
Task<DataResult<SmsResponse>> SendSmsAsync(string envelopeReceiverId, string message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
{
|
|
||||||
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,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +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
|
|
||||||
{
|
|
||||||
public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverReadDto, ReceiverUpdateDto, 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,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts
|
|
||||||
{
|
|
||||||
public interface IUserReceiverService : IBasicCRUDService<UserReceiverDto, UserReceiver, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IConfigRepository : ICRUDRepository<Config, int>
|
||||||
|
{
|
||||||
|
Task<Config?> ReadFirstAsync();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IDocumentReceiverElementRepository : ICRUDRepository<DocumentReceiverElement, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IDocumentStatusRepository : ICRUDRepository<DocumentStatus, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IEnvelopeCertificateRepository : ICRUDRepository<EnvelopeCertificate, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IEnvelopeDocumentRepository : ICRUDRepository<EnvelopeDocument, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IEnvelopeReceiverReadOnlyRepository : ICRUDRepository<EnvelopeReceiverReadOnly, long>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
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?> ReadLastByReceiver(string email);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeType, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IUserReceiverRepository : ICRUDRepository<UserReceiver, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -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.Services;
|
||||||
|
|
||||||
|
public interface IConfigService : IReadService<ConfigDto, Config, int>
|
||||||
|
{
|
||||||
|
Task<DataResult<ConfigDto>> ReadFirstAsync();
|
||||||
|
|
||||||
|
Task<ConfigDto> ReadDefaultAsync();
|
||||||
|
|
||||||
|
Task<string> ReadDefaultSignatureHost();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using CommandDotNet;
|
||||||
|
using DigitalData.Core.Abstractions.Application;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
|
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||||
|
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||||
|
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, params int[] ignore_statuses);
|
||||||
|
|
||||||
|
Task<DataResult<string?>> ReadLastUsedReceiverNameByMail(string mail);
|
||||||
|
|
||||||
|
Task<DataResult<SmsResponse>> SendSmsAsync(string envelopeReceiverId, string message);
|
||||||
|
Task<DataResult<IEnumerable<EnvelopeReceiverSecretDto>>> ReadWithSecretByUuidAsync(string uuid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
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,7 +1,7 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts;
|
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
|
||||||
public interface IEnvelopeSmsHandler
|
public interface IEnvelopeSmsHandler
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
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,6 +1,6 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
using EnvelopeGenerator.Application.DTOs.Messaging;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts;
|
namespace EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
|
||||||
//TODO: move to DigitalData.Core
|
//TODO: move to DigitalData.Core
|
||||||
public interface ISmsSender
|
public interface ISmsSender
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record ConfigDto(
|
public record ConfigDto(
|
||||||
string DocumentPath,
|
string DocumentPath,
|
||||||
int SendingProfile,
|
int SendingProfile,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record DocumentReceiverElementDto(
|
public record DocumentReceiverElementDto(
|
||||||
int Id,
|
int Id,
|
||||||
int DocumentId,
|
int DocumentId,
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record DocumentStatusDto(
|
public record DocumentStatusDto(
|
||||||
int Id,
|
int Id,
|
||||||
int EnvelopeId,
|
int EnvelopeId,
|
||||||
int ReceiverId,
|
int ReceiverId,
|
||||||
int Status,
|
int Status,
|
||||||
DateTime? StatusChangedWhen,
|
DateTime? StatusChangedWhen,
|
||||||
string Value,
|
|
||||||
DateTime AddedWhen,
|
DateTime AddedWhen,
|
||||||
DateTime? ChangedWhen) : IUnique<int>;
|
DateTime? ChangedWhen) : IUnique<int>
|
||||||
|
{
|
||||||
|
public string? Value { get; set; }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EmailTemplateDto(
|
public record EmailTemplateDto(
|
||||||
int Id,
|
int Id,
|
||||||
string Name,
|
string Name,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeCertificateDto(
|
public record EnvelopeCertificateDto(
|
||||||
int Id,
|
int Id,
|
||||||
int EnvelopeId,
|
int EnvelopeId,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeDocumentDto
|
public record EnvelopeDocumentDto
|
||||||
(
|
(
|
||||||
int Id,
|
int Id,
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeDto() : IUnique<int>
|
public record EnvelopeDto() : IUnique<int>
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeHistoryCreateDto(
|
public record EnvelopeHistoryCreateDto(
|
||||||
int EnvelopeId,
|
int EnvelopeId,
|
||||||
string UserReference,
|
string UserReference,
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using static EnvelopeGenerator.Common.Constants;
|
using static EnvelopeGenerator.Common.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeHistoryDto(
|
public record EnvelopeHistoryDto(
|
||||||
long Id,
|
long Id,
|
||||||
int EnvelopeId,
|
int EnvelopeId,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
|
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
|
||||||
{
|
{
|
||||||
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
|
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
|
||||||
{
|
{
|
||||||
public EnvelopeDto? Envelope { get; set; }
|
public EnvelopeDto? Envelope { get; set; }
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
|
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
|
||||||
{
|
{
|
||||||
public string? AccessCode { get; init; }
|
public string? AccessCode { get; init; }
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverReadOnlyCreateDto(
|
public record EnvelopeReceiverReadOnlyCreateDto(
|
||||||
DateTime DateValid)
|
DateTime DateValid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverReadOnlyDto(
|
public record EnvelopeReceiverReadOnlyDto(
|
||||||
long Id,
|
long Id,
|
||||||
long EnvelopeId,
|
long EnvelopeId,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeReceiverReadOnlyUpdateDto(
|
public record EnvelopeReceiverReadOnlyUpdateDto(
|
||||||
long Id,
|
long Id,
|
||||||
DateTime DateValid,
|
DateTime DateValid,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EnvelopeTypeDto(
|
public record EnvelopeTypeDto(
|
||||||
int Id,
|
int Id,
|
||||||
string Title,
|
string Title,
|
||||||
|
|||||||
70
EnvelopeGenerator.Application/DTOs/MappingProfile.cs
Normal file
70
EnvelopeGenerator.Application/DTOs/MappingProfile.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
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,4 +1,7 @@
|
|||||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public class GtxMessagingResponse : Dictionary<string, object?> { }
|
public class GtxMessagingResponse : Dictionary<string, object?> { }
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record SmsResponse
|
public record SmsResponse
|
||||||
{
|
{
|
||||||
public required bool Ok { get; init; }
|
public required bool Ok { get; init; }
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||||
{
|
{
|
||||||
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null, DateTime? TotpExpiration = null)
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null)
|
||||||
{
|
{
|
||||||
public string Signature => sha256HexOfMail.Value;
|
public string Signature => sha256HexOfMail.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record ReceiverReadDto(
|
public record ReceiverReadDto(
|
||||||
int Id,
|
int Id,
|
||||||
string EmailAddress,
|
string EmailAddress,
|
||||||
@@ -20,8 +22,5 @@ public record ReceiverReadDto(
|
|||||||
|
|
||||||
public string? TotpSecretkey { get; set; } = null;
|
public string? TotpSecretkey { get; set; } = null;
|
||||||
|
|
||||||
[TemplatePlaceholder("[TFA_QR_EXPIRATION]")]
|
|
||||||
public DateTime? TotpExpiration { get; set; } = null;
|
|
||||||
|
|
||||||
public DateTime? TfaRegDeadline { get; set; }
|
public DateTime? TfaRegDeadline { get; set; }
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||||
|
|
||||||
public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TotpExpiration = null, DateTime? TfaRegDeadline = null) : IUnique<int>;
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TfaRegDeadline = null) : IUnique<int>;
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using DigitalData.Core.Abstractions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.DTOs
|
||||||
{
|
{
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record UserReceiverDto(
|
public record UserReceiverDto(
|
||||||
int Id,
|
int Id,
|
||||||
int UserId,
|
int UserId,
|
||||||
|
|||||||
65
EnvelopeGenerator.Application/DependencyInjection.cs
Normal file
65
EnvelopeGenerator.Application/DependencyInjection.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
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());
|
||||||
|
});
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
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>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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?>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Documents.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the response for reading a document.
|
||||||
|
/// </summary>
|
||||||
|
public class ReadDocumentResponse
|
||||||
|
{
|
||||||
|
/// <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; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The binary data of the document, if available.
|
||||||
|
/// </summary>
|
||||||
|
public byte[]? ByteData { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using EnvelopeGenerator.Common;
|
||||||
|
|
||||||
|
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>
|
||||||
|
/// <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). 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 ResetEnvelopeTemplateCommand(int? Id, Constants.EmailTemplateType? Type) : EmailTemplateQuery(Id, Type);
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
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)
|
||||||
|
{
|
||||||
|
/// <param>
|
||||||
|
/// Die Abfrage, die die E-Mail-Vorlage darstellt, die aktualisiert werden soll.
|
||||||
|
/// </param>
|
||||||
|
[JsonIgnore]
|
||||||
|
public EmailTemplateQuery? EmailTemplateQuery { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
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
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.EmailTemplates.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt die Antwort für eine Abfrage von E-Mail-Vorlagen bereit.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Id">Die eindeutige Kennung der E-Mail-Vorlage.</param>
|
||||||
|
/// <param name="Type">Der Typ der E-Mail-Vorlage.</param>
|
||||||
|
/// <param name="AddedWhen">Das Datum und die Uhrzeit, wann die Vorlage hinzugefügt wurde.</param>
|
||||||
|
/// <param name="Body">Der Inhalt (Body) der E-Mail-Vorlage. Kann null sein.</param>
|
||||||
|
/// <param name="Subject">Der Betreff der E-Mail-Vorlage. Kann null sein.</param>
|
||||||
|
/// <param name="ChangedWhen">Das Datum und die Uhrzeit, wann die Vorlage zuletzt geändert wurde. Kann null sein.</param>
|
||||||
|
public record ReadEmailTemplateResponse(
|
||||||
|
int Id,
|
||||||
|
int Type,
|
||||||
|
DateTime AddedWhen,
|
||||||
|
string? Body = null,
|
||||||
|
string? Subject = null,
|
||||||
|
DateTime? ChangedWhen = null)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -11,23 +13,23 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.4.3" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="2.2.1" />
|
<PackageReference Include="DigitalData.Core.Application" Version="3.2.1" />
|
||||||
<PackageReference Include="DigitalData.Core.Application" Version="2.0.0" />
|
|
||||||
<PackageReference Include="DigitalData.Core.Client" Version="2.0.3" />
|
<PackageReference Include="DigitalData.Core.Client" Version="2.0.3" />
|
||||||
<PackageReference Include="DigitalData.Core.DTO" Version="2.0.0" />
|
<PackageReference Include="DigitalData.Core.DTO" Version="2.0.1" />
|
||||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher" Version="2.0.0" />
|
<PackageReference Include="DigitalData.EmailProfilerDispatcher" Version="3.0.0" />
|
||||||
|
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.18" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.18" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||||
<PackageReference Include="Otp.NET" Version="1.4.0" />
|
<PackageReference Include="Otp.NET" Version="1.4.0" />
|
||||||
<PackageReference Include="QRCoder" Version="1.6.0" />
|
<PackageReference Include="QRCoder" Version="1.6.0" />
|
||||||
<PackageReference Include="QRCoder-ImageSharp" Version="0.10.0" />
|
<PackageReference Include="QRCoder-ImageSharp" Version="0.10.0" />
|
||||||
<PackageReference Include="UserManager.Application" Version="2.0.0" />
|
<PackageReference Include="UserManager" Version="1.0.0" />
|
||||||
<PackageReference Include="UserManager.Infrastructure" Version="2.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\EnvelopeGenerator.Domain\EnvelopeGenerator.Domain.csproj" />
|
||||||
<ProjectReference Include="..\EnvelopeGenerator.Extensions\EnvelopeGenerator.Extensions.csproj" />
|
<ProjectReference Include="..\EnvelopeGenerator.Extensions\EnvelopeGenerator.Extensions.csproj" />
|
||||||
<ProjectReference Include="..\EnvelopeGenerator.Infrastructure\EnvelopeGenerator.Infrastructure.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -57,4 +59,25 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||||
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
|
<PackageReference Include="CommandDotNet">
|
||||||
|
<Version>7.0.5</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||||
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
|
<PackageReference Include="CommandDotNet">
|
||||||
|
<Version>8.1.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||||
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
|
<PackageReference Include="CommandDotNet">
|
||||||
|
<Version>8.1.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using MediatR;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands.Create;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Befehl zur Erstellung eines Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Title">Der Titel des Umschlags. Dies ist ein Pflichtfeld.</param>
|
||||||
|
/// <param name="Message">Die Nachricht, die im Umschlag enthalten sein soll. Dies ist ein Pflichtfeld.</param>
|
||||||
|
/// <param name="Document">Das mit dem Umschlag verknüpfte Dokument. Dies ist ein Pflichtfeld.</param>
|
||||||
|
/// <param name="Receivers">Eine Sammlung von Empfängern, die den Umschlag erhalten. Dies ist ein Pflichtfeld.</param>
|
||||||
|
/// <param name="TFAEnabled">Gibt an, ob die Zwei-Faktor-Authentifizierung für den Umschlag aktiviert ist. Standardmäßig false.</param>
|
||||||
|
public record CreateEnvelopeReceiverCommand(
|
||||||
|
[Required] string Title,
|
||||||
|
[Required] string Message,
|
||||||
|
[Required] DocumentCreateCommand Document,
|
||||||
|
[Required] IEnumerable<ReceiverGetOrCreateCommand> Receivers,
|
||||||
|
bool TFAEnabled = false
|
||||||
|
) : IRequest;
|
||||||
|
|
||||||
|
#region DTOs
|
||||||
|
/// <summary>
|
||||||
|
/// Signaturposition auf einem Dokument.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="X">X-Position</param>
|
||||||
|
/// <param name="Y">Y-Position</param>
|
||||||
|
/// <param name="Page">Seite, auf der sie sich befindet</param>
|
||||||
|
public record Signature([Required] int X, [Required] int Y, [Required] int Page);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DTO für Empfänger, die erstellt oder abgerufen werden sollen.
|
||||||
|
/// Wenn nicht, wird sie erstellt und mit einer Signatur versehen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Signatures">Unterschriften auf Dokumenten.</param>
|
||||||
|
/// <param name="Salution">Der Name, mit dem der Empfänger angesprochen werden soll. Bei Null oder keinem Wert wird der zuletzt verwendete Name verwendet.</param>
|
||||||
|
/// <param name="PhoneNumber">Sollte mit Vorwahl geschrieben werden</param>
|
||||||
|
public record ReceiverGetOrCreateCommand([Required] IEnumerable<Signature> Signatures, string? Salution = null, string? PhoneNumber = null)
|
||||||
|
{
|
||||||
|
private string _emailAddress = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// E-Mail-Adresse des Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string EmailAddress { get => _emailAddress.ToLower(); init => _emailAddress = _emailAddress.ToLower(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DTO zum Erstellen eines Dokuments.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DataAsByte">
|
||||||
|
/// Die Dokumentdaten im Byte-Array-Format. Wird verwendet, wenn das Dokument als Roh-Binärdaten bereitgestellt wird.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="DataAsBase64">
|
||||||
|
/// Die Dokumentdaten im Base64-String-Format. Wird verwendet, wenn das Dokument als Base64-codierter String bereitgestellt wird.
|
||||||
|
/// </param>
|
||||||
|
public record DocumentCreateCommand(byte[]? DataAsByte = null, string? DataAsBase64 = null);
|
||||||
|
#endregion
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using EnvelopeGenerator.Application.Histories;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.EnvelopeReceivers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage für einen Envelope-Empfänger dar.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Status">Der Status der Abfrage, optional.</param>
|
||||||
|
public record EnvelopeReceiverQuery(EnvelopeStatusQuery? Status = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert den Status eines Umschlags und dessen Beziehung zum Empfänger. (vgl. auch <see cref="Common.Constants.EnvelopeStatus"/>
|
||||||
|
/// Invalid (0): Ungültiger Status.
|
||||||
|
/// EnvelopeCreated (1001): Der Umschlag wurde erstellt.
|
||||||
|
/// EnvelopeSaved (1002): Der Umschlag wurde gespeichert.
|
||||||
|
/// EnvelopeQueued (1003): Der Umschlag wurde zur Verarbeitung eingeplant.
|
||||||
|
/// EnvelopeSent (1004): Der Umschlag wurde versendet. (Nicht verwendet)
|
||||||
|
/// EnvelopePartlySigned (1005): Der Umschlag wurde teilweise unterschrieben.
|
||||||
|
/// EnvelopeCompletelySigned (1006): Der Umschlag wurde vollständig unterschrieben.
|
||||||
|
/// EnvelopeReportCreated (1007): Ein Abschlussbericht wurde für den Umschlag erstellt.
|
||||||
|
/// EnvelopeArchived (1008): Der Umschlag wurde archiviert.
|
||||||
|
/// EnvelopeDeleted (1009): Der Umschlag wurde gelöscht.
|
||||||
|
/// AccessCodeRequested (2001): Der Zugriffscode wurde angefordert.
|
||||||
|
/// AccessCodeCorrect (2002): Der Zugriffscode war korrekt.
|
||||||
|
/// AccessCodeIncorrect (2003): Der Zugriffscode war falsch.
|
||||||
|
/// DocumentOpened (2004): Das Dokument wurde geöffnet.
|
||||||
|
/// DocumentSigned (2005): Ein Dokument wurde unterschrieben.
|
||||||
|
/// SignatureConfirmed (2006): Die Signatur wurde bestätigt.
|
||||||
|
/// DocumentRejected (2007): Ein Dokument wurde abgelehnt.
|
||||||
|
/// EnvelopeShared (2008): Der Umschlag wurde geteilt.
|
||||||
|
/// EnvelopeViewed (2009): Der Umschlag wurde angesehen.
|
||||||
|
/// DocumentForwarded (4001): Das Dokument wurde weitergeleitet.
|
||||||
|
/// MessageInvitationSent (3001): Einladung wurde gesendet (vom Trigger verwendet).
|
||||||
|
/// MessageAccessCodeSent (3002): Zugriffscode wurde gesendet.
|
||||||
|
/// MessageConfirmationSent (3003): Bestätigungsnachricht wurde gesendet.
|
||||||
|
/// MessageDeletionSent (3004): Löschbenachrichtigung wurde gesendet.
|
||||||
|
/// MessageCompletionSent (3005): Abschlussbenachrichtigung wurde gesendet.
|
||||||
|
/// <param name="Min">Der minimale Statuswert, der berücksichtigt werden soll.</param>
|
||||||
|
/// <param name="Max">Der maximale Statuswert, der berücksichtigt werden soll.</param>
|
||||||
|
/// <param name="Ignore">Eine Liste von Statuswerten, die ignoriert werden sollen.</param>
|
||||||
|
/// </summary>
|
||||||
|
public record EnvelopeStatusQuery(
|
||||||
|
int? Min = null,
|
||||||
|
int? Max = null,
|
||||||
|
int[]? Ignore = null)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using EnvelopeGenerator.Application.Histories;
|
||||||
|
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||||
|
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
using MediatR;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage zum Lesen eines Envelope-Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Diese Abfrage kombiniert Informationen über einen Umschlag (<see cref="ReadEnvelopeQuery"/>)
|
||||||
|
/// und einen Empfänger (<see cref="ReadReceiverQuery"/>), um eine vollständige Antwort
|
||||||
|
/// (<see cref="ReadEnvelopeReceiverResponse"/>) zu generieren.
|
||||||
|
/// Die Antwort enthält Details wie den Status, die Zuordnung zwischen Umschlag und Empfänger
|
||||||
|
/// sowie zusätzliche Metadaten.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="Status">Umschlag oder Empfängerstatus.</param>
|
||||||
|
public record ReadEnvelopeReceiverQuery(EnvelopeStatusQuery? Status = null) : EnvelopeReceiverQuery(Status), IRequest<ReadEnvelopeReceiverResponse>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Der Umschlag, der mit dem Empfänger verknüpft ist.
|
||||||
|
/// </summary>
|
||||||
|
public ReadEnvelopeQuery? Envelope { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Der Empfänger, der mit dem Umschlag verknüpft ist.
|
||||||
|
/// </summary>
|
||||||
|
public ReadReceiverQuery? Receiver { get; init; }
|
||||||
|
};
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
|
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||||
|
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert die Antwort für das Lesen eines Envelope-Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Diese Klasse enthält Informationen über einen spezifischen Empfänger eines Umschlags (Envelope).
|
||||||
|
/// Sie verknüpft die Empfängerinformationen mit den zugehörigen Umschlagsdaten und bietet zusätzliche Metadaten.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="UserId">Die eindeutige Kennung des Benutzers, der den Empfänger erstellt hat.</param>
|
||||||
|
/// <param name="Status">Der Status des Empfängers als numerischer Wert.</param>
|
||||||
|
public record ReadEnvelopeReceiverResponse(int UserId, int Status)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die zusammengesetzte Kennung des Empfängers zurück, bestehend aus der Umschlags-ID und der Empfänger-ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Diese Eigenschaft kombiniert die eindeutige Kennung des Umschlags (EnvelopeId) und die des Empfängers (ReceiverId)
|
||||||
|
/// zu einer einzigen, leicht zugänglichen Struktur.
|
||||||
|
/// </remarks>
|
||||||
|
[NotMapped]
|
||||||
|
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die eindeutige Kennung des zugehörigen Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int EnvelopeId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die eindeutige Kennung des Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int ReceiverId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die Reihenfolge des Empfängers innerhalb des Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
public int Sequence { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Der Name des Empfängers. Kann als Platzhalter verwendet werden.
|
||||||
|
/// </summary>
|
||||||
|
[TemplatePlaceholder("[NAME_RECEIVER]")]
|
||||||
|
public string? Name { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die Berufsbezeichnung des Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
public string? JobTitle { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Der Firmenname des Empfängers.
|
||||||
|
/// </summary>
|
||||||
|
public string? CompanyName { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eine private Nachricht, die mit dem Empfänger verknüpft ist.
|
||||||
|
/// </summary>
|
||||||
|
public string? PrivateMessage { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Das Datum und die Uhrzeit, wann der Empfänger hinzugefügt wurde.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Das Datum und die Uhrzeit, wann der Empfänger zuletzt geändert wurde (falls vorhanden).
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt an, ob der Empfänger eine Telefonnummer hat.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasPhoneNumber { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die zugehörigen Umschlagsdaten.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required ReadEnvelopeResponse Envelope { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die Liste der Empfängerinformationen.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public IEnumerable<ReadReceiverResponse> Receiver { get; init; } = new List<ReadReceiverResponse>();
|
||||||
|
}
|
||||||
16
EnvelopeGenerator.Application/Envelopes/EnvelopeQuery.cs
Normal file
16
EnvelopeGenerator.Application/Envelopes/EnvelopeQuery.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using MediatR;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Envelopes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Id">Die eindeutige Kennung des Umschlags.</param>
|
||||||
|
/// <param name="Status">Der Status des Umschlags.</param>
|
||||||
|
/// <param name="Uuid">Die universell eindeutige Kennung des Umschlags.</param>
|
||||||
|
public record EnvelopeQuery(
|
||||||
|
int? Id = null,
|
||||||
|
int? Status = null,
|
||||||
|
string? Uuid = null) : IRequest
|
||||||
|
{
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage zum Lesen von Briefumschlägen dar.
|
||||||
|
/// </summary>
|
||||||
|
public record ReadEnvelopeQuery : EnvelopeQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using EnvelopeGenerator.Common;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert die Antwort für das Lesen eines Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Id">Die eindeutige Kennung des Umschlags.</param>
|
||||||
|
/// <param name="UserId">Die Kennung des Benutzers, der den Umschlag erstellt hat.</param>
|
||||||
|
/// <param name="Status">Der Status des Umschlags als numerischer Wert.</param>
|
||||||
|
/// <param name="Uuid">Die universelle eindeutige Kennung (UUID) des Umschlags.</param>
|
||||||
|
/// <param name="Message">Eine optionale Nachricht, die mit dem Umschlag verknüpft ist.</param>
|
||||||
|
/// <param name="AddedWhen">Das Datum und die Uhrzeit, wann der Umschlag hinzugefügt wurde.</param>
|
||||||
|
/// <param name="ChangedWhen">Das Datum und die Uhrzeit, wann der Umschlag zuletzt geändert wurde (falls vorhanden).</param>
|
||||||
|
/// <param name="Title">Ein optionaler Titel des Umschlags.</param>
|
||||||
|
/// <param name="Language">Die Sprache, die mit dem Umschlag verknüpft ist.</param>
|
||||||
|
/// <param name="TFAEnabled">Gibt an, ob die Zwei-Faktor-Authentifizierung (TFA) aktiviert ist.</param>
|
||||||
|
/// <param name="User">Das Benutzerobjekt, das mit dem Umschlag verknüpft ist.</param>
|
||||||
|
public record ReadEnvelopeResponse(
|
||||||
|
int Id,
|
||||||
|
int UserId,
|
||||||
|
int Status,
|
||||||
|
string Uuid,
|
||||||
|
string? Message,
|
||||||
|
DateTime AddedWhen,
|
||||||
|
DateTime? ChangedWhen,
|
||||||
|
string? Title,
|
||||||
|
string Language,
|
||||||
|
bool TFAEnabled,
|
||||||
|
DigitalData.UserManager.Domain.Entities.User User)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den Namen des Status zurück, der dem numerischen Statuswert entspricht.
|
||||||
|
/// </summary>
|
||||||
|
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Envelopes.Queries.ReceiverName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eine Abfrage, um die zuletzt verwendete Anrede eines Empfängers zu ermitteln,
|
||||||
|
/// damit diese für zukünftige Umschläge wiederverwendet werden kann.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Envelope">Der Umschlag, für den die Anrede des Empfängers ermittelt werden soll.</param>
|
||||||
|
/// <param name="OnlyLast">Gibt an, ob nur die zuletzt verwendete Anrede zurückgegeben werden soll.</param>
|
||||||
|
public record ReadReceiverNameQuery(EnvelopeQuery? Envelope = null, bool OnlyLast = true) : ReadReceiverQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
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;
|
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
||||||
using DigitalData.Core.Client;
|
|
||||||
using QRCoder;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Extensions
|
|
||||||
{
|
|
||||||
public static class DIExtensions
|
|
||||||
{
|
|
||||||
public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config)
|
|
||||||
{
|
|
||||||
//Inject CRUD Service and repositoriesad
|
|
||||||
services.TryAddScoped<IConfigRepository, ConfigRepository>();
|
|
||||||
services.TryAddScoped<IDocumentReceiverElementRepository, DocumentReceiverElementRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeDocumentRepository, EnvelopeDocumentRepository>();
|
|
||||||
services.TryAddScoped<IConfigRepository, ConfigRepository>();
|
|
||||||
services.TryAddScoped<IDocumentReceiverElementRepository, DocumentReceiverElementRepository>();
|
|
||||||
services.TryAddScoped<IDocumentStatusRepository, DocumentStatusRepository>();
|
|
||||||
services.TryAddScoped<IEmailTemplateRepository, EmailTemplateRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeRepository, EnvelopeRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeCertificateRepository, EnvelopeCertificateRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeDocumentRepository, EnvelopeDocumentRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeHistoryRepository, EnvelopeHistoryRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeReceiverRepository, EnvelopeReceiverRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
|
||||||
services.TryAddScoped<IReceiverRepository, ReceiverRepository>();
|
|
||||||
services.TryAddScoped<IUserReceiverRepository, UserReceiverRepository>();
|
|
||||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyRepository, EnvelopeReceiverReadOnlyRepository>();
|
|
||||||
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(typeof(BasicDtoMappingProfile).Assembly);
|
|
||||||
services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
|
|
||||||
|
|
||||||
services.ConfigureByTypeName<DispatcherParams>(config);
|
|
||||||
services.ConfigureByTypeName<MailParams>(config);
|
|
||||||
services.ConfigureByTypeName<AuthenticatorParams>(config);
|
|
||||||
services.ConfigureByTypeName<TotpSmsParams>(config);
|
|
||||||
|
|
||||||
services.AddHttpClientService<GtxMessagingParams>(config.GetSection(nameof(GtxMessagingParams)));
|
|
||||||
services.TryAddSingleton<ISmsSender, GTXSmsSender>();
|
|
||||||
services.TryAddSingleton<IEnvelopeSmsHandler, EnvelopeSmsHandler>();
|
|
||||||
services.TryAddSingleton<IAuthenticator, Authenticator>();
|
|
||||||
services.TryAddSingleton<QRCodeGenerator>();
|
|
||||||
|
|
||||||
return services;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: move to DigitalData.Core
|
|
||||||
private static IServiceCollection ConfigureByTypeName<TOptions>(this IServiceCollection services, IConfiguration configuration) where TOptions : class
|
|
||||||
=> services.Configure<TOptions>(configuration.GetSection(nameof(TOptions)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using EnvelopeGenerator.Extensions;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Extensions
|
|
||||||
{
|
|
||||||
public static class DTOExtensions
|
|
||||||
{
|
|
||||||
public static bool IsTotpSecretExpired(this ReceiverReadDto dto, int minutesBeforeExpiration = 30)
|
|
||||||
=> dto.TotpExpiration < DateTime.Now.AddMinutes(minutesBeforeExpiration * -1);
|
|
||||||
|
|
||||||
public static bool IsTotpSecretInvalid(this ReceiverReadDto dto, int minutesBeforeExpiration = 30)
|
|
||||||
=> dto.IsTotpSecretExpired(minutesBeforeExpiration) || dto.TotpSecretkey is null;
|
|
||||||
|
|
||||||
public static bool IsTotpSecretValid(this ReceiverReadDto dto, int minutesBeforeExpiration = 30)
|
|
||||||
=> !dto.IsTotpSecretInvalid(minutesBeforeExpiration);
|
|
||||||
|
|
||||||
public static bool IsTotpValid(this ReceiverReadDto dto, string totp) => dto.TotpSecretkey is null ? throw new ArgumentNullException(nameof(dto), $"TotpSecretkey of DTO cannot validate without TotpSecretkey. Dto: {JsonConvert.SerializeObject(dto)}") : totp.IsValidTotp(dto.TotpSecretkey);
|
|
||||||
|
|
||||||
public static bool IsTotpInvalid(this ReceiverReadDto dto, string totp) => !dto.IsTotpValid(totp: totp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||||
|
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
using EnvelopeGenerator.Common;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Histories.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für die Verlaufshistorie eines Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="EnvelopeId">Die eindeutige Kennung des Umschlags.</param>
|
||||||
|
/// <param name="Envelope">Die Abfrage, die den Umschlag beschreibt.</param>
|
||||||
|
/// <param name="Receiver">Die Abfrage, die den Empfänger beschreibt.</param>
|
||||||
|
/// <param name="Related">Abfrage, die angibt, worauf sich der Datensatz bezieht. Ob er sich auf den Empfänger, den Sender oder das System bezieht, wird durch 0, 1 bzw. 2 dargestellt.</param>
|
||||||
|
/// <param name="OnlyLast">Abfrage zur Steuerung, ob nur der aktuelle Status oder der gesamte Datensatz zurückgegeben wird.</param>
|
||||||
|
public record ReadHistoryQuery(
|
||||||
|
int EnvelopeId,
|
||||||
|
ReadEnvelopeQuery? Envelope = null,
|
||||||
|
ReadReceiverQuery? Receiver = null,
|
||||||
|
Constants.ReferenceType? Related = null,
|
||||||
|
bool? OnlyLast = true);
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
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.MappingProfiles
|
|
||||||
{
|
|
||||||
public class BasicDtoMappingProfile : Profile
|
|
||||||
{
|
|
||||||
public BasicDtoMappingProfile()
|
|
||||||
{
|
|
||||||
// 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<EnvelopeHistory, EnvelopeHistoryDto>();
|
|
||||||
CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>();
|
|
||||||
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
|
|
||||||
CreateMap<EnvelopeReceiver, EnvelopeReceiverSecretDto>();
|
|
||||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
|
||||||
CreateMap<Receiver, ReceiverReadDto>();
|
|
||||||
CreateMap<Receiver, ReceiverCreateDto>();
|
|
||||||
CreateMap<Receiver, ReceiverUpdateDto>();
|
|
||||||
CreateMap<UserReceiver, UserReceiverDto>();
|
|
||||||
CreateMap<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, EnvelopeHistory>();
|
|
||||||
CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>();
|
|
||||||
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();
|
|
||||||
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
|
||||||
CreateMap<ReceiverReadDto, Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
|
||||||
CreateMap<ReceiverCreateDto, Receiver>();
|
|
||||||
CreateMap<ReceiverUpdateDto, Receiver>();
|
|
||||||
CreateMap<UserReceiverDto, UserReceiver>();
|
|
||||||
CreateMap<EnvelopeReceiverBase, EnvelopeReceiverBasicDto>();
|
|
||||||
CreateMap<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnly>();
|
|
||||||
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, EnvelopeReceiverReadOnly>();
|
|
||||||
|
|
||||||
// Messaging mappings
|
|
||||||
// for GTX messaging
|
|
||||||
CreateMap<GtxMessagingResponse, SmsResponse>()
|
|
||||||
.ConstructUsing(gtxRes => gtxRes.Ok()
|
|
||||||
? new SmsResponse() { Ok = true }
|
|
||||||
: new SmsResponse() { Ok = false, Errors = gtxRes });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||||
|
/// Diese Abfrage erbt von <see cref="ReceiverQuery"/> und wird verwendet,
|
||||||
|
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||||
|
/// </summary>
|
||||||
|
public record ReadReceiverQuery : ReceiverQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert die Antwort auf eine Abfrage, um einen Empfänger zu lesen.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Id">Die eindeutige Identifikationsnummer des Empfängers.</param>
|
||||||
|
/// <param name="EmailAddress">Die E-Mail-Adresse des Empfängers.</param>
|
||||||
|
/// <param name="AddedWhen">Das Datum und die Uhrzeit, wann der Empfänger hinzugefügt wurde.</param>
|
||||||
|
/// <param name="Signature">Die Signatur des Empfängers.</param>
|
||||||
|
public record ReadReceiverResponse(int Id, string EmailAddress, DateTime AddedWhen, string Signature)
|
||||||
|
{
|
||||||
|
}
|
||||||
9
EnvelopeGenerator.Application/Receivers/ReceiverQuery.cs
Normal file
9
EnvelopeGenerator.Application/Receivers/ReceiverQuery.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Receivers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Empfänger des Umschlags
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Id">ID des Empfängers</param>
|
||||||
|
/// <param name="EmailAddress">E-Mail Adresse des Empfängers</param>
|
||||||
|
/// <param name="Signature">Eindeutige Signatur des Empfängers</param>
|
||||||
|
public record ReceiverQuery(int? Id = null, string? EmailAddress = null, string? Signature = null);
|
||||||
@@ -163,10 +163,10 @@
|
|||||||
<value>Bitte überprüfen Sie die Standortinformationen. Wenn sie falsch sind, korrigieren Sie diese bitte.</value>
|
<value>Bitte überprüfen Sie die Standortinformationen. Wenn sie falsch sind, korrigieren Sie diese bitte.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAccess" xml:space="preserve">
|
<data name="LockedBodyAccess" xml:space="preserve">
|
||||||
<value>Wir haben Ihnen gerade den Zugriffscode an die hinterlegte Email Adresse gesendet. Dies kann evtl. einige Minuten dauern.</value>
|
<value>Wir senden Ihnen nun einen Zugriffscode an Ihre hinterlegte Email-Adresse. Dies kann evtl. einige Minuten dauern!</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAuthenticator" xml:space="preserve">
|
<data name="LockedBodyAuthenticator" xml:space="preserve">
|
||||||
<value>Ihr QR-Code ist bis {0} gültig.</value>
|
<value>Bitte geben Sie den in Ihrer Authenticator-App angegebenen TOTP-Code ein.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAuthenticatorNew" xml:space="preserve">
|
<data name="LockedBodyAuthenticatorNew" xml:space="preserve">
|
||||||
<value>Wir haben den QR-Code an Ihre E-Mail-Adresse gesendet. Ihr QR-Code ist bis {0} gültig. Sie können ihn für alle Umschläge verwenden, die Sie an diese E-Mail-Adresse erhalten.</value>
|
<value>Wir haben den QR-Code an Ihre E-Mail-Adresse gesendet. Ihr QR-Code ist bis {0} gültig. Sie können ihn für alle Umschläge verwenden, die Sie an diese E-Mail-Adresse erhalten.</value>
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
<value>SMS-Code</value>
|
<value>SMS-Code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedFooterBodyAccess" xml:space="preserve">
|
<data name="LockedFooterBodyAccess" xml:space="preserve">
|
||||||
<value>Bitte überprüfen Sie Ihr Email Postfach inklusive Spam-Ordner. Sie können auch den Absender bitten, Ihnen den Code auf anderem Wege zukommen zu lassen.</value>
|
<value>Bitte überprüfen Sie Ihr Email Postfach inklusive Spam-Ordner. Sie können auch den Absender <a class="mail-link" href="mailto:{0}?subject={1}&body={2}" target="_blank">{0}</a> bitten, Ihnen den Code auf anderem Wege zukommen zu lassen.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedFooterBodyAuthenticator" xml:space="preserve">
|
<data name="LockedFooterBodyAuthenticator" xml:space="preserve">
|
||||||
<value>Der neue QR-Code wird nur einmal für einen bestimmten Zeitraum gesendet und nach dem Scannen in Ihrer Authenticator-App gespeichert. Er kann für alle Umschläge verwendet werden, die an dieselbe E-Mail-Adresse gesendet werden, bis er abläuft. Wenn Sie die QR-Code-Mail nicht erhalten oder sie sowohl aus der Mail als auch aus authenticator löschen, kontaktieren Sie bitte den Absender.</value>
|
<value>Der neue QR-Code wird nur einmal für einen bestimmten Zeitraum gesendet und nach dem Scannen in Ihrer Authenticator-App gespeichert. Er kann für alle Umschläge verwendet werden, die an dieselbe E-Mail-Adresse gesendet werden, bis er abläuft. Wenn Sie die QR-Code-Mail nicht erhalten oder sie sowohl aus der Mail als auch aus authenticator löschen, kontaktieren Sie bitte den Absender.</value>
|
||||||
|
|||||||
@@ -163,10 +163,10 @@
|
|||||||
<value>Please review the location information. If it is incorrect, kindly make the necessary corrections.</value>
|
<value>Please review the location information. If it is incorrect, kindly make the necessary corrections.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAccess" xml:space="preserve">
|
<data name="LockedBodyAccess" xml:space="preserve">
|
||||||
<value>We have just sent you the access code to the email address you provided. This may take a few minutes.</value>
|
<value>We will now send you an access code to your registered e-mail address. This may take a few minutes!</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAuthenticator" xml:space="preserve">
|
<data name="LockedBodyAuthenticator" xml:space="preserve">
|
||||||
<value>Your QR code is valid until {0}.</value>
|
<value>Please enter the TOTP provided in your Authenticator app.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedBodyAuthenticatorNew" xml:space="preserve">
|
<data name="LockedBodyAuthenticatorNew" xml:space="preserve">
|
||||||
<value>We have sent the QR code to your e-mail address. Your QR code is valid until {0}. You can use it for all envelopes received at this email address.</value>
|
<value>We have sent the QR code to your e-mail address. Your QR code is valid until {0}. You can use it for all envelopes received at this email address.</value>
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
<value>SMS Code</value>
|
<value>SMS Code</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedFooterBodyAccess" xml:space="preserve">
|
<data name="LockedFooterBodyAccess" xml:space="preserve">
|
||||||
<value>Please check your email inbox including your spam folder. Furthermore, you can also ask the sender to send the code by other means.</value>
|
<value>Please check your email inbox including the spam folder. You can also ask the sender <a class="mail-link" href="mailto:{0}?subject={1}&body={2}" target="_blank">{0}</a> to send you the code by other means.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="LockedFooterBodyAuthenticator" xml:space="preserve">
|
<data name="LockedFooterBodyAuthenticator" xml:space="preserve">
|
||||||
<value>The new QR code is sent only once for a given period and is saved in your authenticator app once scanned. It can be used for all envelopes received at the same email address until it expires. If you do not receive the QR code mail or delete it both from the mail and from authenticator, please contact the sender.</value>
|
<value>The new QR code is sent only once for a given period and is saved in your authenticator app once scanned. It can be used for all envelopes received at the same email address until it expires. If you do not receive the QR code mail or delete it both from the mail and from authenticator, please contact the sender.</value>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using EnvelopeGenerator.Application.Configurations;
|
using EnvelopeGenerator.Application.Configurations;
|
||||||
using EnvelopeGenerator.Application.Contracts;
|
using EnvelopeGenerator.Application.Contracts.Services;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using OtpNet;
|
using OtpNet;
|
||||||
using QRCoder;
|
using QRCoder;
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using DigitalData.Core.Application;
|
using DigitalData.Core.Application;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using EnvelopeGenerator.Application.Contracts;
|
using EnvelopeGenerator.Application.Contracts.Services;
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
using EnvelopeGenerator.Application.DTOs;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
namespace EnvelopeGenerator.Application.Services
|
namespace EnvelopeGenerator.Application.Services;
|
||||||
|
|
||||||
|
public class ConfigService : ReadService<IConfigRepository, ConfigDto, Config, int>, IConfigService
|
||||||
{
|
{
|
||||||
public class ConfigService : ReadService<IConfigRepository, ConfigDto, Config, int>, IConfigService
|
|
||||||
{
|
|
||||||
private static readonly Guid DefaultConfigCacheId = Guid.NewGuid();
|
private static readonly Guid DefaultConfigCacheId = Guid.NewGuid();
|
||||||
|
|
||||||
private readonly IMemoryCache _cache;
|
private readonly IMemoryCache _cache;
|
||||||
private readonly ILogger<ConfigService> _logger;
|
private readonly ILogger<ConfigService> _logger;
|
||||||
public ConfigService(IConfigRepository repository, IMapper mapper, IMemoryCache memoryCache, ILogger<ConfigService> logger) : base(repository, mapper)
|
public ConfigService(IConfigRepository repository, IMapper mapper, IMemoryCache memoryCache, ILogger<ConfigService> logger) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_cache = memoryCache;
|
_cache = memoryCache;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DataResult<ConfigDto>> ReadFirstAsync()
|
public async Task<DataResult<ConfigDto>> ReadFirstAsync()
|
||||||
{
|
{
|
||||||
var config = await _repository.ReadFirstAsync();
|
var config = await _repository.ReadFirstAsync();
|
||||||
return config is null
|
return config is null
|
||||||
? Result.Fail<ConfigDto>().Notice(LogLevel.Error, Flag.DataIntegrityIssue, "There is no configuration in DB.")
|
? Result.Fail<ConfigDto>().Notice(LogLevel.Error, Flag.DataIntegrityIssue, "There is no configuration in DB.")
|
||||||
: Result.Success(_mapper.Map<ConfigDto>(config));
|
: Result.Success(_mapper.Map<ConfigDto>(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads the default configuration asynchronously.
|
/// Reads the default configuration asynchronously.
|
||||||
@@ -43,18 +43,17 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
/// Thrown when the default configuration cannot be found.
|
/// Thrown when the default configuration cannot be found.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public async Task<ConfigDto> ReadDefaultAsync()
|
public async Task<ConfigDto> ReadDefaultAsync()
|
||||||
{
|
{
|
||||||
var config = await _cache.GetOrCreateAsync(DefaultConfigCacheId, _ => ReadFirstAsync().ThenAsync(
|
var config = await _cache.GetOrCreateAsync(DefaultConfigCacheId, _ => ReadFirstAsync().ThenAsync(
|
||||||
Success: config => config,
|
Success: config => config,
|
||||||
Fail: (mssg, ntc) =>
|
Fail: (mssg, ntc) =>
|
||||||
{
|
{
|
||||||
_logger.LogNotice(ntc);
|
_logger.LogNotice(ntc);
|
||||||
throw new InvalidOperationException("Default configuration cannot find.");
|
throw new InvalidOperationException("Default configuration cannot find.");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return config!;
|
return config!;
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<string> ReadDefaultSignatureHost() => (await ReadDefaultAsync()).SignatureHost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<string> ReadDefaultSignatureHost() => (await ReadDefaultAsync()).SignatureHost;
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user