User's Restrictions

Update a user's food restrictions (food preferences).

Use the profileRestrictionsUpdate mutation to update a user's food restrictions.

A list of all the available food restrictions can be retrieved using the Restrictions query.

Required Argument

Arguments

Type

Description

restrictions

[ID]

Array of restrictions ID's

Available Argument

Argument

Type

Description

replace

Boolean

If true, the profile restrictions are set to only the IDs sent in the mutation. If false, the restrictions received are added to the current ones. If this argument is not sent, by default its value will be set to True.

Vegan and vegetarian are very common use cases, for those, please set the following restrictions:

  • For vegetarian, activate the R Animal Origin (non-vegetarian) restriction. Id: UmVzdHJpY3Rpb246ZDY3NTA1MTktZTE4Zi00NWRkLTgxZWYtODAyNzk0MzYyZWRl

  • For vegan, activate the R Animal Origin (all) restriction, Id: UmVzdHJpY3Rpb246YzhmODQwMmMtYzEyNi00OWM3LWEyMzEtNWNmNjI0ZDlmNTlj

Examples

The following example adds two restrictions to the current user's profile:

mutation {
  profileRestrictionsUpdate(
    restrictions: [
      "UmVzdHJpY3Rpb246M2ZmZDQ1OGUtMjczZi00MTZmLWE5NjYtNmFkYzliYjQ3OWE1",
      "UmVzdHJpY3Rpb246ODU1ZjkzZjYtODQzOC00MTIzLTk3YzktM2U2YzU2MzllZjli"
    ]) {
    success
  }
}

Note that the replace argument is not defined; therefore, those will be the only two restrictions set to the current user's profile.

Validate that the restrictions are successfully updated using the My Profile query to obtain a list of restrictions currently set to the user's profile.

{
  myProfile {
    programName
    restrictions{
      id
      name
      isOnProgram
      subcategory
      slugname 
    }
  }
}

In the following example, the replace argument is set as False:

mutation {
  profileRestrictionsUpdate(
    restrictions: [
      "UmVzdHJpY3Rpb246NDI3MDM0MTEtNDA3OC00NTkyLWE1YjctNDgxM2I2NzMwYjg3"
    ]
    replace: false
    ) 
  {
    success
  }
}

Use the My Profile query to obtain a list of restrictions currently set to the user's profile. See that the new restriction has been added to the list of user's restrictions:

{
  myProfile {
    programName
    restrictions{
      id
      name
      isOnProgram
      subcategory
      slugname 
    }
  }
}

Last updated