Created
December 18, 2020 20:24
-
-
Save sergueyarellano/99c823969cfb1a02d38250503e0e00de to your computer and use it in GitHub Desktop.
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
module.exports.lambda = async (event, context) => { | |
// {Items: [{activities, day}, {activities, day}...]} | |
const reminders = event.detail | |
/* | |
* Use your logic to filter, discard the activities, | |
* we will end up with something like: | |
* [{activities, day}, {activities, day}, {activities, day}] | |
*/ | |
const filteredReminders = filterActivitiesIn(reminders) | |
// Send the events to next step | |
const mappedEvents = filteredReminders.map((reminder) => { | |
return { | |
EventBusName: `main`, | |
Source: 'cron.filter', | |
DetailType: 'FILTERED REMINDERS', | |
Detail: JSON.stringify(reminder) | |
} | |
}) | |
await eventBridge.putEvents({Entries: mappedEvents}).promise() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment