Skip to content

Commit

Permalink
Remove inactive user (more thant 1 year without connect) in cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Alza committed Jul 24, 2024
1 parent 9b37b38 commit e0302e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions translation-app-assessment/backend/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ app.use(cookieParser())
app.disable('x-powered-by')
require("dotenv");
const cors = require('cors');
firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.applicationDefault()
});

const corsOptions = {
origin: process.env.FRONTEND_URL,
Expand Down Expand Up @@ -363,7 +366,9 @@ async function createLanguage(isoCode, occurrences, average) {
}

async function deleteInactiveUsers() {

const auth = firebaseAdmin.auth();

const oneYearAgo = Date.now() - 365 * 24 * 60 * 60 * 1000;
try {
let usersDeleted = 0;
Expand Down

0 comments on commit e0302e8

Please sign in to comment.