using EnablementDAL.CustomCode.ShowRequestLog; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using Microsoft.Extensions.Logging; namespace EnablementBLL.ShowRequestLog; // ------------------------------------------------------------------------- // Read-only admin BLL over the append-only LSHOWREQUEST audit log. // No AutoNumber / EventLogPublish here — this module never writes; the // existing insert path (ShowResolverBLL → IShowRequestLogDAL.InsertAsync) // is untouched and does not go through this class. // ------------------------------------------------------------------------- public class ShowRequestLogBLL : IShowRequestLogBLL { private readonly IShowRequestLogDAL _dal; private readonly ILogger _logger; public ShowRequestLogBLL(IShowRequestLogDAL dal, ILogger logger) { _dal = dal; _logger = logger; } public async Task> GetShowRequestLogListAsync( int userId, string triggerType, DateTime? fromDate, DateTime? toDate, byte? isFrontendResolved, int pageNo, int pageSize, LoginDTO login, CancellationToken ct) { if (pageNo < 1) throw new ArgumentException("PageNo must be >= 1."); if (pageSize < 1) throw new ArgumentException("PageSize must be >= 1."); var items = await _dal.GetListAsync( userId, triggerType, fromDate, toDate, isFrontendResolved, pageNo, pageSize, login, ct) .ConfigureAwait(false); int total = await _dal.GetListCountAsync( userId, triggerType, fromDate, toDate, isFrontendResolved, login, ct) .ConfigureAwait(false); _logger.LogInformation( "ShowRequestLog list retrieved TenantId={TenantId} UserId={UserId} PageNo={PageNo} TotalCount={TotalCount}", login.ClientId, userId, pageNo, total); return new ResponseStandardDTO { Body = new { Items = items, TotalCount = total }, Status = GB5Shared.DTO.Framework.Enum.FrameworkEnumDTO.ResponseStatus.Ok }; } }