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 reset last submission route #45

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

terror
Copy link
Member

@terror terror commented Aug 8, 2020

Implements a new patch route /users/:userId/resetLastSubmission, part of issue: competemcgill/wisp#41

} else {
try {
const { userId } = req.params;
await userDBInteractions.resetLastSubmission(userId);
Copy link
Member

Choose a reason for hiding this comment

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

"resetLastSubmission" should be called after we make sure that the user exists

Comment on lines +247 to +250
const updatedUser: IUserModel = await userDBInteractions.update(
userId,
user
);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you updating here if the "user" variable is unchanged? I suggest you either call the new resetLastSubmission DB interaction here or you manually update the "user" by setting the lastSubmission to {} then calling the update DB interaction (I prefer the second option since it allows us to reuse an premade DB interaction instead of making a new one).

@terror terror requested a review from MohamedBeydoun August 8, 2020 17:06
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.

2 participants