OpenCLTBrigade / cmpd-holiday-gift

CMPD Explorers Christmas Project
MIT License
11 stars 24 forks source link

request.user does not contain the user ID #203

Closed AndrewNatoli closed 6 years ago

AndrewNatoli commented 6 years ago

I'm submitting a:

Expected behavior:

@Req request
...
request.user.id

Should contain the user's ID

Current behavior:

id is undefined.

Used in user.controller.ts for GET /me/status.

Example:

const { nominationLimit: limit, households } = await this.userService.getById(request.user.id);
const count = households.filter(row => !row.deleted).length;

This causes the Add / edit nomination screen in the nominations app to fail.

Possible Solution

Steps to reproduce: (for bugs)

Go to the add/edit nomination screen in the nominations app, check for the GET /me/status request.

Using my own account that I just registered on a fresh local dev DB. I erased my existing account from Firebase to be sure Firebase and my local db are for the same user record.

This doesn't work with the dev accounts either.

chimon2000 commented 6 years ago

@AndrewNatoli are you still seeing this issue.

I cleared out my seed and re-authenticated with developer, and was not able to repro.

Here is what i get when using the developer account:

image

And as a new user

image

AndrewNatoli commented 6 years ago

Fresh DB, still have the issue on "Nominate New Household" under 0000000000 and my own freshly registered account. 🤔

Might have to screenshare later?

AndrewNatoli commented 6 years ago

Latest state of develop...

/me/status still dumps a 500 :c

chimon2000 commented 6 years ago

If you look at your SQLite Db does the I'd match your user in Firebase?

AndrewNatoli commented 6 years ago

It does :(

AndrewNatoli commented 6 years ago

Hm. I wonder if I was mindlessly logging in before I had the server running locally? Just logged in and it's working. Will have to re-investigate. Maybe it's when you're auto logged in after signing up? That will technically be resolved by #204 ....

chimon2000 commented 6 years ago

That may be it. If so it'll be resolved by #204. Currently a user can appear to be logged in after registering and verifying their email. We need to change that so that we display that they need to be approved.

AndrewNatoli commented 6 years ago

Appears to be working still, especially with #216