Skip to content

Commit

Permalink
chore: add placeholder scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 committed Oct 6, 2023
1 parent 15b8d9f commit b76dcf2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/server/src/scripts/digest/cron.js
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,
};
25 changes: 25 additions & 0 deletions packages/server/src/scripts/digest/getGrants.js
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());
}
7 changes: 7 additions & 0 deletions packages/server/src/scripts/digest/sendEmail.js
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());
}

0 comments on commit b76dcf2

Please sign in to comment.