Skip to content

Commit

Permalink
Ajout des nouvelles colonnes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric013 committed Nov 13, 2024
1 parent 8e369a8 commit 6900a00
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ function getNewPointDeRassemblementFixture(object: Partial<PointDeRassemblementT
},
matricule: faker.lorem.words(),
particularitesAcces: faker.lorem.words(),
uai: faker.string.alpha(8).toUpperCase(),
numeroOrdre: faker.number.int({ min: 4, max: 16 }).toString().padStart(3, "0"),
dateCreation: faker.date.past(),
dateDebutValidite: faker.date.past(),
dateDerniereModification: faker.date.past(),
...object,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,30 @@ export interface PointDeRassemblementCSV {
"Région académique": string;
Académie: string;
Département: string;
"ID temporaire PDR": string;
UAI: string;
"Numéro d'ordre": string;
"Date début validité de l'enregistrement": string;
"ID temporaire PDR": string;
"Point de Rassemblement : Date de création": string;
"Point de Rassemblement : Date de dernière modification": string;
}

export type PointDeRassemblementImportMapped = Pick<
PointDeRassemblementType,
"name" | "address" | "city" | "zip" | "department" | "region" | "academie" | "particularitesAcces" | "matricule"
| "name"
| "address"
| "city"
| "zip"
| "department"
| "region"
| "academie"
| "particularitesAcces"
| "matricule"
| "uai"
| "numeroOrdre"
| "dateCreation"
| "dateDebutValidite"
| "dateDerniereModification"
> & {
complementAddress: string;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { academyList, departmentList, regionList } from "snu-lib";
const { parse: parseDate } = require("date-fns");
import { logger } from "../../../logger";
import { PointDeRassemblementCSV, PointDeRassemblementImportMapped } from "./pointDeRassemblementImport";

Expand All @@ -16,6 +17,11 @@ export const mapPointDeRassemblements = (rawPdrs: PointDeRassemblementCSV[]): Po
region: mapRegion(rawPdr["Région académique"]),
academie: mapAcademy(rawPdr["Académie"]),
matricule: rawPdr["Matricule du point de rassemblement"],
uai: rawPdr["UAI"],
numeroOrdre: rawPdr["Numéro d'ordre"],
dateCreation: parseDate(rawPdr["Point de Rassemblement : Date de création"], "dd/MM/yyyy", new Date()),
dateDebutValidite: parseDate(rawPdr["Date début validité de l'enregistrement"], "dd/MM/yyyy", new Date()),
dateDerniereModification: parseDate(rawPdr["Point de Rassemblement : Date de dernière modification"], "dd/MM/yyyy", new Date()),
// code: rawPdr["Matricule du point de rassemblement"],
};
if (!rawPdrWithoutId.name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,41 @@ export const PointDeRassemblementSchema = {
},
},

uai: {
type: String,
documentation: {
description: "UAI du point de rassemblement",
},
},

numeroOrdre: {
type: String,
documentation: {
description: "Numéro d'ordre du point de rassemblement",
},
},

dateCreation: {
type: Date,
documentation: {
description: "Date de création du point de rassemblement",
},
},

dateDebutValidite: {
type: Date,
documentation: {
description: "Date de début de validité du point de rassemblement",
},
},

dateDerniereModification: {
type: Date,
documentation: {
description: "Date de dernière modification du point de rassemblement",
},
},

// LEGACY
complementAddress: {
type: [
Expand Down

0 comments on commit 6900a00

Please sign in to comment.