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

Add relations to getCurrentUser #56

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Conversation

snajima
Copy link
Contributor

@snajima snajima commented Nov 28, 2022

Overview

Add relations to getCurrentUser function which returns a user model for the @CurrentUser decorator. This was done since the relation fields in the UserModel were undefined

Changes Made

  • Above
  • Fixed some relations in the model files
  • Fixed test cases that were violating some FK constraints

Test Coverage

  • Jest tests all run

Next Steps (delete if not applicable)

Copy link
Member

@chalo2000 chalo2000 left a comment

Choose a reason for hiding this comment

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

LGTM

return await manager.findOne(UserModel, { id: userId });
// find a user with id `userId` and join with posts, saved,
// sessions, feedbacks, and requests
return await manager.findOne(UserModel, { id: userId }, { relations: ["posts", "saved", "sessions", "feedbacks", "requests"] });
Copy link
Member

Choose a reason for hiding this comment

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

this was Pear's downfall, let's keep an eye on how this performs when we release resell and if necessary we can up the RAM on the server..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh boy

Copy link
Contributor

@mateow99 mateow99 left a comment

Choose a reason for hiding this comment

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

Lgtm

@snajima snajima merged commit 0bc3305 into main Nov 28, 2022
@snajima snajima deleted the shungo/fix-current-user-decorator branch November 28, 2022 20:20
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.

3 participants