using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using Microsoft.AspNetCore.Mvc; using RecruitmentBLL.Application; using static GB5Shared.GB5Constant.Constant; namespace RecruitmentSL.EndPoints.Application { public class GetSelectListApplication : BaseEndpoint< GetSelectListApplication.GetSelectListApplicationParameters, ResponseStandardDTO> { private readonly IApplicationBLL _ApplicationBLL; public GetSelectListApplication(IApplicationBLL applicationBLL) { _ApplicationBLL = applicationBLL; } public override void Configure() { Post("/Application/GetSelectListApplication"); // Roles("HR", "Recruiter", "Manager") throws 500 here — no host in this repo // configures AddAuthentication (HRFinanceHost included; see PayRollSL's // GetHRMSDashboard.cs for the same documented, repo-wide gap). AllowAnonymous // matches every other endpoint in this SL module today. AllowAnonymous(); } public record GetSelectListApplicationParameters( [property: FastEndpoints.FromHeader] string Login, [property: FastEndpoints.FromBody] CriteriaDTO CriteriaDTO ); // NOT_REQUIRED: this list is the live pipeline/kanban data source (grouped by // CurrentStageId for one requisition). Caching it at CLIENT_LEVEL risks showing a // candidate in a stale stage column right after SaveApplicationStageHistory advances // the pipeline — so, like JobProfile's own select-list sibling, no endpoint-level cache // key is generated here at all. protected override string? GetCacheKey(GetSelectListApplicationParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( GetSelectListApplicationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _ApplicationBLL .GetSelectListApplication(req.CriteriaDTO, LoginDTO!, ct); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }