using GB5Shared.DTO.Framework.Login; using GB5Shared.Resource.Response; using WiDAL.CustomCode.WiStepContentChecklistResponse; using WiDAL.DTOs; namespace WiBLL.WiStepContentChecklistResponse; public class WiStepContentChecklistResponseBLL : IWiStepContentChecklistResponseBLL { private readonly IWiStepContentChecklistResponseDAL _dal; public WiStepContentChecklistResponseBLL(IWiStepContentChecklistResponseDAL dal) => _dal = dal; public async Task GetResponse(int wiStepContentId, int employeeId, LoginDTO login, CancellationToken ct) { // Empty array, not null, when nothing has been ticked yet — the frontend can // always JSON.parse the result without a null-guard. var json = await _dal.GetResponse(wiStepContentId, employeeId, login, ct).ConfigureAwait(false); return json ?? "[]"; } public async Task SaveResponse(SaveChecklistResponseRequestDTO req, LoginDTO login, CancellationToken ct) { await _dal.SaveResponse(req.WiStepContentId, req.EmployeeId, req.ResponseJson, login, ct).ConfigureAwait(false); return SuccessResponse.UpdateSuccess; } }