From Scratch

Send a complete meal plan and define the number of days of it. All the parameters such as days, recipes, etc., have to be introduced manually. All this information is later saved as a template.

Available Arguments

Refer to this document to see the available arguments to use in this mutation.

Examples

Create a meal plan template from scratch

The following example creates a one day meal plan:

mutation {
  createMealPlanTemplate(
    name: "New meal plan template"
    description: "The very first"
    fromScratch: {
      days: [
        {
          meals: [
            {
              recipeId: "UmVjaXBlOmFmMDkzMjQ0LWZkZTMtNGE3Yy1iMTA4LWUxODExNTBkNmNiZQ=="
              mealType: BREAKFAST
              servings: 2
            }
          ]
        }
      ]
    }
  ) {
    message
    success
  }
}

Create a 2-day meal plan

The following example creates a two-day meal plan

mutation {
  createMealPlanTemplate(
    name: "Vegetarian Meal Plan"
    description: "All meal types"
    fromScratch: {
    days: [
    {
        meals: [
        {
            recipeId: "UmVjaXBlOjE2OTBlMjU1LWFhZGUtNDA2Yy05MTJiLWZhYTI0MDVmYTk2Zg=="
            mealType: BREAKFAST
            servings: 2
        },
        {
            recipeId: "UmVjaXBlOjE1MDk0MDQxLTYyMWItNGM0Ni04OGViLTUzM2FlNmRlMTI4Zg=="
            mealType: SNACK
            servings: 3
        }
       ]
    },
    {
        meals: [
            {
            recipeId: "UmVjaXBlOjE2OTBlMjU1LWFhZGUtNDA2Yy05MTJiLWZhYTI0MDVmYTk2Zg=="
            mealType: BREAKFAST
            servings: 2
            }
        ]
    }
    ]
}
  ) {
    message
    success
  }
}

The meal plan generated will have the following format:

{
  "data": {
    "mealPlan": [
      {
        "day": 2,
        "date": "2022-01-15",
        "calories": 1261.637375,
        "meals": [
          {
            "id": "TWVhbDoyMzQwMDQ5",
            "calories": 1261.637375,
            "meal": "breakfast",
            "numOfServings": 2,
            "recipe": {
              "name": "Coconut Milk Yogurt With Fruit And Nuts",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 1261.64
              }
            }
          }
        ]
      },
      {
        "day": 1,
        "date": "2022-01-14",
        "calories": 1775.813475,
        "meals": [
          {
            "id": "TWVhbDoyMzQwMDQ3",
            "calories": 1261.637375,
            "meal": "breakfast",
            "numOfServings": 2,
            "recipe": {
              "name": "Coconut Milk Yogurt With Fruit And Nuts",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 1261.64
              }
            }
          },
          {
            "id": "TWVhbDoyMzQwMDQ4",
            "calories": 514.1761,
            "meal": "snack",
            "numOfServings": 3,
            "recipe": {
              "name": "Apple-Orange Smoothie With Yogurt",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 514.18
              }
            }
          }
        ]
      }
    ]
  }
}

Last updated