using AutomationDAL.DTO.ScriptSecretRef; using AutomationDAL.Query.ScriptSecretRef; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; namespace AutomationDAL.CustomCode.ScriptSecretRef; public class ScriptSecretRefDAL : IScriptSecretRefDAL { private readonly IQueryExecutor _qe; public ScriptSecretRefDAL(IQueryExecutor qe) => _qe = qe; public async Task> GetByScript(int scriptId, LoginDTO login, CancellationToken ct) => await _qe.QueryAsync(login, ScriptSecretRefQB.GET_BY_SCRIPT, new { ScriptId = scriptId, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); public async Task Insert(ScriptSecretRefDTO dto, LoginDTO login, CancellationToken ct) => await _qe.ExecuteIdentityAsync(login, ScriptSecretRefQB.INSERT, new { dto.ScriptId, dto.SecretName, dto.VaultReference, TenantId = login.ClientId }).ConfigureAwait(false); public async Task Delete(int secretRefId, LoginDTO login, CancellationToken ct) => await _qe.ExecuteAsync(login, ScriptSecretRefQB.DELETE, new { SecretRefId = secretRefId, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); }