technology.14.9.23
this app is janky as hell. I wonder if everyone everywhere always doing anything feels that way. right now, after creating a new user in Cognito, they the user have to log in twice before being associated with their organization, which is an attribute created in cognito.
surely, there’s a better way to be doing this. if you don’t provide a user their name in cognito, a name input pops up after the first sign in. I wonder if I require organization if it would do the same thing. it would maybe be nicer to create the org names there than to always do it in cognito, but only if it directly linked them to their org.
I deleted the sent at not null from the user.current endpoint when including assessments. as soon as I did and pressed save, the app populated with assessment data. A truly beautiful moment.
right now, multiple users who belong to the same organization will login and see the same thing. at a high level, there are only three more steps going forward
make the front end work reasonably well for a user view – right now only admin view works reasonably well
rebase the whole application – all these changes are quite a lot of commits behind and also quite a lot of commits ahead
migration – yikes… but maybe not?
here’s a break down of where I ended with the sign in callback. I still don’t know what triggers it – just looked and… still don’t know.
I get the organization name from the cognitoProfile.
using that name, I find a matching organization
if there isn’t none, I create one.
otherwise, I assign its id to a variable
organizationId
check to see if a user with the id from user.id exists
if they do, update their record with their email, name, role, and organizationId
return true
from here, for some reason, an organization is not immediately assigned and / or is not properly handed off to the front end.