This commit removes the IEnvelopeExecutor interface and its implementation, replacing it with ISQLExecutor. The CreateEnvelopeAsync method in Extension.cs now directly creates DynamicParameters. The CreateEnvelopeCommandHandler has been updated to utilize ISQLExecutor. Additionally, the EnvelopeExecutor class has been removed, and a new SQL command class, EnvelopeReceiverCreateReadSQL, has been added for managing envelope receiver SQL operations.
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Dapper;
|
|
using EnvelopeGenerator.Application.SQL;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
|
|
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public static class Extension
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="executor"></param>
|
|
/// <param name="userId"></param>
|
|
/// <param name="title"></param>
|
|
/// <param name="message"></param>
|
|
/// <param name="tfaEnabled"></param>
|
|
/// <param name="cancellation"></param>
|
|
/// <returns></returns>
|
|
public static async Task<Envelope?> CreateEnvelopeAsync(this ISQLExecutor executor, int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default)
|
|
{
|
|
var parameters = new DynamicParameters();
|
|
parameters.Add("@UserId", userId);
|
|
parameters.Add("@Title", title);
|
|
parameters.Add("@TfaEnabled", tfaEnabled ? 1 : 0);
|
|
parameters.Add("@Message", message);
|
|
var envelopes = await executor.Execute<Envelope, EnvelopeCreateReadSQL>(parameters, cancellation);
|
|
return envelopes.FirstOrDefault();
|
|
}
|
|
} |