-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-lbac-1688-securisation-lien-mail-candidat
- Loading branch information
Showing
48 changed files
with
965 additions
and
600 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
options: | ||
- production | ||
- recette | ||
- pentest | ||
app_version: | ||
description: app version | ||
type: string | ||
|
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
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
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
31 changes: 31 additions & 0 deletions
31
server/src/db/migrations/20231120000000-cleaning_applications.ts
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,31 @@ | ||
import { Db } from "mongodb" | ||
|
||
import { logger } from "@/common/logger" | ||
|
||
export const up = async (db: Db) => { | ||
await db.collection("applications").updateMany( | ||
{ company_naf: null }, | ||
{ $set: { company_naf: "" } }, | ||
{ | ||
// @ts-expect-error bypassDocumentValidation is not properly set in @types/mongodb | ||
bypassDocumentValidation: true, | ||
} | ||
) | ||
|
||
await db.collection("applications").updateMany( | ||
{ job_title: null }, | ||
{ $set: { job_title: "" } }, | ||
{ | ||
// @ts-expect-error bypassDocumentValidation is not properly set in @types/mongodb | ||
bypassDocumentValidation: true, | ||
} | ||
) | ||
|
||
// removing unreachable lbacompanies | ||
await db.collection("bonnesboites").deleteMany({ naf_label: null }) | ||
|
||
// removing buggy line | ||
await db.collection("domainesmetiers").deleteMany({ domaine: null }) | ||
|
||
logger.info("20231120000000-cleaning_applications") | ||
} |
34 changes: 34 additions & 0 deletions
34
server/src/db/migrations/20231211000000-trim-unsubscribed-lbacompanies.ts
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,34 @@ | ||
import { Db } from "mongodb" | ||
|
||
import { logger } from "@/common/logger" | ||
|
||
export const up = async (db: Db) => { | ||
await db.collection("unsubscribedbonnesboites").dropIndex("opco_1") | ||
await db.collection("unsubscribedbonnesboites").dropIndex("opco_short_name_1") | ||
await db.collection("unsubscribedbonnesboites").dropIndex("opco_url_1") | ||
await db.collection("unsubscribedbonnesboites").updateMany( | ||
{}, | ||
{ | ||
$unset: { | ||
username: "", | ||
email: "", | ||
phone: "", | ||
geo_coordinates: "", | ||
recruitment_potential: "", | ||
street_number: "", | ||
street_name: "", | ||
website: "", | ||
algorithm_origin: "", | ||
opco: "", | ||
opco_short_name: "", | ||
opco_url: "", | ||
}, | ||
}, | ||
{ | ||
// @ts-expect-error bypassDocumentValidation is not properly set in @types/mongodb | ||
bypassDocumentValidation: true, | ||
} | ||
) | ||
|
||
logger.info("20231211000000-trim-unsubscribed-lbacompanies") | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { cleanEmail } from "shared/helpers/common" | ||
|
||
import { logger } from "@/common/logger" | ||
import { db } from "@/common/mongodb" | ||
|
||
const removeOrReplaceCharsInDB = async () => { | ||
logger.info("Nettoyage des adresses emails mal formées dans applications.applicant_email") | ||
|
||
const charsRegex = /[^a-zA-Z0-9@_.+-]/ | ||
const applicantsCursor = await db.collection("applications").find({ applicant_email: { $regex: charsRegex } }) | ||
|
||
for await (const application of applicantsCursor) { | ||
const applicant_email = cleanEmail(application.applicant_email) | ||
if (applicant_email !== application.applicant_email) { | ||
await db.collection("applications").updateOne({ _id: application._id }, { $set: { applicant_email } }) | ||
} | ||
} | ||
} | ||
|
||
export default async function fixApplications() { | ||
await removeOrReplaceCharsInDB() | ||
|
||
await db.collection("applications").updateMany( | ||
{ company_naf: null }, | ||
{ $set: { company_naf: "" } }, | ||
{ | ||
bypassDocumentValidation: true, | ||
} | ||
) | ||
|
||
await db.collection("applications").updateMany( | ||
{ job_title: null }, | ||
{ $set: { job_title: "" } }, | ||
{ | ||
bypassDocumentValidation: true, | ||
} | ||
) | ||
} |
Oops, something went wrong.