Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contribs): publish contributions in the new format #1025

Merged
merged 26 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6190d8c
feat(contribs): publish contributions in the new format
carolineBda Sep 25, 2023
c74822d
Merge branch 'master' into carolineBda/publish-contrib
carolineBda Sep 25, 2023
c1167c3
move more types
carolineBda Sep 25, 2023
e52d278
put back dependency
carolineBda Sep 25, 2023
5e4308b
fix types
carolineBda Sep 25, 2023
9133bbb
Merge branch 'master' into carolineBda/publish-contrib
carolineBda Sep 27, 2023
f786876
fix all types
carolineBda Sep 27, 2023
c60da6b
Merge branch 'master' into carolineBda/publish-contrib
carolineBda Sep 27, 2023
fe84e90
move agreements ingest
carolineBda Sep 27, 2023
ad7ecc5
remove un-used dependencies
carolineBda Sep 28, 2023
fd6dfc5
Merge branch 'master' into carolineBda/publish-contrib
carolineBda Sep 28, 2023
56f95c3
format data after review with Martial
carolineBda Sep 28, 2023
b268368
Merge branch 'master' into carolineBda/publish-contrib
carolineBda Sep 28, 2023
75ac877
Get content from fiche SP
carolineBda Sep 28, 2023
64b6756
handle fiche ids in fiche sp publish
carolineBda Sep 28, 2023
57fbb2c
clean-up
carolineBda Sep 28, 2023
9959dde
clean-up après reviews des devs
carolineBda Oct 6, 2023
b191fb1
Merge branch 'deploy-new-contribs' into carolineBda/publish-contrib
carolineBda Oct 12, 2023
59e35bb
fix(comments ui): meilleur affiche des commentaires & changement de s…
carolineBda Oct 12, 2023
845a4b2
Merge branch 'master' into carolineBda/publish-contrib
maxgfr Oct 13, 2023
7bbdb95
feat(contrib): désactivation du formulaire quand on soumet (#1083)
carolineBda Oct 16, 2023
9503f87
feat(admin): ajout de la suppression d'un commentaire (#1081)
maxgfr Oct 18, 2023
733b372
fix(alert-cli): mise à jour des identifiants PISTE (#1084)
maxgfr Oct 18, 2023
8cdb494
fix(frontend): ajout du titre dans le header (#1085)
maxgfr Oct 18, 2023
d4b5e2d
Merge branch 'master' into carolineBda/publish-contrib
maxgfr Oct 18, 2023
13fdafd
fix(alert-cli): add references from contributions (#1076)
maxgfr Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion shared/elasticsearch-document-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@socialgouv/cdtn-monolog": "^1.5.11",
"@socialgouv/cdtn-slugify": "^4.52.1",
"@socialgouv/cdtn-sources": "^4.52.1",
"@socialgouv/contributions-data-types": "^3.27.0",
carolineBda marked this conversation as resolved.
Show resolved Hide resolved
"nctx": "^1.2.0",
"node-fetch": "^2.6.5",
"p-map": "5.2.0",
Expand Down
10 changes: 5 additions & 5 deletions shared/elasticsearch-document-adapter/src/cdtnDocuments.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
AgreementDoc,
ContributionCompleteDoc,
ContributionGenericDoc,
ContributionWithCCDoc,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ContributionWithCCDoc,
ContributionWithAgreementDoc,

Pour une meilleur lecture et homogénéisation des termes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Après si on a générique, on peut utiliser le terme Personnalisé que le métier utilise pas mal -> ContributionCustomizedDoc ou j'aurais mis plutôt CustomizedContributionDoc et GenericContributionDoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah oui les 2 sont bien

EditorialContentDoc,
FicheTravailEmploiDoc,
} from "@shared/types";
Expand Down Expand Up @@ -167,10 +168,9 @@ export async function* cdtnDocumentsGen() {
};

logger.info("=== Contributions ===");
const contributions = await getDocumentBySource<ContributionCompleteDoc>(
SOURCES.CONTRIBUTIONS,
getBreadcrumbs
);
const contributions = await getDocumentBySource<
ContributionGenericDoc | ContributionWithCCDoc
>(SOURCES.CONTRIBUTIONS, getBreadcrumbs);

const ccnData = await getDocumentBySource<AgreementDoc>(SOURCES.CCN);

Expand Down
1 change: 1 addition & 0 deletions shared/graphql-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const client = createClient({
"x-hasura-admin-secret": HASURA_GRAPHQL_ADMIN_SECRET,
},
},
maskTypename: true,
requestPolicy: "network-only",
url: HASURA_GRAPHQL_ENDPOINT,
});
75 changes: 25 additions & 50 deletions shared/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import type {
IndexedAgreement,
} from "@socialgouv/kali-data-types";
import type {
Prequalified,
Highlight,
EditorialContent,
Highlight,
Prequalified,
} from "./EditorialContent";
import type { BaseHasuraDocument } from "./Base";

export * from "./EditorialContent";
export * from "./utils";
import type { BaseHasuraDocument } from "./Base";

export enum DOCUMENT_SOURCE {
fiches_ministere_travail = "fiches_ministere_travail",
Expand All @@ -37,12 +38,12 @@ export type FicheTravailEmploi = BaseHasuraDocument & {

export type ContributionComplete = BaseHasuraDocument & {
source: "contributions";
document: ContributionCompleteDoc;
document: ContributionGenericDoc;
};

export type ContributionFiltered = BaseHasuraDocument & {
source: "contributions";
document: ContributionFilteredDoc;
document: ContributionWithCCDoc;
};

export type LaborCodeArticle = BaseHasuraDocument & {
Expand Down Expand Up @@ -133,28 +134,17 @@ export interface TravailEmploiReference {
url: string;
}

export interface ContributionCompleteDoc {
index: number;
split: false;
export interface ContributionGenericDoc {
description: string;
answers: CCMultipleAnswers;
answer: Answer;
agreementsWithAnswer: string[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut-être customizedAgreements pour être raccord ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pour le coup c'est bizarre non ? Pour le métier "personnalisé" c'est quand on a une CC.
La je liste juste les CC qui ont une réponse pour cette contrib

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ou alors supportedAgreements pour être raccord avec nos outils ?

}

export interface ContributionFilteredDoc {
index: number;
split: true;
export interface ContributionWithCCDoc {
description: string;
answers: CCSingleAnswer;
}

export interface CCMultipleAnswers {
generic: GenericAnswer;
conventions: Answer[];
}

export interface CCSingleAnswer {
generic: GenericAnswer;
conventionAnswer: Answer;
answer: Answer;
idcc: string;
shortName: string;
}

export type LaborCodeDoc = Pick<CodeArticleData, "cid" | "dateDebut" | "id"> & {
Expand Down Expand Up @@ -203,7 +193,7 @@ export interface AgreementContribAnswer {
index: string;
answer: string;
question: string;
references: ContributionReference[];
references: ExternalRef[];
}

export interface ArticleTheme {
Expand Down Expand Up @@ -458,46 +448,31 @@ export interface ExportEsStatus {
user?: User;
}

export type Question = {
carolineBda marked this conversation as resolved.
Show resolved Hide resolved
id: string;
index: number;
title: string;
answers: {
generic: GenericAnswer;
conventions: Answer[];
};
};

export type Answer = {
id: string;
idcc: string;
markdown: string;
references: ContributionReference[];
};

export type GenericAnswer = {
id: string;
markdown: string;
description: string;
text: string;
references: ContributionReference[];
content?: string;
contentType: string;
references: ExternalRef[];
linkedContent: BaseRef[];
};

export type ContributionReference = BaseRef | DilaRef;

export type DilaRef = {
category: "agreement" | "labor_code";
url: string;
title: string;
dila_id: string;
dila_cid: string;
dila_container_id: string;
};

export type ExternalRef = {
title: string;
url?: string;
carolineBda marked this conversation as resolved.
Show resolved Hide resolved
};

export type BaseRef = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je trouve BaseRef pas adapté. Ce sont nos contenus et ce ne sont pas des références mais des contenus liés. On pourrait le renommer CdtnRelatedContent ?

category: null;
source: string;
title: string;
url: string | null;
slug: string;
};

export type State =
Expand Down
1 change: 0 additions & 1 deletion shared/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"devDependencies": {
"@socialgouv/cdtn-sources": "^4.52.1",
"@socialgouv/contributions-data-types": "^3.27.0",
"@socialgouv/fiches-travail-data-types": "^4.191.0",
"@socialgouv/kali-data-types": "^2.127.0",
"@socialgouv/legi-data-types": "^2.73.1",
Expand Down
1 change: 0 additions & 1 deletion targets/alert-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@shared/dila-resolver": "workspace:^",
"@shared/eslint-config": "workspace:^",
"@shared/types": "workspace:^",
"@socialgouv/contributions-data-types": "3.27.0",
"@socialgouv/fiches-travail-data-types": "4.191.0",
"@socialgouv/kali-data-types": "2.127.0",
"@socialgouv/legi-data-types": "2.73.1",
Expand Down
28 changes: 13 additions & 15 deletions targets/alert-cli/src/extractDilaReferences/contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,20 @@ export function extractContributionsRef(
source: SOURCES.CONTRIBUTIONS,
title: question.title,
},
references: question.document.answers.generic.references.flatMap(
(ref) => {
if (ref.category === null) {
return [];
}
return [
{
dila_cid: ref.dila_cid,
dila_container_id: ref.dila_container_id,
dila_id: ref.dila_id,
title: ref.title,
url: ref.url,
},
];
references: question.document.answer.references.flatMap((ref) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cette partie la sur l'alerting reste à faire

if (ref.category === null) {
return [];
}
),
return [
{
dila_cid: ref.dila_cid,
dila_container_id: ref.dila_container_id,
dila_id: ref.dila_id,
title: ref.title,
url: ref.url,
},
];
}),
});
if ("conventionAnswer" in question.document.answers) {
continue;
Expand Down
1 change: 0 additions & 1 deletion targets/ingester/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const config = {
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)",
],
transformIgnorePatterns: ["<rootDir>/node_modules/(?!(strip-markdown)/)"],
};

module.exports = config;
8 changes: 0 additions & 8 deletions targets/ingester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@
"p-map": "4.0.0",
"p-retry": "5.1.1",
"query-string": "7.0.1",
"remark": "13.0.0",
carolineBda marked this conversation as resolved.
Show resolved Hide resolved
"remark-html": "13.0.2",
"semver": "7.3.5",
"strip-markdown": "^5.0.1",
"tar-fs": "2.1.1",
"unist-util-filter": "^2.0.3",
"unist-util-find": "1.0.2",
"unist-util-flat-filter": "1.0.0",
"unist-util-parents": "1.0.3",
"unist-util-select": "4.0.0",
"winston": "3.3.3",
"yargs": "17.1.1"
},
"devDependencies": {
Expand All @@ -38,13 +33,10 @@
"@types/node": "^16.11.11",
"@types/semver": "^7.3.8",
"@types/tar-fs": "^2.0.1",
"@types/unist": "^2.0.6",
"@vercel/ncc": "0.34.0",
"jest": "^27.1.1",
"lint-staged": "^12.0.0",
"prettier": "^2.3.2",
"ts-jest": "^27.0.5",
"ts-node": "10.8.0",
"typescript": "^4.4.3"
},
"license": "MIT",
Expand Down
42 changes: 26 additions & 16 deletions targets/ingester/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { SourceValues } from "@socialgouv/cdtn-sources";
import type {

import {
Answer,
BaseRef,
DilaRef,
ContributionGenericDoc,
ContributionWithCCDoc,
ExternalRef,
FicheServicePublicDoc,
GenericAnswer,
Question,
} from "@socialgouv/contributions-data-types";
} from "@shared/types";

export as namespace ingester;

Expand All @@ -24,17 +26,24 @@ type ExternalDocument = Document & {
url: string;
};

type ExtendedQuestion = Omit<Question, "answers"> & {
type GenericAnswer = Answer & {
description: string;
text: string;
content?: string | FicheServicePublicDoc;
};
type AnswerWithCC = Answer & { idcc: string; shortName: string };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem ici, on peut nommer CustomizedAnswer


export interface Question {
id: string;
order: number;
title: string;
answers: {
generic: GenericAnswer;
conventionAnswer?: Answer & {
shortName: string;
};
conventions?: Answer[];
conventions: AnswerWithCC[];
};
};
}

type Contribution = Document & ExtendedQuestion;
type Contribution = Document & (ContributionGenericDoc | ContributionWithCCDoc);

type LegiArticle = ExternalDocument & {
dateDebut: number;
Expand Down Expand Up @@ -75,11 +84,12 @@ type AgreementPage = Document & {
};

interface AgreementAnswer {
index: number;
references: (BaseRef | DilaRef)[];
slug: string;
order: number;
references: ExternalRef[];
genericSlug: string;
question: string;
answer: string;
content?: string;
contentType: string;
}

interface AgreementArticleByBlock {
Expand Down
Loading
Loading