It passing all the tests except one where we have to add data to the exercise at /api/exercise/add.
This is what showing when to submit my solution- // running tests I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use the current date. App will return the user object with the exercise fields added. // tests completed
if any user exists in your database, you will just add the exercise details in an array of exercise under that user/username,
if user not found in the database you will add all the data including username by one click on the submit/add,
if user exist && if it has listed exercise in the database then you’ll just add/push the newly submitted exercise to exercise array in the database, other data will remain unchanged
you won’t make many users by same name
when you add the data you must include all data as mentioned here
since, date is optional, if the user gives no date- your code will record the current date (here you need condition)
finally you will return the last update data from the database, not all
If you follow the steps with a fresh mind, I hope you will get the point and solve the issues. But do not update username or _id for any case.
I checked your code, which has no connection with any database but you should, because this is not only to pass the test but it is the matter of your learning.