Skip to content

Commit

Permalink
feat: mise à disposition de la variable type cfa (nouveauté SIFA) pou…
Browse files Browse the repository at this point in the history
…r les ERPs qui ont cette donnée (#3417)
  • Loading branch information
rap2hpoutre authored Dec 5, 2023
1 parent fbaec68 commit d70f86a
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 52 deletions.
1 change: 1 addition & 0 deletions server/src/common/actions/engine/engine.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export const mapEffectifQueueToEffectif = (
responsable_mail2: dossierApprenant.responsable_apprenant_mail2,
derniere_situation: dossierApprenant.derniere_situation,
dernier_organisme_uai: dossierApprenant.dernier_organisme_uai,
type_cfa: dossierApprenant.type_cfa,
}),
},
contrats,
Expand Down
1 change: 1 addition & 0 deletions server/src/common/model/@types/EffectifsQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface EffectifsQueue {
responsable_apprenant_mail2?: any; // Mail du responsable de l'apprenant
derniere_situation?: any; // Situation de l'apprenant N-1
dernier_organisme_uai?: any; // Numéro UAI de l’établissement fréquenté l’année dernière (N-1), si déjà en apprentissage, mettre l’UAI du site de formation ou département
type_cfa?: any; // Type de CFA (nomenclature SIFA)
obtention_diplome_formation?: any;
date_obtention_diplome_formation?: any; // Date d'obtention du diplôme
date_exclusion_formation?: any;
Expand Down
1 change: 1 addition & 0 deletions server/src/common/model/effectifsQueue.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const schema = object(
description:
"Numéro UAI de l’établissement fréquenté l’année dernière (N-1), si déjà en apprentissage, mettre l’UAI du site de formation ou département",
}),
type_cfa: any({ description: "Type de CFA (nomenclature SIFA)" }),
obtention_diplome_formation: any(),
date_obtention_diplome_formation: any({ description: formationProps.date_obtention_diplome.description }),
date_exclusion_formation: any(),
Expand Down
2 changes: 2 additions & 0 deletions server/src/common/validation/dossierApprenantSchemaV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ export const dossierApprenantSchemaV3Base = () =>
etablissement_lieu_de_formation_siret: primitivesV1.etablissement_lieu_de_formation.siret,

formation_cfd: primitivesV1.formation.code_cfd.optional(),
// Champs SIFA
derniere_situation: primitivesV3.derniere_situation.optional(),
dernier_organisme_uai: primitivesV3.dernier_organisme_uai.optional(),
type_cfa: primitivesV3.type_cfa.optional(),
});

const dossierApprenantSchemaV3 = () => {
Expand Down
29 changes: 21 additions & 8 deletions server/src/common/validation/utils/zodPrimitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,25 @@ export const primitivesV3 = {
.openapi({
example: "0123456A",
}),
type_cfa: z
.string()
.regex(/^(01|02|03|04|05|06|07|08|09|10)$/, "01 à 10")
.describe("Type de CFA")
.openapi({
enum: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"],
description: "Type de CFA",
}),
type_cfa: z.preprocess(
(input) => {
if (input) {
// Vérifie si l'entrée est un nombre entre 1 et 10 sans le zéro initial
const match = String(input).match(/^(1|2|3|4|5|6|7|8|9|10)$/);
if (match) {
// Rajoute un zéro devant si nécessaire
return match[0].length === 1 ? "0" + match[0] : match[0];
}
}
return input;
},
z
.string()
.regex(/^(01|02|03|04|05|06|07|08|09|10)$/, "01 à 10")
.describe("Type de CFA")
.openapi({
enum: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"],
description: "Type de CFA",
})
),
};
100 changes: 56 additions & 44 deletions server/static/open-api.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ describe("Processus d'ingestion", () => {
responsable_apprenant_mail2: "[email protected]",
derniere_situation: 4001,
dernier_organisme_uai: "1234567X",
type_cfa: "4",
obtention_diplome_formation: true,
date_obtention_diplome_formation: "2022-06-30T00:00:00.000Z",
date_exclusion_formation: "2022-06-30T00:00:00.000Z",
Expand Down Expand Up @@ -540,6 +541,7 @@ describe("Processus d'ingestion", () => {
responsable_mail2: "[email protected]",
derniere_situation: 4001,
dernier_organisme_uai: "1234567X",
type_cfa: "04",
},
contrats: [
{
Expand Down

0 comments on commit d70f86a

Please sign in to comment.