Developer 02 a757749767 Refactor SQL execution and enhance envelope creation
- Updated `ISQLExecutor<TEntity>` to inherit from new `ISQLExecutor` interface for improved SQL execution flexibility.
- Added package references for `Dapper` and `DigitalData.Core` in project files.
- Modified `CreateEnvelopeCommand` to include `[BindNever]` on `UserId` for better model binding control.
- Refactored `CreateEnvelopeCommandHandler` to use `DynamicParameters` for SQL parameter handling.
- Updated `CreateEnvelopeSQL` to select only the top record for performance.
- Introduced `GetIdOrDefault` method in `ControllerExtensions` for user ID retrieval with fallback.
- Added `CreateAsync` method in `EnvelopeController` for envelope creation using `IMediator`.
- Ensured infrastructure project has necessary package references.
- Refactored `SQLExecutor` to implement new interface and simplified constructor.
- Introduced `SQLExecutorBaseEntity` for entity-specific SQL command execution.
2025-05-05 10:15:36 +02:00

30 lines
747 B
C#

using EnvelopeGenerator.Application.Contracts.SQLExecutor;
using EnvelopeGenerator.Domain.Entities;
using Microsoft.Data.SqlClient;
namespace EnvelopeGenerator.Application.Envelopes.Commands;
/// <summary>
///
/// </summary>
public class CreateEnvelopeSQL : ISQL<Envelope>
{
/// <summary>
///
/// </summary>
public string Raw => @"
USE [DD_ECM];
DECLARE @OUT_UID varchar(36);
EXEC [dbo].[PRSIG_API_CREATE_ENVELOPE]
@USER_ID = @UserId,
@TITLE = @Title,
@TFAEnabled = @TfaEnabled,
@MESSAGE = @Message,
@OUT_UID = @OUT_UID OUTPUT;
SELECT TOP(1) *
FROM [dbo].[TBSIG_ENVELOPE]
WHERE [ENVELOPE_UUID] = @OUT_UID;
";
}