MuscleMate / BackEnd

API for MuscleMate app
3 stars 0 forks source link

Implement middleware checking if "Win tournament" challenge was completed #49

Open VEXI19 opened 4 months ago

VEXI19 commented 4 months ago

Create middleware inside challengeComplete.js file, which is going to check if there is a challenge with goal "Win tournament" and if so create mechanism for checking if that challenge was completed.

Also you need to update challenges list inside user scheme. Changing challenge status to completed and creating new challenge with function drawChallenges that will be the same difficulty as the one completed.

In the end you need to place that middleware in parts of pipeline where challenge with goal "Win tournament" can be completed. Ex. "Completed workouts" goal can be met after ending a workout, so you should add that middleware in routes file before endWorkout.

v4m3rrr commented 3 months ago

What does it mean when someone wins a tournament? What criteria must be met for that to happen?

v4m3rrr commented 3 months ago

Can I assume that in the middleware, we are guaranteed that the userID from the authentication middleware is present in req.body.user?

VEXI19 commented 3 months ago

What does it mean when someone wins a tournament? What criteria must be met for that to happen?

Checking for winning tournament is not yet implemented. I will let you know when it will be and then you can do this issue

VEXI19 commented 3 months ago

Can I assume that in the middleware, we are guaranteed that the userID from the authentication middleware is present in req.body.user?

yes