From 9ff221da73644d72534c0368366e8c9b44927e46 Mon Sep 17 00:00:00 2001 From: Lucas Charrier Date: Wed, 20 Nov 2024 15:36:34 +0100 Subject: [PATCH] chore: activate email recreation --- src/server/schedulers/cron.ts | 2 +- src/server/schedulers/recreateEmailIfUserActive.ts | 2 +- src/server/schedulers/userContractEndingScheduler.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/schedulers/cron.ts b/src/server/schedulers/cron.ts index 72c11459..6106ff15 100644 --- a/src/server/schedulers/cron.ts +++ b/src/server/schedulers/cron.ts @@ -352,7 +352,7 @@ export const jobs: Job[] = [ { cronTime: "0 */8 * * * *", onTick: recreateEmailIfUserActive, - isActive: false, + isActive: true, name: "recreateEmailIfUserActive", description: "Recreate email for user active again", }, diff --git a/src/server/schedulers/recreateEmailIfUserActive.ts b/src/server/schedulers/recreateEmailIfUserActive.ts index 012c506a..999df844 100644 --- a/src/server/schedulers/recreateEmailIfUserActive.ts +++ b/src/server/schedulers/recreateEmailIfUserActive.ts @@ -26,7 +26,7 @@ export async function recreateEmailIfUserActive() { for (const dbUser of dbUsers) { try { await createEmail(dbUser.username, "Secretariat cron"); - console.log(`Create email for ${dbUser.username}`); + console.log(`Recreate email for ${dbUser.username}`); } catch (e) { console.error(e); Sentry.captureException(e); diff --git a/src/server/schedulers/userContractEndingScheduler.ts b/src/server/schedulers/userContractEndingScheduler.ts index 0deba8af..82caa9c7 100644 --- a/src/server/schedulers/userContractEndingScheduler.ts +++ b/src/server/schedulers/userContractEndingScheduler.ts @@ -290,6 +290,7 @@ export async function deleteOVHEmailAcounts( .where("username", "=", user.username) .set({ primary_email_status: EmailStatusCode.EMAIL_DELETED, + primary_email: null, }) .execute(); console.log(`Suppression de l'email ovh pour ${user.username}`);