From 3955a3232df1fe343572f63215b105c173dff23a Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 5 May 2025 16:30:39 +0200 Subject: [PATCH] Refactor envelope creation SQL logic Removed `CreateEnvelopeSQL` and introduced `EnvelopeCreateReadSQL` to handle envelope creation logic. Updated the `Extension` class methods and modified `CreateEnvelopeAsync` in `EnvelopeExecutor` to utilize the new SQL class. --- .../SQL/{CreateEnvelopeSQL.cs => EnvelopeCreateReadSQL.cs} | 4 ++-- EnvelopeGenerator.Infrastructure/Executor/EnvelopeExecutor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename EnvelopeGenerator.Application/SQL/{CreateEnvelopeSQL.cs => EnvelopeCreateReadSQL.cs} (94%) diff --git a/EnvelopeGenerator.Application/SQL/CreateEnvelopeSQL.cs b/EnvelopeGenerator.Application/SQL/EnvelopeCreateReadSQL.cs similarity index 94% rename from EnvelopeGenerator.Application/SQL/CreateEnvelopeSQL.cs rename to EnvelopeGenerator.Application/SQL/EnvelopeCreateReadSQL.cs index 14f70af3..005932f6 100644 --- a/EnvelopeGenerator.Application/SQL/CreateEnvelopeSQL.cs +++ b/EnvelopeGenerator.Application/SQL/EnvelopeCreateReadSQL.cs @@ -7,7 +7,7 @@ namespace EnvelopeGenerator.Application.SQL; /// /// /// -public class CreateEnvelopeSQL : ISQL +public class EnvelopeCreateReadSQL : ISQL { /// /// @@ -60,7 +60,7 @@ public static class Extension { var parameters = CreateParmas(userId, title, message, tfaEnabled); - var envelopes = await executor.Execute(parameters, cancellation); + var envelopes = await executor.Execute(parameters, cancellation); return envelopes.FirstOrDefault(); } diff --git a/EnvelopeGenerator.Infrastructure/Executor/EnvelopeExecutor.cs b/EnvelopeGenerator.Infrastructure/Executor/EnvelopeExecutor.cs index c178eb0b..dca802ba 100644 --- a/EnvelopeGenerator.Infrastructure/Executor/EnvelopeExecutor.cs +++ b/EnvelopeGenerator.Infrastructure/Executor/EnvelopeExecutor.cs @@ -23,7 +23,7 @@ public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor public async Task CreateEnvelopeAsync(DynamicParameters parameters, bool addUser = true, CancellationToken cancellation = default) { using var connection = new SqlConnection(Params.ConnectionString); - var sql = Provider.GetRequiredService(); + var sql = Provider.GetRequiredService(); await connection.OpenAsync(cancellation); var envelopes = await connection.QueryAsync(sql.Raw, parameters); var envelope = envelopes.FirstOrDefault();