CodeWithAloha / HIERR

A Human-Centered Digital Engagement Process for the Hawai‘i Economic Recovery & Resilience Project with the State Office of Planning & Sustainable Development
https://hierr.vercel.app/
8 stars 7 forks source link

Remove the local storage code #135

Closed avenmia closed 1 year ago

avenmia commented 1 year ago

From @dinoboy197 : Code for xid management is very likely the culprit for problems with not being able to join data from a polis export with our database zipcode and census track data. We need to ensure that an xid is created for every user when they initially log in/create an account, and any user records in the database that are missing xids need to have new xids created and backfilled.

dinoboy197 commented 1 year ago

I created a code branch with a single commit that tries to remove localstorage usage. However, I can't run the app locally right now so I can't test this. Mike, here's what needs to happen with this:

  1. Verify that the location in code that creates user records in the database is always creating xids at the same moment. I can't find any calls to user.create (which is supposed to be the Prisma method to create user objects) so I have no idea where they're being created. Maybe you know. Wherever that is happening needs to be verified and or updated to ensure xids are being stored.
  2. Try to run the code in this branch and make sure logging in working ok and running the survey uses the xid that is in the user's database entry. Update the code in this branch as necessary.
  3. If there are user records in the database missing xids, new xids need to be created for those user records and backfilled into the table. A simple script or migration could do this. Something like update users set xid = id if xid is null or xid = '';

Is that something you can help with since I can't see to test this locally right now?