Refactor envelope creation methods and parameter handling

- Updated `Extension.cs` to remove old methods and introduce a new parameter creation method.
- Modified `IEnvelopeExecutor.cs` to change `CreateEnvelopeAsync` signature for clarity.
- Added a consistent `CreateParmas` method in `EnvelopeCreateReadSQL.cs`.
- Changed service registration in `DependencyExtensions.cs` from singleton to scoped.
- Revised `CreateEnvelopeAsync` in `EnvelopeExecutor.cs` to utilize the new parameter structure and removed user addition logic.

These changes enhance code clarity, maintainability, and consistency in parameter handling.
This commit is contained in:
Developer 02
2025-05-06 11:24:14 +02:00
parent 3cc8e2b5db
commit b5b9155bc0
5 changed files with 34 additions and 98 deletions

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
using Dapper;
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.SQL;
@@ -26,4 +27,22 @@ public class EnvelopeCreateReadSQL : ISQL<Envelope>
FROM [dbo].[TBSIG_ENVELOPE]
WHERE [ENVELOPE_UUID] = @OUT_UID;
";
/// <summary>
///
/// </summary>
/// <param name="userId"></param>
/// <param name="title"></param>
/// <param name="message"></param>
/// <param name="tfaEnabled"></param>
/// <returns></returns>
public static DynamicParameters CreateParmas(int userId, string title = "", string message = "", bool tfaEnabled = false)
{
var parameters = new DynamicParameters();
parameters.Add("@UserId", userId);
parameters.Add("@Title", title);
parameters.Add("@TfaEnabled", tfaEnabled ? 1 : 0);
parameters.Add("@Message", message);
return parameters;
}
}