-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: millesimes 2023 et salaires (#317)
feat: millesimes 2023 feat: salaires
- Loading branch information
Showing
16 changed files
with
126,961 additions
and
117,003 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
2,528 changes: 2,528 additions & 0 deletions
2,528
server/data/depp-2022-etablissements-2022_2023-apprentissage.csv
Large diffs are not rendered by default.
Oops, something went wrong.
5,606 changes: 5,606 additions & 0 deletions
5,606
server/data/depp-2022-etablissements-2022_2023-pro.csv
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { omit, without, uniq } from "lodash-es"; | ||
import { integer } from "#src/common/db/collections/jsonSchema/jsonSchemaTypes.js"; | ||
import * as MongoDB from "#src/common/db/mongodb.js"; | ||
|
||
const schema = { | ||
properties: { | ||
salaire_12_mois_q1: integer(), | ||
salaire_12_mois_q2: integer(), | ||
salaire_12_mois_q3: integer(), | ||
}, | ||
required: [], | ||
}; | ||
|
||
export const up = async (db, client) => { | ||
MongoDB.setMongoDBClient(client); | ||
await Promise.all([ | ||
MongoDB.mergeSchema("certificationsStats", schema), | ||
MongoDB.mergeSchema("formationsStats", schema), | ||
MongoDB.mergeSchema("regionalesStats", schema), | ||
]); | ||
}; | ||
|
||
export const down = async (db, client) => { | ||
return Promise.all( | ||
["certificationsStats", "formationsStats", "regionalesStats"].map(async (collection) => { | ||
const collectionInfos = await db.listCollections({ name: collection }).toArray(); | ||
const validator = collectionInfos[0].options.validator; | ||
|
||
if (!validator) { | ||
return; | ||
} | ||
|
||
const oldSchema = validator.$jsonSchema; | ||
const newSchema = { | ||
...oldSchema, | ||
properties: omit(oldSchema.properties, Object.keys(schema.properties)), | ||
required: uniq(without(oldSchema.required || [], ...schema.required)), | ||
}; | ||
|
||
return db.command({ | ||
collMod: collection, | ||
validationLevel: "strict", | ||
validationAction: "error", | ||
validator: { | ||
$jsonSchema: newSchema, | ||
}, | ||
}); | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters