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 GetRoleRequirement — route now lives under the same /RoleSkillRequirement/* // prefix as Save/Delete/List/Picklist instead of the mismatched /RoleRequirement/* prefix. public class GetRoleSkillRequirementByRole : BaseEndpoint> { private readonly IRoleSkillRequirementBLL _bll; public GetRoleSkillRequirementByRole(IRoleSkillRequirementBLL bll) { _bll = bll; } public override void Configure() { Get("/RoleSkillRequirement/GetRoleSkillRequirementByRole"); AllowAnonymous(); } public record GetRoleSkillRequirementByRoleParameters( [property: FromHeader] string Login, [property: QueryParam] int RoleId ); protected override async Task> ExecuteAsync( GetRoleSkillRequirementByRoleParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetByRole(req.RoleId, 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); } } } }