using FastEndpoints; using FrameworkBLL.Taxonomy; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Taxonomy.Topic { public class GetSelectListTopic : BaseEndpoint> { private readonly ITopicBLL _TopicBLL; public GetSelectListTopic(ITopicBLL topicBLL) { _TopicBLL = topicBLL; } public override void Configure() { Post("/TaxonomyTopic/GetSelectListTopic"); AllowAnonymous(); } public record GetSelectListTopicParameters( [property: FromHeader] string Login, [property: QueryParam] int SubjectId, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListTopicParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _TopicBLL.GetSelectListTopic(req.SubjectId, req.CriteriaDTO, loginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, loginDTO, ex.Message, 500); } } } }