From 4cf210deda9778a4a127ce83ae067f41651bf566 Mon Sep 17 00:00:00 2001 From: Florian Bonniec Date: Fri, 13 Dec 2024 11:40:44 +0100 Subject: [PATCH] feat(admin,api): added missing rncpPublishedAt and rncpEffectiveAt properties --- .../fixtures/certification-bp-boucher.json | 2 ++ ...pdate-certification-description-page.cy.ts | 14 +++++------- .../fixtures/certification-bp-boucher.json | 2 ++ .../[certificationId]/description/page.tsx | 22 ++++++++----------- .../updateCertificationDescription.hook.ts | 2 ++ .../certifications/[certificationId]/page.tsx | 17 +++++++++----- .../updateCertification.hook.ts | 2 ++ .../referential/features/addCertification.ts | 6 +++++ .../updateCertificationWithRncpFields.ts | 6 +++++ ...ertificationWithRncpFieldsAndSubDomains.ts | 6 +++++ .../modules/referential/referential.graphql | 4 ++++ .../modules/referential/rncp/referential.ts | 8 +++++++ .../migration.sql | 3 +++ packages/reva-api/prisma/schema.prisma | 2 ++ .../entities/create-certification-helper.ts | 2 ++ 15 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 packages/reva-api/prisma/migrations/20241213102655_add_rncp_published_at_and_rncp_effective_at_properties_to_certification/migration.sql diff --git a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/fixtures/certification-bp-boucher.json b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/fixtures/certification-bp-boucher.json index 2c4f96074..ea949bf76 100644 --- a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/fixtures/certification-bp-boucher.json +++ b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/fixtures/certification-bp-boucher.json @@ -7,6 +7,8 @@ "status": "A_VALIDER_PAR_CERTIFICATEUR", "rncpExpiresAt": 1788127200000, "rncpDeliveryDeadline": null, + "rncpPublishedAt": null, + "rncpEffectiveAt": null, "availableAt": 1688162400000, "expiresAt": null, "typeDiplome": null, diff --git a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/update-certification-description-page.cy.ts b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/update-certification-description-page.cy.ts index b153adc4a..c92e9cd9e 100644 --- a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/update-certification-description-page.cy.ts +++ b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-description-page/update-certification-description-page.cy.ts @@ -42,14 +42,10 @@ context("when i access the update certification description page ", () => { "@getCertificationForCertificationRegistryManagerUpdateCertificationDescriptionPage", ); - cy.get( - '[data-test="certification-registry-manager-update-certification-description-page"]', - ) - .children("h1") - .should("have.text", "Descriptif de la certification"); - - cy.get('[data-test="rncp-code-title"]') - .children("dd") - .should("have.text", "37310"); + cy.get('[data-test="certification-description-card"]') + .children("div") + .children("div") + .children("h2") + .should("have.text", "Informations liées au code RNCP 37310"); }); }); diff --git a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/fixtures/certification-bp-boucher.json b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/fixtures/certification-bp-boucher.json index 8175f6676..fc71290a4 100644 --- a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/fixtures/certification-bp-boucher.json +++ b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/fixtures/certification-bp-boucher.json @@ -7,6 +7,8 @@ "status": "A_VALIDER_PAR_CERTIFICATEUR", "rncpExpiresAt": 1788127200000, "rncpDeliveryDeadline": null, + "rncpPublishedAt": null, + "rncpEffectiveAt": null, "availableAt": 1688162400000, "expiresAt": null, "typeDiplome": null, diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/page.tsx b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/page.tsx index 2538487dc..a435f7449 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/page.tsx +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/page.tsx @@ -264,25 +264,23 @@ const PageContent = ({
- - {certification.codeRncp} - -

Descriptif de la certification

+

+ Descriptif de la certification dans France compétences +

{certification.label}
{certification.degree.label} {certification.typeDiplome || "Inconnu"} - - {certification.rncpExpiresAt - ? format(certification.rncpExpiresAt, "dd/MM/yyyy") + + {certification.rncpPublishedAt + ? format(certification.rncpPublishedAt, "dd/MM/yyyy") : "Inconnue"} - + {certification.rncpDeliveryDeadline ? format(certification.rncpDeliveryDeadline, "dd/MM/yyyy") : "Inconnue"} @@ -481,14 +479,12 @@ const Info = ({ title, children, className, - data_test, }: { title: string; children: ReactNode; className?: string; - data_test?: string; }) => ( -
+
{title}
{children}
diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/updateCertificationDescription.hook.ts b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/updateCertificationDescription.hook.ts index a629b6324..d5c0dc94d 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/updateCertificationDescription.hook.ts +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/description/updateCertificationDescription.hook.ts @@ -13,6 +13,8 @@ const getCertificationQuery = graphql(` codeRncp status rncpExpiresAt + rncpPublishedAt + rncpEffectiveAt rncpDeliveryDeadline availableAt expiresAt diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx index 0e71f5570..fdebbde90 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx @@ -113,7 +113,7 @@ const PageContent = ({ {certification.availableAt && certification.expiresAt ? (
{`du ${format(certification.availableAt, "dd/MM/yyyy")} au ${format(certification.expiresAt, "dd/MM/yyyy")}`}
) : ( - "Non renseigné" + "À compléter" )} @@ -121,9 +121,16 @@ const PageContent = ({

{certification.label}

-
+
{certification.degree.label} - {certification.typeDiplome || "Inconnu"} + + {certification.typeDiplome || "Inconnu"} + + + {certification.rncpPublishedAt + ? format(certification.rncpPublishedAt, "dd/MM/yyyy") + : "Inconnue"} + {certification.rncpDeliveryDeadline ? format(certification.rncpDeliveryDeadline, "dd/MM/yyyy") @@ -138,7 +145,7 @@ const PageContent = ({ JuryFrequencies.find( ({ id }) => id == certification.juryFrequency, )?.label || - "Non renseigné"} + "À compléter"} {certification.juryModalities.length > 0 @@ -147,7 +154,7 @@ const PageContent = ({ `${acc}${acc && ","} ${EvaluationModalities.find(({ id }) => id == modality)?.label}`, "", ) - : "Non renseigné"} + : "À compléter"} {certification.juryPlace && ( diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/updateCertification.hook.ts b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/updateCertification.hook.ts index fac0e7577..a541314a9 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/updateCertification.hook.ts +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/updateCertification.hook.ts @@ -12,6 +12,8 @@ const getCertificationQuery = graphql(` codeRncp status rncpExpiresAt + rncpPublishedAt + rncpEffectiveAt rncpDeliveryDeadline availableAt expiresAt diff --git a/packages/reva-api/modules/referential/features/addCertification.ts b/packages/reva-api/modules/referential/features/addCertification.ts index 2c24b5284..7a8a98b01 100644 --- a/packages/reva-api/modules/referential/features/addCertification.ts +++ b/packages/reva-api/modules/referential/features/addCertification.ts @@ -64,6 +64,12 @@ export const addCertification = async (params: { codeRncp: string }) => { rncpDeliveryDeadline: rncpCertification.DATE_LIMITE_DELIVRANCE ? new Date(rncpCertification.DATE_LIMITE_DELIVRANCE) : null, + rncpPublishedAt: rncpCertification.DATE_DE_PUBLICATION + ? new Date(rncpCertification.DATE_DE_PUBLICATION) + : null, + rncpEffectiveAt: rncpCertification.DATE_EFFET + ? new Date(rncpCertification.DATE_EFFET) + : null, fcPrerequisites: rncpCertification.PREREQUIS.LISTE_PREREQUIS, prerequisites: { createMany: { diff --git a/packages/reva-api/modules/referential/features/updateCertificationWithRncpFields.ts b/packages/reva-api/modules/referential/features/updateCertificationWithRncpFields.ts index d3c56c056..4ecf0a476 100644 --- a/packages/reva-api/modules/referential/features/updateCertificationWithRncpFields.ts +++ b/packages/reva-api/modules/referential/features/updateCertificationWithRncpFields.ts @@ -55,6 +55,12 @@ export const updateCertificationWithRncpFields = async (params: { rncpDeliveryDeadline: rncpCertification.DATE_LIMITE_DELIVRANCE ? new Date(rncpCertification.DATE_LIMITE_DELIVRANCE) : null, + rncpPublishedAt: rncpCertification.DATE_DE_PUBLICATION + ? new Date(rncpCertification.DATE_DE_PUBLICATION) + : null, + rncpEffectiveAt: rncpCertification.DATE_EFFET + ? new Date(rncpCertification.DATE_EFFET) + : null, }, }); }; diff --git a/packages/reva-api/modules/referential/features/updateCertificationWithRncpFieldsAndSubDomains.ts b/packages/reva-api/modules/referential/features/updateCertificationWithRncpFieldsAndSubDomains.ts index d0e4b9948..0771c97b2 100644 --- a/packages/reva-api/modules/referential/features/updateCertificationWithRncpFieldsAndSubDomains.ts +++ b/packages/reva-api/modules/referential/features/updateCertificationWithRncpFieldsAndSubDomains.ts @@ -41,6 +41,12 @@ export const updateCertificationWithRncpFieldsAndSubDomains = async (params: { rncpDeliveryDeadline: rncpCertification.DATE_LIMITE_DELIVRANCE ? new Date(rncpCertification.DATE_LIMITE_DELIVRANCE) : null, + rncpPublishedAt: rncpCertification.DATE_DE_PUBLICATION + ? new Date(rncpCertification.DATE_DE_PUBLICATION) + : null, + rncpEffectiveAt: rncpCertification.DATE_EFFET + ? new Date(rncpCertification.DATE_EFFET) + : null, }, }); diff --git a/packages/reva-api/modules/referential/referential.graphql b/packages/reva-api/modules/referential/referential.graphql index 7678a8462..4528b9d88 100644 --- a/packages/reva-api/modules/referential/referential.graphql +++ b/packages/reva-api/modules/referential/referential.graphql @@ -43,6 +43,8 @@ type Certification { expiresAt: Timestamp! competenceBlocs: [CertificationCompetenceBloc!]! rncpExpiresAt: Timestamp + rncpPublishedAt: Timestamp + rncpEffectiveAt: Timestamp rncpDeliveryDeadline: Timestamp domains: [Domain!]! fcPrerequisites: String @@ -182,6 +184,8 @@ type FCCertification { NOMENCLATURE_EUROPE: FCNomenclatureEurope DATE_FIN_ENREGISTREMENT: Timestamp DATE_LIMITE_DELIVRANCE: Timestamp + DATE_EFFET: Timestamp + DATE_DE_PUBLICATION: Timestamp BLOCS_COMPETENCES: [BlocCompetence!]! FORMACODES: [FCFormacode!]! DOMAINS: [Domain!]! diff --git a/packages/reva-api/modules/referential/rncp/referential.ts b/packages/reva-api/modules/referential/rncp/referential.ts index 1e1e35d5f..5b492bb87 100644 --- a/packages/reva-api/modules/referential/rncp/referential.ts +++ b/packages/reva-api/modules/referential/rncp/referential.ts @@ -49,6 +49,8 @@ export type RNCPCertification = { }; DATE_FIN_ENREGISTREMENT?: number; DATE_LIMITE_DELIVRANCE?: number; + DATE_EFFET?: number; + DATE_DE_PUBLICATION?: number; BLOCS_COMPETENCES: { CODE: string; LIBELLE: string; @@ -271,6 +273,12 @@ function mapToRNCPCertification(data: any): RNCPCertification { DATE_LIMITE_DELIVRANCE: data.DATE_LIMITE_DELIVRANCE ? getDateFromString(data.DATE_LIMITE_DELIVRANCE) : undefined, + DATE_EFFET: data.DATE_EFFET + ? getDateFromString(data.DATE_EFFET) + : undefined, + DATE_DE_PUBLICATION: data.DATE_DE_PUBLICATION + ? getDateFromString(data.DATE_DE_PUBLICATION) + : undefined, BLOCS_COMPETENCES: ((data.BLOCS_COMPETENCES || []) as any[]) .map((bloc) => { return { diff --git a/packages/reva-api/prisma/migrations/20241213102655_add_rncp_published_at_and_rncp_effective_at_properties_to_certification/migration.sql b/packages/reva-api/prisma/migrations/20241213102655_add_rncp_published_at_and_rncp_effective_at_properties_to_certification/migration.sql new file mode 100644 index 000000000..789e49ae8 --- /dev/null +++ b/packages/reva-api/prisma/migrations/20241213102655_add_rncp_published_at_and_rncp_effective_at_properties_to_certification/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "certification" ADD COLUMN "rncp_effective_at" TIMESTAMPTZ(6), +ADD COLUMN "rncp_published_at" TIMESTAMPTZ(6); diff --git a/packages/reva-api/prisma/schema.prisma b/packages/reva-api/prisma/schema.prisma index a82a0ad5e..070902338 100644 --- a/packages/reva-api/prisma/schema.prisma +++ b/packages/reva-api/prisma/schema.prisma @@ -81,6 +81,8 @@ model Certification { rncpLevel Int? @map("rncp_level") rncpTypeDiplome String? @map("rncp_type_diplome") @db.VarChar(255) rncpExpiresAt DateTime? @map("rncp_expires_at") @db.Timestamptz(6) + rncpPublishedAt DateTime? @map("rncp_published_at") @db.Timestamptz(6) + rncpEffectiveAt DateTime? @map("rncp_effective_at") @db.Timestamptz(6) rncpDeliveryDeadline DateTime? @map("rncp_delivery_deadline") @db.Timestamptz(6) certificationOnFormacode CertificationOnFormacode[] diff --git a/packages/reva-api/test/helpers/entities/create-certification-helper.ts b/packages/reva-api/test/helpers/entities/create-certification-helper.ts index faa60475a..2b5f64b21 100644 --- a/packages/reva-api/test/helpers/entities/create-certification-helper.ts +++ b/packages/reva-api/test/helpers/entities/create-certification-helper.ts @@ -28,6 +28,8 @@ export const createCertificationHelper = async ( rncpTypeDiplome: "HyperDoctorat" as const, rncpExpiresAt: faker.date.future(), rncpDeliveryDeadline: faker.date.future(), + rncpPublishedAt: faker.date.future(), + rncpEffectiveAt: faker.date.future(), certificationAuthorityStructureId: certificationAuthority .certificationAuthorityOnCertificationAuthorityStructure[0]