How to send notification on date recurrence? - mongodb

So I keep initial date and recurrence cycle on MongoDB, I want to check everyday if today there is an occurrence, if so I want to send notification to user.
Currently my plan is to aggregate on MongoDB and use recurrence library on Golang and check date. After that with job scheduling sending a notification to every user.
My question is, is it the right way? Wouldn't it be "expensive" to create job for each user or is there a better way to handle this case?

Related

The best way to handle multiple hotel booking requests at the same time

I have a problem when a lot of requests at the same time to book the hotel.
I think I will use a queue to process those orders one by one. If an order has been placed, I will notify the user.
So are there other ways to deal with this problem?
For example, I am using golang and MongoDB to build restAPI.

Trigger cloud function on specific date and time firebase

I want to change a document value at a specific date time in firestore, I don't want to use a scheduleFunctions of firebase i think it is costly to see every minute or an hour to check. Is there any better option which will trigger right on the given time etc.??. And it should be one time not a periodic call using flutter web and firebase for it
You could use the Google Cloud Scheduler to hit a HTTP Cloud Function periodically but using scheduled functions is your best bet.
Firebase had a very generous free tier. You mentioned you are “checking” every couple minutes or hours. That sounds like you updating a document based on an event, in which case you can use PubSub or Firestore triggered cloud functions.

Create an alert within NetSuite that sends out an email when any of these sales channels have no sales after 2 hours?

I am trying to create an alert on my saved search that will email when any of our sales channels do not have an order created within 2 hours.
This is the results criteria for the saved search
The lead source are the sales channels, and maximum of date created is the last time there was an order created. If it goes past 2 hours I want to be notified via email.
This is not possible to create purely within the UI.
You could create a scheduled script which will load the search, parse the results for any that are older than your threshold, and send the email from the search. This would run periodically depending on your deployment settings. Scheduled scripts can be deployed to run every 15 minutes, so the latest order may be up to ~2:15 old before the alert is sent.
Another approach may be to use a workflow which initiates on record creation and then has a 2 hour delay. Following the delay it could run a search for any newer orders, then if any are found it could simply exit, or if no newer orders are found it could proceed to sending an email. The actual implementation of running the saved search and acting based on the results will probably require a SuiteScript custom workflow action.

Suitescript - nlapiSendEmail() - Can I delay an email through script to send on certain date?

I currently have a script that triggers on save that sends out an email. However, under certain criteria, I would like to still trigger the script on save but delay the email until a certain date. Is this possible? How would that be written?
You might want to you NetSuite Workflow. You can put the record in a workflow state based on you condition. On that workflow state have a delay transition to another state after x days which will send the email.
Look at the SuiteAnswer for drop marketing for sample workflows.
#scheppsr77's answer is a good idea.
Another way to do it would be to create a new custom record type that holds the email information and the date you want to send it on. Then have a script that runs periodically checking for any emails to send. Basically it could run like a cron job. I've done that before, for certain items that needed to be re-run or needed to delay.

Retaining Events from the user's calendar

I'm working on an App that needs to remember events selected by the user from their calendar and I've run into a problem with recurring events.
For non-recurring events I can just store the eventIdentifier and fetch the event from the Event Store when I need it.
But recurring events all share the same eventIdentifier. When I go back to the Event Store to fetch the event (based on the eventIdentifier) I get the very first event in the recurrence chain ... not the Nth recurrence of the event that the user selected.
I can't persist the user selected events by archiving the entire EKEvent object since EventKit doesn't support NSCoding.
I'm considering storing the eventIdentifier and Start & End dates so that I can fetch the correct event from the Event Store ... but that seems pretty kludgy and might make tracking changes the user makes in their calendar between launches of my App tricky.
Any thoughts or suggestions?
The event identifier alone is not enough even for non recurring events. Indeed, it can change when the user moves the event to a different calendar. For recurring events, it may change upon detaching an occurrence or splitting the recurrence.Therefore, it is common practice to search for events using a subset of information (say title, start and due date). You should not rely on event identifiers.
Unfortunately, the framework does not provide us with the raw data of an event, it just provides all of the occurrences of the events in a specified interval. Therefore, there is no such thing (using the framework) as the possibility of retrieving a single recurring event and then expanding its recurrence to get its n-th occurrence: you need to manually post-process the retrieved events in order to find the ones you are interested to.
The problem here is that the APIs provided are not meant for sync purposes. Many developers have complained and still complain about this by filing a bug/feature request using Radar. Until now, Apple answer about is that the APIs fulfill a different purpose, since sync is automatic. However, this is true when syncing through iTunes, but not programmatically.