Skip to content

Commit

Permalink
fixed request error (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
TSlashDreamy authored Nov 28, 2023
1 parent f465d31 commit ea060f9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cron-jobs/checkForLastLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,28 @@ const DAYS_TO_SEND_EMAILS = 173
const DAYS_TO_DELETE_USER = 180
const EVERY_DAY_AT_3AM = '00 00 03 * * *'
const timeZone = 'UTC'
const defaultFilter = {
name: '',
email: '',
status: [],
lastLogin: {
from: '',
to: ''
},
createdAt: {
from: '',
to: ''
}
}

const checkUsersForLastLogin = new CronJob(EVERY_DAY_AT_3AM, () => checkLastLogin(), null, false, timeZone)

const checkLastLogin = async () => {
const users = await userService.getUsers()
const users = await userService.getUsers(defaultFilter)
const dateNow = new Date()

return Promise.all(
users.map(async ({ email, firstName, lastLogin, language, _id }) => {
users.items.map(async ({ email, firstName, lastLogin, language, _id }) => {
if (!lastLogin) {
return
}
Expand Down

0 comments on commit ea060f9

Please sign in to comment.