spruhaN / nutrition_pal

1 stars 1 forks source link

Schema/API Design Comments (James Irwin) #4

Open irwinj22 opened 1 month ago

irwinj22 commented 1 month ago

The API schema is also good! I have some suggestions, though:

  1. POST/user — What are the units for height and weight supposed to be? I believe they are not specified within the API doc.
  2. POST/goal — Per the API doc, the possibilities for type should be “diet” or “exercise”, but I can enter in nonsense (“Ertyui”) and still get an “OK” response. Maybe that should be changed so that an error is raised?
  3. POST/workout — I find it unclear whether the options for name are restricted or not. Per main.py (line 80): “May have restricted workout where the only options are like pushup, pull-up, cardio atm”
  4. POST/workout — I keep getting an internal service error with this input (fairly confident that CustomerID exists and is correct — I am able to POST/goals, meal) 
{ 
"name": "squats", 
"sets": 10,
"reps": 1,
"length": 5
}
—> I realized later it may be because name doesn’t exist within workout table?
  5. API spec includes “1.9 See workout you’ve done for that type - /workout/personal/muscle_groups/{type}” but that endpoint is not defined on the API. Maybe it is yet to be done?
  6. As far as I can tell, GET/workouts will return an empty set if the customer ID does not exist .. maybe this should raise an error instead, as the user is searching for something that cannot possibly exist?
  7. GET/meal returns name, calories, time, and type, but when a user insert the meal (POST/meal) the only params are name and calories … does this mean that type is always going to be NULL?
  8. For POST/user, the weight and height will take decimals, but the types are specified as ints … maybe that should raise an error?
  9. POST/goals - Per API spec, type can be either diet or workout … but what if a user wants to do both? Do they have to enter two goals with the same daily_calories each time?
  10. GET/workout — From what I understand, there is no way to get the workouts for more than one day at a time .. maybe it would be beneficial for user to get workouts from the last week? Month?
  11. Organization — maybe it would be best to order the endpoints by their respective types (/user, /goals, /workout, etc)
  12. Once again, there is no endpoint that allows the application to make suggestions to the user … maybe that is something that has yet to be implemented?