From 83351b1fd98accfd47893648618780792adc355e Mon Sep 17 00:00:00 2001 From: Martial Maillot Date: Fri, 5 Jul 2024 11:12:13 +0200 Subject: [PATCH] =?UTF-8?q?fix(agreements):=20mise=20=C3=A0=20jour=20du=20?= =?UTF-8?q?slug=20de=20la=20convention=20collective=207026=20(#1440)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(agreements): mise à jour du slug de la convention collective 7026 * feat: optimise export prequa --- .../prequalified/__tests__/generatePrequalified.test.ts | 4 +--- .../src/ingester/prequalified/fetchPrequalified.ts | 8 ++++++-- .../src/ingester/prequalified/generatePrequalified.ts | 6 +++--- .../1720015045553_update_agreement_7026_slug/down.sql | 3 +++ .../1720015045553_update_agreement_7026_slug/up.sql | 3 +++ 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/down.sql create mode 100644 targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/up.sql diff --git a/targets/export-elasticsearch/src/ingester/prequalified/__tests__/generatePrequalified.test.ts b/targets/export-elasticsearch/src/ingester/prequalified/__tests__/generatePrequalified.test.ts index 6e5050171..6619271fc 100644 --- a/targets/export-elasticsearch/src/ingester/prequalified/__tests__/generatePrequalified.test.ts +++ b/targets/export-elasticsearch/src/ingester/prequalified/__tests__/generatePrequalified.test.ts @@ -32,9 +32,7 @@ jest.mock("../fetchPrequalified", () => ({ text: "textContribution", isPublished: true, isSeachable: true, - document: { - description: "descriptionContribution", - }, + documentDescription: "descriptionContribution", }, }, ], diff --git a/targets/export-elasticsearch/src/ingester/prequalified/fetchPrequalified.ts b/targets/export-elasticsearch/src/ingester/prequalified/fetchPrequalified.ts index dc0e6d6ea..88c70ffe0 100644 --- a/targets/export-elasticsearch/src/ingester/prequalified/fetchPrequalified.ts +++ b/targets/export-elasticsearch/src/ingester/prequalified/fetchPrequalified.ts @@ -18,7 +18,9 @@ query fetch_prequalified { isPublished: is_published isSearchable: is_searchable description: meta_description - document + documentDescription: document(path: "$.description") + url: document(path: "$.url") + action: document(path: "$.action") } } } @@ -40,7 +42,9 @@ export interface FetchedPrequalified { isPublished: boolean; isSearchable: boolean; description: string; - document: any; + documentDescription: string; + url?: string; + action?: string; }; }[]; } diff --git a/targets/export-elasticsearch/src/ingester/prequalified/generatePrequalified.ts b/targets/export-elasticsearch/src/ingester/prequalified/generatePrequalified.ts index a7e7c7ac8..04fc8fd90 100644 --- a/targets/export-elasticsearch/src/ingester/prequalified/generatePrequalified.ts +++ b/targets/export-elasticsearch/src/ingester/prequalified/generatePrequalified.ts @@ -32,10 +32,10 @@ export const generatePrequalified = async ( slug: document.slug, title: document.title, source: document.source, - description: document.description || document.document.description, + description: document.description || document.documentDescription, breadcrumbs: getBreadcrumbs(document.cdtnId), - url: document.document.url, // pour les outils externes - action: document.document.action, // pour les outils (interne/externe) + url: document.url, // pour les outils externes + action: document.action, // pour les outils (interne/externe) } as RelatedDocument) ), })); diff --git a/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/down.sql b/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/down.sql new file mode 100644 index 000000000..8e9b8794a --- /dev/null +++ b/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/down.sql @@ -0,0 +1,3 @@ +UPDATE public.documents +SET slug = 'personnels-des-activites-hippiques' +WHERE cdtn_id = 'ebe937ec29'; diff --git a/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/up.sql b/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/up.sql new file mode 100644 index 000000000..b7220bb24 --- /dev/null +++ b/targets/hasura/migrations/default/1720015045553_update_agreement_7026_slug/up.sql @@ -0,0 +1,3 @@ +UPDATE public.documents +SET slug = '7026-personnels-des-activites-hippiques' +WHERE cdtn_id = 'ebe937ec29';