using FastEndpoints; using FrameworkBLL.Taxonomy; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Taxonomy.TopicLink { public class GetTopicLinksByTopic : BaseEndpoint> { private readonly ITopicLinkBLL _TopicLinkBLL; public GetTopicLinksByTopic(ITopicLinkBLL topicLinkBLL) { _TopicLinkBLL = topicLinkBLL; } public override void Configure() { Get("/TaxonomyTopicLink/GetTopicLinksByTopic"); AllowAnonymous(); } public record GetTopicLinksByTopicParameters( [property: QueryParam] int TopicId, [property: FromHeader] string Login ); protected override async Task> ExecuteAsync(GetTopicLinksByTopicParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _TopicLinkBLL.GetTopicLinksByTopic(req.TopicId, loginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }