0

I am building an CRM (Customer Relationship Management) web app using NodeJS and angular js. The user will set a date time to contact client in case the client is unreachable. The part where I am stuck is to show user a notification if they are logged in based on the datetime set by them. This SO post talks about using socket. I am unable to understand how to use it with MySQL as the datetime is stored in DB.

The steps followed by CRM user are

  1. CRM user will call the client and records the information.
  2. In case if client is busy they will record the date time when to call next as suggested by client.
  3. When the current datetime is equal to recorded datetime of next call back, the CRM user should get a pop-up or alert to call back the client.
pythoniesta
  • 317
  • 6
  • 19
  • "based on datetime" isn't specific enough. How is it based, when the datetime is null? What is the data structure? Are you going to get multiple people trying to call the same client? At what point is the datetime set? How are you going to handle the race condition from viewing the record? – danblack Jan 21 '19 at 00:25
  • @danblack - Only the records with not null datetime should be processsed and notification is only to be sent to one person and that person only should follow up with the client and when datetime is set, it will always be sometime in future. I am not sure what race condition means; but only person on whose name the record is assigned should get the notification. – pythoniesta Jan 21 '19 at 03:19
  • what's wrong with `SELECT ... FROM clientcrm WHERE contact_date IS NULL OR contact_date > NOW() AND assigned='me'`. Or if you want this to occur without a page reload something like the SO post you mentioned is good. I barely follow your description of what you want, include steps maybe. – danblack Jan 21 '19 at 04:50
  • @danblack - I have added the steps. What I am not able to understand is how socket will interact with DB and trigger event when current datetime is equal to stored datetime. – pythoniesta Jan 22 '19 at 05:15
  • @danblack - Any other way to achieve this is fine too. – pythoniesta Jan 22 '19 at 05:24
  • ignore the socket /async side of this. Get your application to poll (ajax), the server and the server code can perform the SQL query above to retrieve clients that have an outstanding contact date. Return that via ajax and pop up an alert from this. – danblack Jan 22 '19 at 05:29

0 Answers0