diff --git a/server/src/jobs/anonymization/anonymizeAppointments.ts b/server/src/jobs/anonymization/anonymizeAppointments.ts index 1cc6e6edb3..d320bb64fb 100644 --- a/server/src/jobs/anonymization/anonymizeAppointments.ts +++ b/server/src/jobs/anonymization/anonymizeAppointments.ts @@ -39,11 +39,11 @@ export const anonymizeAppointments = async (filter: Filter) => { export const anonymizeOldAppointments = async function () { try { - logger.info(" -- Anonymisation des appointments de plus de un (1) an -- ") + logger.info(" -- Anonymisation des appointments de plus de deux (2) ans -- ") - const lastYear = new Date() - lastYear.setFullYear(lastYear.getFullYear() - 1) - const anonymizedAppointmentCount = await anonymizeAppointments({ created_at: { $lte: lastYear } }) + const period = new Date() + period.setFullYear(period.getFullYear() - 2) + const anonymizedAppointmentCount = await anonymizeAppointments({ created_at: { $lte: period } }) logger.info(`Fin traitement ${anonymizedAppointmentCount}`) diff --git a/server/src/jobs/anonymization/anonymizeOldApplications.ts b/server/src/jobs/anonymization/anonymizeOldApplications.ts index d4770fce6a..1246f30b12 100644 --- a/server/src/jobs/anonymization/anonymizeOldApplications.ts +++ b/server/src/jobs/anonymization/anonymizeOldApplications.ts @@ -5,10 +5,10 @@ import { notifyToSlack } from "../../common/utils/slackUtils" const anonymizeApplications = async () => { logger.info(`Début anonymisation`) - const lastYear = new Date() - lastYear.setFullYear(lastYear.getFullYear() - 1) + const period = new Date() + period.setFullYear(period.getFullYear() - 2) - const matchCondition = { created_at: { $lte: lastYear } } + const matchCondition = { created_at: { $lte: period } } await getDbCollection("applications") .aggregate([ @@ -40,7 +40,7 @@ const anonymizeApplications = async () => { export const anonymizeOldApplications = async function () { try { - logger.info(" -- Anonymisation des candidatures de plus de un (1) an -- ") + logger.info(" -- Anonymisation des candidatures de plus de deux (2) ans -- ") const anonymizedApplicationCount = await anonymizeApplications() diff --git a/server/src/jobs/anonymization/anonymizeUsers.ts b/server/src/jobs/anonymization/anonymizeUsers.ts index 692cbd9382..c9cfdd6e6d 100644 --- a/server/src/jobs/anonymization/anonymizeUsers.ts +++ b/server/src/jobs/anonymization/anonymizeUsers.ts @@ -8,9 +8,9 @@ import { notifyToSlack } from "@/common/utils/slackUtils" const anonymizeUsers = async () => { logger.info(`Début anonymisation`) - const lastYear = new Date() - lastYear.setFullYear(lastYear.getFullYear() - 1) - const matchCondition = { last_action_date: { $lte: lastYear } } + const period = new Date() + period.setFullYear(period.getFullYear() - 2) + const matchCondition = { last_action_date: { $lte: period } } await getDbCollection("users") .aggregate([ @@ -38,7 +38,7 @@ const anonymizeUsers = async () => { export const anonymizeOldUsers = async () => { try { - logger.info(" -- Anonymisation des utilisateurs non modifiés de plus de un (1) an -- ") + logger.info(" -- Anonymisation des utilisateurs non modifiés de plus de deux (2) ans -- ") const anonymizedUserCount = await anonymizeUsers() diff --git a/server/src/jobs/jobs.ts b/server/src/jobs/jobs.ts index 1d55fff30f..4726ac1b96 100644 --- a/server/src/jobs/jobs.ts +++ b/server/src/jobs/jobs.ts @@ -150,7 +150,7 @@ export async function setupJobProcessor() { cron_string: "5 0 * * *", handler: () => updateBrevoBlockedEmails({}), }, - "Anonymise les candidatures de plus de un an": { + "Anonymise les candidatures de plus de deux an": { cron_string: "10 0 * * *", handler: anonymizeOldApplications, }, @@ -166,7 +166,7 @@ export async function setupJobProcessor() { cron_string: "0 5 * * 7", handler: () => updateLbaCompanies({ useAlgoFile: true, clearMongo: true }), }, - "Anonimisation des utilisateurs n'ayant effectué aucun rendez-vous de plus de 1 an": { + "Anonimisation des utilisateurs n'ayant effectué aucun rendez-vous de plus de 2 ans": { cron_string: "5 1 * * *", handler: anonymizeOldUsers, }, @@ -182,7 +182,7 @@ export async function setupJobProcessor() { cron_string: "0 1 * * *", handler: anonimizeUsers, }, - "Anonymisation des appointments de plus de 1 an": { + "Anonymisation des appointments de plus de 2 ans": { cron_string: "30 1 * * *", handler: anonymizeOldAppointments, },