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.
This commit is contained in:
parent
b93ba6be17
commit
3955a3232d
@ -7,7 +7,7 @@ namespace EnvelopeGenerator.Application.SQL;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CreateEnvelopeSQL : ISQL<Envelope>
|
||||
public class EnvelopeCreateReadSQL : ISQL<Envelope>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
@ -60,7 +60,7 @@ public static class Extension
|
||||
{
|
||||
var parameters = CreateParmas(userId, title, message, tfaEnabled);
|
||||
|
||||
var envelopes = await executor.Execute<TEntity, CreateEnvelopeSQL>(parameters, cancellation);
|
||||
var envelopes = await executor.Execute<TEntity, EnvelopeCreateReadSQL>(parameters, cancellation);
|
||||
return envelopes.FirstOrDefault();
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
|
||||
public async Task<Envelope?> CreateEnvelopeAsync(DynamicParameters parameters, bool addUser = true, CancellationToken cancellation = default)
|
||||
{
|
||||
using var connection = new SqlConnection(Params.ConnectionString);
|
||||
var sql = Provider.GetRequiredService<CreateEnvelopeSQL>();
|
||||
var sql = Provider.GetRequiredService<EnvelopeCreateReadSQL>();
|
||||
await connection.OpenAsync(cancellation);
|
||||
var envelopes = await connection.QueryAsync<Envelope>(sql.Raw, parameters);
|
||||
var envelope = envelopes.FirstOrDefault();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user