using GB5Shared.GOP.GBQueryExecutor; using GB5Shared.GOP.GBQueryExecutor.Models; using GB5Shared.GOP.GBQueryExecutor.DTOs; using FastEndpoints; 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.GOP.GBQueryExecutor { // Returns IntentProfileId / IntentCode / QueryIntent / Status for active intent // profiles, filtered by the posted CriteriaDTO (IntentCode/QueryIntent/Status). // No TenantId filter — MGBQUERYINTENTPROFILE is globally seeded. public class GetSelectListGBQueryIntentProfile : BaseEndpoint> { private readonly IGBConfiguredQueryBLL _Bll; public GetSelectListGBQueryIntentProfile(IGBConfiguredQueryBLL bll) => _Bll = bll; public override void Configure() { Post("/GBQueryExecutor/GetSelectListGBQueryIntentProfile"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync( Params req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _Bll.GetSelectListIntentProfiles(req.CriteriaDTO, loginDTO, ct); 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); } } } }