Send templated bulk email, and remember notifed marketalerts

This commit is contained in:
Nedim Uka
2019-06-28 18:06:19 +02:00
parent b3baffe174
commit 96e9da1fb1
7 changed files with 98 additions and 61 deletions

View File

@@ -11,15 +11,15 @@ const allRERequest = async () => {
});
}
/**
* Find all unnotified marketalerts, and order them by email
* Find all , or all depending on notified bolean marketalerts, and order them by email
*
* @param fechAll bolean
* @param notified bolean
*
* @returns array of MarketAlerts
*/
const allMarketAlerts = async (notified) => {
const allMarketAlerts = async (fetchAll, notified) => {
let queryObject = {
order: [
@@ -27,27 +27,19 @@ const allMarketAlerts = async (notified) => {
]
}
if (notified){
if (!fetchAll){
queryObject.where = {
notified: notified
}
}
return await db.MarketAlert.findAll(queryObject);
// return await db.MarketAlerts.findAll({
// where: {
// notified: notified
// },
// order: [
// ['email', 'DESC'],
// ]
// });
return await db.MarketAlert.findAll(queryObject);
}
/**
* Find all unnotified marketalerts
* @param latLng array
* @param email strig
* @param email string
*
* @returns array of MarketAlerts
*/