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 DeleteTopicLink : BaseEndpoint> { private readonly ITopicLinkBLL _TopicLinkBLL; public DeleteTopicLink(ITopicLinkBLL topicLinkBLL) { _TopicLinkBLL = topicLinkBLL; } public override void Configure() { Delete("/TaxonomyTopicLink/DeleteTopicLink"); AllowAnonymous(); } public record DeleteTopicLinkParameters( [property: FromHeader] string Login, [property: QueryParam] int TopicLinkId ); protected override async Task> ExecuteAsync(DeleteTopicLinkParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _TopicLinkBLL.DeleteTopicLink(req.TopicLinkId, 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); } } } }