-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
async function run() { | ||
console.log('grants-digest-cron run() is called'); | ||
|
||
/* | ||
The cron is responsible for: | ||
1. Identifying all unique criteria from grants_saved_searches | ||
2. Constructing a JSON object with the following for each criteria: | ||
{ | ||
criteria: <criteria>, | ||
user_ids: [<user_id>, ...], | ||
email_date: <email_date>, | ||
} | ||
3. Publish each object created above as a new message in an SQS queue. | ||
*/ | ||
} | ||
|
||
module.exports = { | ||
run, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function main() { | ||
console.log('getGrants.js.main() is called'); | ||
/* | ||
The getGrants.js script is responsible for: | ||
1. Receiving messages from an SQS queue | ||
2. Parse the message body into an object with the following shape: | ||
{ | ||
criteria: <criteria>, | ||
user_ids: [<user_id>, ...], | ||
email_date: <email_date>, | ||
} | ||
3. For each object, query the grants table for grants that match the criteria | ||
4. For each user in user_ids, create a JSON object with the following shape: | ||
{ | ||
user_id: <user_id>, | ||
grant_ids: [<grant_id>, ...], | ||
email_date: <email_date>, | ||
} | ||
5. Publish each object created above as a new message in an SQS queue. | ||
*/ | ||
} | ||
|
||
if (require.main === module) { | ||
main().then(() => process.exit()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function main() { | ||
console.log('sendEmail.main() is called'); | ||
} | ||
|
||
if (require.main === module) { | ||
main().then(() => process.exit()); | ||
} |