Skip to content

Commit

Permalink
feat: change anonymize from 1 to 2 years (#1726)
Browse files Browse the repository at this point in the history
* feat: change anonymize from 1 to 2 years

* fix: change var name

* fix: other jobs anonym

* fix: review
  • Loading branch information
antoinebigard authored Dec 19, 2024
1 parent c74c7dc commit 430d58f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions server/src/jobs/anonymization/anonymizeAppointments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const anonymizeAppointments = async (filter: Filter<IAppointment>) => {

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}`)

Expand Down
8 changes: 4 additions & 4 deletions server/src/jobs/anonymization/anonymizeOldApplications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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()

Expand Down
8 changes: 4 additions & 4 deletions server/src/jobs/anonymization/anonymizeUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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()

Expand Down
6 changes: 3 additions & 3 deletions server/src/jobs/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand Down

0 comments on commit 430d58f

Please sign in to comment.