using FBCKDAL.DTOs; using FBCKDAL.Interfaces; using FBCKDAL.QueryBuilders; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; namespace FBCKDAL.Implementations; public class ActionItemDAL : IActionItemDAL { private readonly IQueryExecutor _qe; public ActionItemDAL(IQueryExecutor qe) => _qe = qe; public async Task> GetActionItemsAsync( int employeeId, short contextType, int contextId, short status, LoginDTO login, CancellationToken ct) => await _qe.QueryAsync(login, ActionItemQB.GET_ACTION_ITEMS, new { EmployeeId = employeeId, ContextType = contextType, ContextId = contextId, Status = status, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false) ?? Enumerable.Empty(); public async Task SaveActionItemAsync(ActionItemDTO dto, LoginDTO login, CancellationToken ct) { if (dto.ActionItemId == 0) { dto.TenantId = login.ClientId; return await _qe.ExecuteIdentityAsync(login, ActionItemQB.INSERT_ACTION_ITEM, dto).ConfigureAwait(false); } await _qe.ExecuteAsync(login, ActionItemQB.UPDATE_ACTION_ITEM, dto, cancellationToken: ct).ConfigureAwait(false); return dto.ActionItemId; } public async Task CompleteActionItemAsync(int actionItemId, string completionRemarks, LoginDTO login, CancellationToken ct) => await _qe.ExecuteAsync(login, ActionItemQB.COMPLETE_ACTION_ITEM, new { ActionItemId = actionItemId, CompletionRemarks = completionRemarks, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); }