Open rcereno opened 1 month ago
Copied this from project's example flow file but above comment was my own personal flows yet still tests these different type of flows the group project listed:
Stephanie has some goals and wants to start tracking her calories and meals.
First she POST /goals passing “lose weight”, “diet” and 2000
Next she eats food and does a POST /meal passing “Mexican” and 800.
She wants to see how many calories she has left GET /daily_calories returning 1200.
She then eats a pizza, POSTS /meal passing “Italian” 1200.
Checks calories with GET /daily_calories, returns 0.
Next day GET /meal/day returning a list of meals with an id, type, calorie, and time stamp
curl -X 'POST' \ 'https://fast-api-practice.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Stephanie", "weight": 100, "height": 100 }'
{ "id" : 41 }
curl -X 'POST'
'https://nutrition-pal.onrender.com/goals/41'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"goal": "lose weight",
"type": "diet",
"daily_calories": 2000
}'
"OK"
curl -X 'POST'
'https://nutrition-pal.onrender.com/meal/41'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Mexican",
"calories": 800
}'
"OK"
curl -X 'GET'
'https://nutrition-pal.onrender.com/daily_calories/41'
-H 'accept: application/json'
{
"calories_left": 1200
}
curl -X 'POST'
'https://nutrition-pal.onrender.com/meal/41'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Italian",
"calories": 1200
}'
"OK"
curl -X 'GET'
'[https://fast-api-practice.onrender.com/daily_calories/41’](https://fast-api-practice.onrender.com/daily_calories/41%E2%80%99)
-H 'accept: application/json'
{
"calories_left": 0
}
curl -X 'GET'
'https://fast-api-practice.onrender.com/meal/41/day'
-H 'accept: application/json'
[
{
"name": "Mexican",
"calories": 800,
"time": "2024-05-21T03:15:08.626102+00:00",
"type": null
},
{
"name": "Italian",
"calories": 1200,
"time": "2024-05-21T03:17:52.809226+00:00",
"type": null
}
]
Marc wants to build muscle
Marc enters his goals by calling POST /goals passing “get big”, “workout”, 2800.
He then begins adding workouts with with POST /workout passing “push-up”, 3, 10, 14.
He does this with multiple workouts at varying lengths, set, reps.
His friends asks him what workouts he’s done, so he GET /workouts/days and returns a list of workout with “id”, “name”, “sets”, “reps”, “length”, and “time”
His friend asks what to do for back, GET /workout/muscle_group/{type} passing “back” as type and returns a list of workouts “id”, “name”, “sets”, “reps”, “length”, and “time”, for the back
Create Marco's Information
curl -X 'POST'
'https://nutrition-pal.onrender.com/user'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Marco”,
"weight": 150,
"height": 189
}'
{
"id" : 42
}
Marco enters his goals:
curl -X 'POST'
'https://nutrition-pal.onrender.com/goals/42'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"goal": "get big",
"type": "workout",
"daily_calories": 2800
}'
"OK"
Marco adds his deadlift workout:
curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/42’](https://nutrition-pal.onrender.com/workout/42%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "deadlift",
"sets": 3,
"reps": 10,
"length": 2
}'
"OK"
Marco adds more workouts:
curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/42’](https://nutrition-pal.onrender.com/workout/42%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "pull_up",
"sets": 3,
"reps": 10,
"length": 50
}'
"OK"
Marco checks what he has done:
curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/42/day'
-H 'accept: application/json'
[
{
"id": 15,
"name": "deadlift",
"type": "legs",
"group": "glutes",
"sets": 3,
"reps": 10,
"length": 2
},
{
"name": "pull_up",
"sets": 3,
"reps": 10,
"length": 50
}'
Marco checks for back workouts
curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/muscle_groups/back'
-H 'accept: application/json'
[
{
"name": "lat_pulldown",
"type": "back",
"group": "lats"
},
{
"name": "cable_row",
"type": "back",
"group": "traps"
},
{
"name": "pull_up",
"type": "back",
"group": "lats"
},
{
"name": "bent_over_dumbell_row",
"type": "back",
"group": "lats"
}
]
Andrew M. is jealous of his roommate’s incredible physique.
Andrew starts with a POST /goals passing “get big”, “workout”, 2800.
He posts a workout POST /workout “pull-up”, 3, 4, 10.
He does this for a variety of workouts.
He wants to see what his workouts hit so he starts with GET /workout/day and gets a list of “id”, “name”, “sets”, “reps”, “length”, and “time”
He wants to see what his chest-press hits so he does a GET /workout/{id}/muscle_groups passing an id in that was in the prior return.
This returns a list of strings [“chest”, “triceps”, “shoulders”]
Create an account for Andrew M.:
curl -X 'POST'
'https://nutrition-pal.onrender.com/user'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Andrew M.",
"weight": 90,
"height": 189
}'
{
"id": 43
}
Andrew sets a goal:
curl -X 'POST'
'[https://nutrition-pal.onrender.com/goals/43’](https://nutrition-pal.onrender.com/goals/43%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"goal": "get huge",
"type": "workout",
"daily_calories": 5000
}'
"OK"
Andrew posts a workout:
curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/43’](https://nutrition-pal.onrender.com/workout/43%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "squat",
"sets": 20,
"reps": 20,
"length": 0
}'
"OK"
Andrew wants to see what workouts to hit:
curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/43/day'
-H 'accept: application/json'
[
{
"id": 20,
"name": "squat",
"type": "legs",
"group": "quads",
"sets": 20,
"reps": 20,
"length": 0
}
]
Andrew wants to see his squat hits:
curl -X 'GET'
'https://nutrition-pal.onrender.com/workout/20/muscle_groups'
-H 'accept: application/json'
[
{
"name": "squat",
"type": "legs",
"group": "quads"
}
]
Example Workflow (I wrote it out on GitHub then it disappeared /did not save so rewrote this again)
Flow 1: Create User and Log a Goal and a Workout.
POST /user
Test Results / Response Body
AND POST /goals/{customer_id}
AND
AND
AND
**Flow 2: Make a calorie goal, log meals/calories eaten, and look up meals of day and calories left.
POST /goals/{customer_id}
Test Result / Response Body
GET /daily_calories/{customer_id}
Test Result / Response Body
POST /meal/{customer_id}
Test Result / Response Body
GET /daily_calories/{customer_id}
Test Result / Response Body
GET /meal/{customer_id}/day
Test Result / Response Body
Flow 3: Get a set of workouts based off of muscle groups and muscle types
GET /workouts/{customer_id}/day
Test Results / Response Body
GET /workouts/muscle_groups/{type}
Test Results / Response Body
GET /workout/{workout_id}/muscle_groups
Test Results / Response Body
Flow 4: Create new user to database and add a workout. Then check their workout of the day
POST /user
Test Result / Response Body
POST /workout/{customer_id}
Test Results / Response Body
GET /workouts/{customer_id}/day
Test Result / Response Body