Skip to content

Commit

Permalink
feat(admin,api): added missing rncpPublishedAt and rncpEffectiveAt pr…
Browse files Browse the repository at this point in the history
…operties
  • Loading branch information
fbonniec committed Dec 13, 2024
1 parent 8150c45 commit 4cf210d
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"status": "A_VALIDER_PAR_CERTIFICATEUR",
"rncpExpiresAt": 1788127200000,
"rncpDeliveryDeadline": null,
"rncpPublishedAt": null,
"rncpEffectiveAt": null,
"availableAt": 1688162400000,
"expiresAt": null,
"typeDiplome": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"status": "A_VALIDER_PAR_CERTIFICATEUR",
"rncpExpiresAt": 1788127200000,
"rncpDeliveryDeadline": null,
"rncpPublishedAt": null,
"rncpEffectiveAt": null,
"availableAt": 1688162400000,
"expiresAt": null,
"typeDiplome": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,23 @@ const PageContent = ({
<div className="flex flex-col gap-8">
<EnhancedSectionCard
data-test="certification-description-card"
title="Descriptif de la certification"
title={`Informations liées au code RNCP ${certification.codeRncp}`}
status="TO_COMPLETE"
titleIconClass="fr-icon-award-fill"
>
<div className="flex flex-col gap-4">
<Info data_test="rncp-code-title" title="Code RNCP">
{certification.codeRncp}
</Info>
<h3 className="mb-0">Descriptif de la certification</h3>
<h3 className="mb-0">
Descriptif de la certification dans France compétences
</h3>
<Info title="Intitulé">{certification.label}</Info>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Info title="Niveau">{certification.degree.label}</Info>
<Info title="Type">{certification.typeDiplome || "Inconnu"}</Info>
<Info title="Date d’échéance">
{certification.rncpExpiresAt
? format(certification.rncpExpiresAt, "dd/MM/yyyy")
<Info title="Date de publication">
{certification.rncpPublishedAt
? format(certification.rncpPublishedAt, "dd/MM/yyyy")
: "Inconnue"}
</Info>
<Info title="Date de dernière delivrance">
<Info title="Date d'échéance">
{certification.rncpDeliveryDeadline
? format(certification.rncpDeliveryDeadline, "dd/MM/yyyy")
: "Inconnue"}
Expand Down Expand Up @@ -481,14 +479,12 @@ const Info = ({
title,
children,
className,
data_test,
}: {
title: string;
children: ReactNode;
className?: string;
data_test?: string;
}) => (
<dl data-test={data_test} className={`${className || ""}`}>
<dl className={`${className || ""}`}>
<dt className="mb-1">{title}</dt>
<dd className="font-medium">{children}</dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const getCertificationQuery = graphql(`
codeRncp
status
rncpExpiresAt
rncpPublishedAt
rncpEffectiveAt
rncpDeliveryDeadline
availableAt
expiresAt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,24 @@ const PageContent = ({
{certification.availableAt && certification.expiresAt ? (
<div>{`du ${format(certification.availableAt, "dd/MM/yyyy")} au ${format(certification.expiresAt, "dd/MM/yyyy")}`}</div>
) : (
"Non renseigné"
"À compléter"
)}
</Info>

<div>
<label className="text-xs text-dsfrGray-mentionGrey">{`RNCP ${certification.codeRncp}`}</label>
<h3 className="mb-0">{certification.label}</h3>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="grid grid-cols-1 md:grid-cols-4 gap-4">
<Info title="Niveau">{certification.degree.label}</Info>
<Info title="Type">{certification.typeDiplome || "Inconnu"}</Info>
<Info title="Type de certification">
{certification.typeDiplome || "Inconnu"}
</Info>
<Info title="Date de publication">
{certification.rncpPublishedAt
? format(certification.rncpPublishedAt, "dd/MM/yyyy")
: "Inconnue"}
</Info>
<Info title="Date d’échéance">
{certification.rncpDeliveryDeadline
? format(certification.rncpDeliveryDeadline, "dd/MM/yyyy")
Expand All @@ -138,7 +145,7 @@ const PageContent = ({
JuryFrequencies.find(
({ id }) => id == certification.juryFrequency,
)?.label ||
"Non renseigné"}
"À compléter"}
</Info>
<Info title="Modalités d'évaluation :">
{certification.juryModalities.length > 0
Expand All @@ -147,7 +154,7 @@ const PageContent = ({
`${acc}${acc && ","} ${EvaluationModalities.find(({ id }) => id == modality)?.label}`,
"",
)
: "Non renseigné"}
: "À compléter"}
</Info>
{certification.juryPlace && (
<Info title="Lieu où se déroulera le passage : ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const getCertificationQuery = graphql(`
codeRncp
status
rncpExpiresAt
rncpPublishedAt
rncpEffectiveAt
rncpDeliveryDeadline
availableAt
expiresAt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down
4 changes: 4 additions & 0 deletions packages/reva-api/modules/referential/referential.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type Certification {
expiresAt: Timestamp!
competenceBlocs: [CertificationCompetenceBloc!]!
rncpExpiresAt: Timestamp
rncpPublishedAt: Timestamp
rncpEffectiveAt: Timestamp
rncpDeliveryDeadline: Timestamp
domains: [Domain!]!
fcPrerequisites: String
Expand Down Expand Up @@ -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!]!
Expand Down
8 changes: 8 additions & 0 deletions packages/reva-api/modules/referential/rncp/referential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "certification" ADD COLUMN "rncp_effective_at" TIMESTAMPTZ(6),
ADD COLUMN "rncp_published_at" TIMESTAMPTZ(6);
2 changes: 2 additions & 0 deletions packages/reva-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 4cf210d

Please sign in to comment.