I have a application built with nodejs. It's hosted on AWS and uses postgres as the database. The application allows for users to create bookings. When a booking is created, an email is sent to the user to notify them of the booking.
The problem I'm having trouble wrapping my head around is how I'd implement recurring bookings. Let's say a user books something on Tuesday, July 12, how could I create a system that automatically sends an email to them every 12th of the month to notify them of the booking.
I was thinking of having a field on each booking record the specifies the recurring date. Then, I'd have a seperate lambda function that runs every hour that searches and selects all the bookings that have the same recurring date and hour as the current day and hour. Then for each booking, I'd send a notification/email. Having the lambda run every hour would ensure the same record would not be processed twice.
Is my solution good, does it have any problems? I'm also not sure if there is an AWS service that does this that already exists.