using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using RecruitmentBLL.FlsAction; using static GB5Shared.GB5Constant.Constant; namespace RecruitmentSL.EndPoints.FlsAction { // Admin/audit read for a TRECRUITMENTFLSACTION row (internal caller — the candidate/referee- // facing fetch is GetRecruitmentFlsAction under RecruitmentSL/EndPoints/FlsBridge, which is // token-keyed and AllowAnonymous by design; this endpoint requires the row's own numeric id). public class GetFlsAction : BaseEndpoint { private readonly IRecruitmentFlsActionBLL _RecruitmentFlsActionBLL; public GetFlsAction(IRecruitmentFlsActionBLL recruitmentFlsActionBLL) { _RecruitmentFlsActionBLL = recruitmentFlsActionBLL; } public override void Configure() { Get("/FlsAction/GetFlsAction"); // Roles("HR", "Recruiter") 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 GetFlsActionParameters( [property: QueryParam] int RecruitmentFlsActionId, [property: FastEndpoints.FromHeader] string Login ); protected override string? GetCacheKey(GetFlsActionParameters parameters, LoginDTO loginDTO) => KeyGenerator.KeyGeneration( parameters.RecruitmentFlsActionId, EntityConstant.OBJECTRECRUITMENTFLSACTION, CacheKeyLevel.CLIENT_LEVEL, loginDTO); protected override async Task> ExecuteAsync( GetFlsActionParameters parameters, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _RecruitmentFlsActionBLL .GetRecruitmentFlsAction(parameters.RecruitmentFlsActionId, loginDTO!, ct); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse(result, CacheKeyLevel.USER_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError(ex, CacheKeyLevel.USER_LEVEL, loginDTO, ex.Message, 500); } } } }