From eed08aa22232a8390e29120b2de3c9ae1bd2fb13 Mon Sep 17 00:00:00 2001 From: connoratrug Date: Thu, 28 Sep 2023 15:19:54 +0200 Subject: [PATCH 1/5] fix: fix query builder - find tableMetadata by name instead of id - recursively parse query fields to build gql query fields string --- apps/nuxt3-ssr/components/ResourceCard.vue | 7 ++ .../ssr-catalogue/[resourceType]/index.vue | 13 +++- apps/nuxt3-ssr/utils/tableQuery.ts | 65 +++++++++++-------- 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/apps/nuxt3-ssr/components/ResourceCard.vue b/apps/nuxt3-ssr/components/ResourceCard.vue index 60962b3ada..8dd916f5d2 100644 --- a/apps/nuxt3-ssr/components/ResourceCard.vue +++ b/apps/nuxt3-ssr/components/ResourceCard.vue @@ -127,6 +127,13 @@ const iconStarClasses = computed(() => { --> + diff --git a/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[resourceType]/index.vue b/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[resourceType]/index.vue index 7029a7de98..cf7190581e 100644 --- a/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[resourceType]/index.vue +++ b/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[resourceType]/index.vue @@ -69,7 +69,11 @@ watch(filters, () => { // build resource query for cards -const fields = buildRecordListQueryFields(resourceType, schemaName, schemas); +const fields = buildRecordListQueryFields( + tableMetaData.value.name, + schemaName, + schemas +); const query = computed(() => { return ` @@ -105,7 +109,12 @@ const { data, pending, error, refresh } = await useFetch( ); function buildRecordId(record: any) { - return extractKeyFromRecord(record, resourceType, schemaName, schemas); + return extractKeyFromRecord( + record, + tableMetaData.value.name, + schemaName, + schemas + ); }