Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement /get-friends route #151

Merged
merged 1 commit into from
Nov 28, 2021
Merged

implement /get-friends route #151

merged 1 commit into from
Nov 28, 2021

Conversation

RafaelPiloto10
Copy link
Member

No description provided.

@brendacano
Copy link
Contributor

is this ready for review?

Copy link
Member

@DDVD233 DDVD233 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I also implemented a simple get-friends route, where it returns the email of all friends. I think your approach is better.

@@ -14,9 +14,10 @@ def token_response(token: str):
"access_token": token
}

def signJWT(user_id: str) -> Dict[str, str]:
def signJWT(user_id: str, email: str) -> Dict[str, str]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't have to include email in JWT token, but it's also fine if you do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree -- I think UUID is the more important one. Currently, the JWT only stores the email, so this comment is a little misleading. I am moving the email to a separate parameter and adding UUID as the new first parameter as we care about that one more. Should we get rid of email in it's entirety?

friends = []
for friend_email in user["friends"]:
fu = db.get_user_by_email(friend_email)
friends.append(json.loads(json_util.dumps(fu)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can optimize this later by having a single batch query. For now, this is good.

Copy link
Member Author

@RafaelPiloto10 RafaelPiloto10 Nov 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know the method off the top of your head? I forgot we could do that. I can do some research tomorrow otherwise

@RafaelPiloto10
Copy link
Member Author

is this ready for review?

yes, I'll add the label, thanks :D

Copy link
Contributor

@brendacano brendacano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@RafaelPiloto10 RafaelPiloto10 merged commit d785b1d into dev Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[13pts] Connect friends frontend to backend
3 participants