From 68288021589848e61282774d5cf33001db379345 Mon Sep 17 00:00:00 2001 From: psubram3 Date: Fri, 1 May 2026 14:21:18 -0700 Subject: [PATCH] update external event type retrieval requests with new hasura metadata --- src/utilities/effects.ts | 24 +++++++++--------------- src/utilities/gql.ts | 14 +++++--------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/utilities/effects.ts b/src/utilities/effects.ts index 879bb63059..cff59b230d 100644 --- a/src/utilities/effects.ts +++ b/src/utilities/effects.ts @@ -4619,26 +4619,20 @@ const effects = { try { const sourceData = await reqHasura< { - derivation_group: { - external_sources: { - external_events: { - external_event_type: { - attribute_schema: object; - name: string; - }; - }[]; - }[]; - }; + external_events: { + external_event_type: { + attribute_schema: object; + name: string; + }; + }[]; }[] >(gql.GET_PLAN_EVENT_TYPES, { plan_id }, user); const types: ExternalEventType[] = []; if (sourceData?.plan_derivation_group !== null) { for (const group of sourceData.plan_derivation_group) { - for (const source of group.derivation_group.external_sources) { - for (const event of source.external_events) { - if (types.flatMap(et => et.name).includes(event.external_event_type.name) === false) { - types.push(event.external_event_type); - } + for (const event of group.external_events) { + if (types.flatMap(et => et.name).includes(event.external_event_type.name) === false) { + types.push(event.external_event_type); } } } diff --git a/src/utilities/gql.ts b/src/utilities/gql.ts index 1621776dad..83c85f426a 100644 --- a/src/utilities/gql.ts +++ b/src/utilities/gql.ts @@ -1628,16 +1628,12 @@ const gql = { `, GET_PLAN_EVENT_TYPES: `#graphql - query GetPlanEventTypes($plan_id: Int!){ + query GetPlanEventTypes($plan_id: Int!) { ${Queries.PLAN_DERIVATION_GROUP}(where: {plan_id: {_eq: $plan_id}}) { - derivation_group { - external_sources { - external_events { - external_event_type { - attribute_schema - name - } - } + external_events (distinct_on: event_type_name) { + external_event_type { + name + attribute_schema } } }