diff --git a/shared/types/src/elastic/contributions.ts b/shared/types/src/elastic/contributions.ts index 64f75cd2e..24ebd4741 100644 --- a/shared/types/src/elastic/contributions.ts +++ b/shared/types/src/elastic/contributions.ts @@ -65,11 +65,62 @@ type ContributionElasticDocumentBase = Omit< export type ContributionElasticDocument = ContributionElasticDocumentBase & (ContributionGenericInfos | ContributionConventionnelInfos); -export type ElasticSearchContributionGeneric = ContributionElasticDocumentBase & - ContributionGenericInfos; +type ElasticSearchContributionFicheSp = { + type: "fiche-sp"; + url: string; + date: string; + raw: string; +}; + +type ElasticSearchContributionGenericNoCDT = { + type: "generic-no-cdt"; + messageBlockGenericNoCDT: string; +}; + +type ElasticSearchContributionContent = { + type: "content" | "cdt"; + content: string; +}; + +type ContributionLinkedContent = { + slug: string; + source: string; + title: string; + description?: string; +}; + +type ContributionRef = { + url?: string | null; + title: string; +}; + +type ElasticSearchContributionBase = { + description: string; + title: string; + slug: string; + breadcrumbs: Breadcrumb[]; + source: "contributions"; + linkedContent: ContributionLinkedContent[]; + references: ContributionRef[]; + idcc: string; + messageBlock?: string; +} & ( + | ElasticSearchContributionFicheSp + | ElasticSearchContributionContent + | ElasticSearchContributionGenericNoCDT +); + +export type ElasticSearchContributionGeneric = ElasticSearchContributionBase & { + ccSupported: string[]; + ccUnextended: string[]; +}; export type ElasticSearchContributionConventionnelle = - ContributionElasticDocumentBase & ContributionConventionnelInfos; + ElasticSearchContributionBase & { + ccnSlug: string; + ccnShortTitle: string; + highlight?: ContributionHighlight; + }; export type ElasticSearchContribution = | ElasticSearchContributionGeneric diff --git a/shared/types/src/hasura/editorial-content.ts b/shared/types/src/hasura/editorial-content.ts index aee4938eb..cebded8aa 100644 --- a/shared/types/src/hasura/editorial-content.ts +++ b/shared/types/src/hasura/editorial-content.ts @@ -21,12 +21,15 @@ export type EditorialContentBaseContentPart = { export type MarkdownContentPart = { type: EditorialContentType.markdown; markdown: string; + html: string; }; export type ContentItem = { title: string; source: string; cdtnId: string; + slug: string; + description: string; }; export type ContentContentPart = { @@ -46,6 +49,7 @@ export type EditorialContentLink = { url: string; type: string; title: string; + slug: string; }; export type EditoralContentReferenceBloc = { @@ -60,6 +64,7 @@ export type GraphicContentPart = { altText: string; fileUrl: string; markdown: string; + html: string; }; export enum EditorialSectionDisplayMode { diff --git a/targets/alert-cli/src/diff/dila/extractReferences/__tests__/editorialContents.test.ts b/targets/alert-cli/src/diff/dila/extractReferences/__tests__/editorialContents.test.ts index 740e2cce8..30f1ee12e 100644 --- a/targets/alert-cli/src/diff/dila/extractReferences/__tests__/editorialContents.test.ts +++ b/targets/alert-cli/src/diff/dila/extractReferences/__tests__/editorialContents.test.ts @@ -1,6 +1,4 @@ import type { DocumentReference } from "@socialgouv/cdtn-types"; - -import type { EditorialContentSubset } from "../editorialContents"; import { extractEditorialContentTemplateRef } from "../editorialContents"; import payload from "./mocks/editorialContent.payload.json"; @@ -22,9 +20,7 @@ jest.mock("@shared/utils", () => { }); test("extractMailTemplateRef", async () => { - const references = await extractEditorialContentTemplateRef( - payload as EditorialContentSubset[] - ); + const references = await extractEditorialContentTemplateRef(payload as any); expect(references).toMatchInlineSnapshot(` [ { diff --git a/targets/export-elasticsearch/src/ingester/informations/__tests__/getContentBlockIds.test.ts b/targets/export-elasticsearch/src/ingester/informations/__tests__/getContentBlockIds.test.ts index 9d87c83ff..285c94c52 100644 --- a/targets/export-elasticsearch/src/ingester/informations/__tests__/getContentBlockIds.test.ts +++ b/targets/export-elasticsearch/src/ingester/informations/__tests__/getContentBlockIds.test.ts @@ -24,6 +24,8 @@ describe("function getContentBlockIds", () => { cdtnId: "cdtnId", title: "title", source: "source", + description: "", + slug: "", }; let props: EditorialContentBaseContentPart[]; let result: string[];