using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using SkillManagementBLL.RoleSkillRequirement; using static GB5Shared.GB5Constant.Constant; namespace SkillManagementSL.EndPoints.RoleSkillRequirement { // Renamed from GetRoleSkillRequiremet (typo'd route segment, dropped the "n" in // "Requirement") — route now lives under the correctly-spelled /RoleSkillRequirement/* // prefix shared with Save/Delete/List/Picklist. No frontend caller was found for this // endpoint (verified via repo-wide search of gb4.7mfe). public class GetRoleSkillRequirementBySkill : BaseEndpoint> { private readonly IRoleSkillRequirementBLL _bll; public GetRoleSkillRequirementBySkill(IRoleSkillRequirementBLL bll) { _bll = bll; } public override void Configure() { Get("/RoleSkillRequirement/GetRoleSkillRequirementBySkill"); AllowAnonymous(); } public record GetRoleSkillRequirementBySkillParameters( [property: FromHeader] string Login, [property: QueryParam] int SkillId ); protected override string? GetCacheKey(GetRoleSkillRequirementBySkillParameters req, LoginDTO login) => $"Skill:RoleReq:{login.ClientId}:{req.SkillId}"; protected override async Task> ExecuteAsync( GetRoleSkillRequirementBySkillParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetBySkill(req.SkillId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } } }