Skip to content

Sprint 3

Dylan Havelock edited this page Mar 16, 2020 · 7 revisions

remove existing user

add food item to meal

query meals by fooditem

query meals by macronutrients

edit date & time of meal entry

query meal entries by macronutrients

/profile/lockout/

DELETE

Remove an existing user
// Request
{
    "email:" "user.to.delete@aol.com"
}

// Response
{
    "message": "User user.to.delete@aol.com is deleted"
}

/nutri/meal/

PUT

Add fooditem to a meal
// Request
{
    "meal": 76,
    "fooditem": 724
}

// Response
{
    "meal": {
        "id": 76,
        "fooditems": [
            {
                "id": 723,
                "name": "Apple",
                "protein": 1,
                "carb": 19,
                "fat": 0,
                "user": 1332
            },
            {
                "id": 724,
                "name": "Avocado",
                "protein": 3,
                "carb": 4,
                "fat": 21,
                "user": 1332
            }
        ],
        "name": "fruits",
        "protein": 4,
        "carb": 23,
        "fat": 21,
        "user": 1332
    }
}

/nutri/meal/item/

GET

query meals by fooditem
//request
{
	"fooditems": [724] // or could do something like [723, 724]
}
// response
{
    "meals": [
        {
            "id": 76,
            "fooditems": [
                {
                    "id": 723,
                    "name": "Apple",
                    "protein": 1,
                    "carb": 19,
                    "fat": 0,
                    "user": 1332
                },
                {
                    "id": 724,
                    "name": "Avocado",
                    "protein": 3,
                    "carb": 4,
                    "fat": 21,
                    "user": 1332
                }
            ],
            "name": "fruits",
            "protein": 4,
            "carb": 23,
            "fat": 21,
            "user": 1332
        },
        {
            "id": 78,
            "fooditems": [
                {
                    "id": 724,
                    "name": "Avocado",
                    "protein": 3,
                    "carb": 4,
                    "fat": 21,
                    "user": 1332
                }
            ],
            "name": "keto",
            "protein": 3,
            "carb": 4,
            "fat": 21,
            "user": 1332
        }
    ]
}

/nutri/meal/range

GET

query meals by macronutrients
// request
{
        fat_low: 12, ... // each of these params is optional and defaults to 0 or MAX_VALUE
        fat_high 
        carb_low
        carb_high
        protein_low 
        protein_high
}

// response
{
    list of meals, same as query by fooditem 
}

/

method

edit date & time of meal entry
// request
{
	"meal_entry": 9,
	"timestamp": "2020-01-06T21:49:23.699442Z"
}

// response
{
    "mealentry": {
        "id": 9,
        "timestamp": "2020-01-06T21:49:23.699442Z",
        "user": 1332,
        "meal": 76
    }
}

/

method

query meal entries by macronutrients
// request
{
        // same as query meal by macro
	"carb_low": 20
        ...
        carb_high
        fat_low
        fat_high
        protein_low 
        protein_high
}

// response
{
    "mealentries": [
        {
            "id": 9,
            "timestamp": "2020-01-06T21:49:23.699442Z",
            "user": 1332,
            "meal": 76
        },
        {
            "id": 10,
            "timestamp": "2020-03-16T21:51:06.799247Z",
            "user": 1332,
            "meal": 76
        }
    ]
}

Clone this wiki locally