S3Infosoft / mvr-call-operator

MVR Call Operator
0 stars 0 forks source link

Load only unique user records into mongodb #4

Open PersonablePhaniK opened 4 years ago

PersonablePhaniK commented 4 years ago

Unable to enforce only unique records to be saved into MongoDB which are loaded from Okta API.

Whenever my node app is getting refreshed, an api call is made and all the records are getting inserted without any validation of duplication even though I added a field of a table to be unique which is an 'ID' copied from okta API.

sidhshar commented 4 years ago

UPDATE:: Rely on below flowchart and Ignore the MD5 portion for the time being.

The flow needs to be modified as we discussed during the last call.

  1. The Okta API call to fetch user list should be triggered ON button click and not while loading the application.
  2. Once the above flow is rectified, perform the following: 2a. Get list of users from MongoDB. One attribute to store of user would be MD5 of JSON 2b. For each user in Okta list, perform MD5 hash. Find out whether this MD5 and username is present in the Mongo User's list 2c. If Yes, goto next. If No, that means that any User attribute has been modified and hence the record needs to be inserted again. Delete the record with username if exists. Insert New record as is.
  3. Before Deleting User record, ensure that custom attributes are not present in the record such as Profile photo. If present, all these attributes need to be inserted manually again.
sidhshar commented 4 years ago

OktaUserWorkflow

PersonablePhaniK commented 4 years ago

Still pending with this, will begin once okta-auth implemented.