Reset portfolio flag on mondays at 12am

This commit is contained in:
Ian Philips 2022-09-23 12:01:36 -04:00
parent 40a8067157
commit 90bf425acf
2 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@ export const resetWeeklyEmailsFlag = functions
privateUsers.map(async (user) => { privateUsers.map(async (user) => {
return firestore.collection('private-users').doc(user.id).update({ return firestore.collection('private-users').doc(user.id).update({
weeklyTrendingEmailSent: false, weeklyTrendingEmailSent: false,
weeklyPortfolioEmailSent: false,
}) })
}) })
) )

View File

@ -36,7 +36,10 @@ const firestore = admin.firestore()
export async function sendPortfolioUpdateEmailsToAllUsers() { export async function sendPortfolioUpdateEmailsToAllUsers() {
const privateUsers = isProd() const privateUsers = isProd()
? // ? await getAllPrivateUsers() ? // ? await getAllPrivateUsers()
filterDefined([await getPrivateUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) filterDefined([
await getPrivateUser('AJwLWoo3xue32XIiAVrL5SyR1WB2'),
await getPrivateUser('tlmGNz9kjXc2EteizMORes4qvWl2'),
])
: filterDefined([await getPrivateUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')]) : filterDefined([await getPrivateUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')])
// get all users that haven't unsubscribed from weekly emails // get all users that haven't unsubscribed from weekly emails
const privateUsersToSendEmailsTo = privateUsers const privateUsersToSendEmailsTo = privateUsers