using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using RecruitmentBLL.FlsAction; using RecruitmentDAL.DTO.FlsBridge; using static GB5Shared.GB5Constant.Constant; namespace RecruitmentSL.EndPoints.FlsAction { // Admin/audit save for TRECRUITMENTFLSACTION — in normal operation this entity is created/ // updated internally by RecruitmentFlsBridgeBLL.PrepareActionAsync/SubmitActionAsync (see // RecruitmentSL/EndPoints/FlsBridge), not this endpoint. Kept for the same reason every other // Recruitment entity gets a full CRUD surface (admin correction, audit review), per the // module's established JobPosition-style pattern. public class SaveFlsAction : BaseEndpoint> { private readonly IRecruitmentFlsActionBLL _RecruitmentFlsActionBLL; public SaveFlsAction(IRecruitmentFlsActionBLL recruitmentFlsActionBLL) { _RecruitmentFlsActionBLL = recruitmentFlsActionBLL; } public override void Configure() { Post("/FlsAction/SaveFlsAction"); // 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 SaveFlsActionParameters( [property: FastEndpoints.FromHeader] string Login, [property: FastEndpoints.FromBody] RecruitmentFlsActionDTO RecruitmentFlsActionDTO ); protected override string? GetCacheKey(SaveFlsActionParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( SaveFlsActionParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _RecruitmentFlsActionBLL .SaveRecruitmentFlsAction(req.RecruitmentFlsActionDTO, 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); } } } }