diff --git a/EnvelopeGenerator.Application/Common/Extensions/LoggerExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/LoggerExtensions.cs index 37d06096..aea81e20 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/LoggerExtensions.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/LoggerExtensions.cs @@ -3,8 +3,19 @@ using System.Text; namespace EnvelopeGenerator.Application.Common.Extensions { + /// + /// + /// public static class LoggerExtensions { + /// + /// + /// + /// + /// + /// + /// + /// public static void LogEnvelopeError(this ILogger logger, string envelopeReceiverId, Exception? exception = null, string? message = null, params object?[] args) { var sb = new StringBuilder().AppendLine(envelopeReceiverId.DecodeEnvelopeReceiverId().ToTitle()); @@ -18,6 +29,15 @@ namespace EnvelopeGenerator.Application.Common.Extensions logger.Log(LogLevel.Error, exception, sb.AppendLine(exception.Message).ToString(), args); } + /// + /// + /// + /// + /// + /// + /// + /// + /// public static void LogEnvelopeError(this ILogger logger, string? uuid, string? signature = null, Exception? exception = null, string? message = null, params object?[] args) { var sb = new StringBuilder($"Envelope Uuid: {uuid}"); @@ -34,6 +54,11 @@ namespace EnvelopeGenerator.Application.Common.Extensions logger.Log(LogLevel.Error, exception, sb.ToString(), args); } + /// + /// + /// + /// + /// public static string ToTitle(this (string? UUID, string? Signature) envelopeReceiverTuple) { return $"UUID is {envelopeReceiverTuple.UUID} and signature is {envelopeReceiverTuple.Signature}"; diff --git a/EnvelopeGenerator.Application/Common/Extensions/XSSExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/XSSExtensions.cs index d88a9404..134195d6 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/XSSExtensions.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/XSSExtensions.cs @@ -2,16 +2,42 @@ using Microsoft.Extensions.Localization; using System.Text.Encodings.Web; -namespace EnvelopeGenerator.Application.Common.Extensions +namespace EnvelopeGenerator.Application.Common.Extensions; + +/// +/// +/// +public static class XSSExtensions { - public static class XSSExtensions - { - public static string? TryEncode(this string? value, UrlEncoder encoder) => value is null ? value : encoder.Encode(value); + /// + /// + /// + /// + /// + /// + public static string? TryEncode(this string? value, UrlEncoder encoder) => value is null ? value : encoder.Encode(value); - public static string? TryEncode(this LocalizedString? value, UrlEncoder encoder) => value is null ? null : encoder.Encode(value); + /// + /// + /// + /// + /// + /// + public static string? TryEncode(this LocalizedString? value, UrlEncoder encoder) => value is null ? null : encoder.Encode(value); - public static string? TrySanitize(this string? html, HtmlSanitizer sanitizer) => html is null ? html : sanitizer.Sanitize(html); + /// + /// + /// + /// + /// + /// + public static string? TrySanitize(this string? html, HtmlSanitizer sanitizer) => html is null ? html : sanitizer.Sanitize(html); - public static string? TrySanitize(this LocalizedString? html, HtmlSanitizer sanitizer) => html is null ? null : sanitizer.Sanitize(html); - } + /// + /// + /// + /// + /// + /// + public static string? TrySanitize(this LocalizedString? html, HtmlSanitizer sanitizer) => html is null ? null : sanitizer.Sanitize(html); } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/EmailTemplates/Commands/Update/UpdateEmailTemplateCommandHandler.cs b/EnvelopeGenerator.Application/EmailTemplates/Commands/Update/UpdateEmailTemplateCommandHandler.cs index 5557098d..2a676c91 100644 --- a/EnvelopeGenerator.Application/EmailTemplates/Commands/Update/UpdateEmailTemplateCommandHandler.cs +++ b/EnvelopeGenerator.Application/EmailTemplates/Commands/Update/UpdateEmailTemplateCommandHandler.cs @@ -22,6 +22,7 @@ public class UpdateEmailTemplateCommandHandler : IRequestHandler /// + /// public UpdateEmailTemplateCommandHandler(IRepository repository, IMapper mapper) { _repository = repository; diff --git a/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReadEnvelopeReceiverQuery.cs b/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReadEnvelopeReceiverQuery.cs index 0261114b..2c3400ef 100644 --- a/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReadEnvelopeReceiverQuery.cs +++ b/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReadEnvelopeReceiverQuery.cs @@ -67,10 +67,11 @@ public static class Extensions /// /// /// - public static Task ReadEnvelopeReceiverAsync(this IMediator mediator, string key, CancellationToken cancel = default) + public static async Task ReadEnvelopeReceiverAsync(this IMediator mediator, string key, CancellationToken cancel = default) { var q = new ReadEnvelopeReceiverQuery() { Key = key }; - return mediator.Send(q, cancel).Then(envRcvs => envRcvs.FirstOrDefault()); + var envRcvs = await mediator.Send(q, cancel); + return envRcvs.FirstOrDefault(); } /// @@ -81,12 +82,13 @@ public static class Extensions /// /// /// - public static Task ReadEnvelopeReceiverAsync(this IMediator mediator, string uuid, string signature, CancellationToken cancel = default) + public static async Task ReadEnvelopeReceiverAsync(this IMediator mediator, string uuid, string signature, CancellationToken cancel = default) { var q = new ReadEnvelopeReceiverQuery(); q.Envelope.Uuid = uuid; q.Receiver.Signature = signature; - return mediator.Send(q, cancel).Then(envRcvs => envRcvs.FirstOrDefault()); + var envRcvs = await mediator.Send(q, cancel); + return envRcvs.FirstOrDefault(); } /// /// Verarbeitet und liefert passende -Ergebnisse. diff --git a/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReceiverAlreadySignedQuery.cs b/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReceiverAlreadySignedQuery.cs index 3b5fbf8c..788a983c 100644 --- a/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReceiverAlreadySignedQuery.cs +++ b/EnvelopeGenerator.Application/EnvelopeReceivers/Queries/ReceiverAlreadySignedQuery.cs @@ -68,6 +68,6 @@ public class ReceiverAlreadySignedQueryHandler : IRequestHandler public async Task Handle(ReceiverAlreadySignedQuery request, CancellationToken cancel = default) { - return await _repo.ReadOnly().Where(request).Where(h => h.Status == EnvelopeStatus.DocumentSigned).AnyAsync(cancel); + return await _repo.Query.Where(request).Where(h => h.Status == EnvelopeStatus.DocumentSigned).AnyAsync(cancel); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs b/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs index 109cc8d5..4cd83f01 100644 --- a/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs +++ b/EnvelopeGenerator.Application/Histories/Commands/CreateHistoryCommand.cs @@ -82,7 +82,7 @@ public class CreateHistoryCommandHandler : IRequestHandler er.Receiver) .ToListAsync(cancel); diff --git a/EnvelopeGenerator.Application/Receivers/Commands/CreateReceiverCommand.cs b/EnvelopeGenerator.Application/Receivers/Commands/CreateReceiverCommand.cs index 85aae4d9..333f4a35 100644 --- a/EnvelopeGenerator.Application/Receivers/Commands/CreateReceiverCommand.cs +++ b/EnvelopeGenerator.Application/Receivers/Commands/CreateReceiverCommand.cs @@ -67,6 +67,7 @@ public class CreateReceiverCommandHandler : IRequestHandler /// + /// public CreateReceiverCommandHandler(IRepository repo, IMapper mapper) { _repo = repo; @@ -81,7 +82,7 @@ public class CreateReceiverCommandHandler : IRequestHandler public async Task<(ReceiverDto Receiver, bool AlreadyExists)> Handle(CreateReceiverCommand request, CancellationToken cancel) { - var receiver = await _repo.ReadOnly() + var receiver = await _repo.Query .Where(r => r.EmailAddress == request.EmailAddress) .SingleOrDefaultAsync(cancel);