using EnablementDAL.CustomCode.ShowRequestLog; using EnablementDAL.DTO; using EnablementDAL.Query.Show; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; namespace EnablementDAL.Implementations; public class ShowRequestLogDAL : IShowRequestLogDAL { private readonly IQueryExecutor _qe; public ShowRequestLogDAL(IQueryExecutor qe) => _qe = qe; public async Task InsertAsync(ShowRequestLogDTO dto, LoginDTO login, CancellationToken ct) => await _qe.ExecuteAsync(login, ShowRequestLogQB.INSERT_SHOW_REQUEST_LOG, dto, cancellationToken: ct).ConfigureAwait(false); // ------------------------------------------------------------------------- // Paginated admin view of the resolver request audit log for a tenant. // Parameters: @TenantId, @UserId, @TriggerType, @FromDate, @ToDate, // @IsFrontendResolved, @PageNo, @PageSize // ------------------------------------------------------------------------- public async Task> GetListAsync( int userId, string triggerType, DateTime? fromDate, DateTime? toDate, byte? isFrontendResolved, int pageNo, int pageSize, LoginDTO login, CancellationToken ct) => await _qe.QueryAsync( login, ShowRequestLogQB.GET_SHOW_REQUEST_LOG_LIST, new { TenantId = login.ClientId, UserId = userId, TriggerType = triggerType, FromDate = fromDate, ToDate = toDate, IsFrontendResolved = isFrontendResolved, PageNo = pageNo, PageSize = pageSize }, cancellationToken: ct).ConfigureAwait(false); // ------------------------------------------------------------------------- // Total count for the paginated admin list query (same filters, no paging). // Parameters: @TenantId, @UserId, @TriggerType, @FromDate, @ToDate, @IsFrontendResolved // ------------------------------------------------------------------------- public async Task GetListCountAsync( int userId, string triggerType, DateTime? fromDate, DateTime? toDate, byte? isFrontendResolved, LoginDTO login, CancellationToken ct) => await _qe.ExecuteScalarAsync( login, ShowRequestLogQB.GET_SHOW_REQUEST_LOG_LIST_COUNT, new { TenantId = login.ClientId, UserId = userId, TriggerType = triggerType, FromDate = fromDate, ToDate = toDate, IsFrontendResolved = isFrontendResolved }, cancellationToken: ct).ConfigureAwait(false); }