Skip to content

Instantly share code, notes, and snippets.

@hdoan741
Created November 23, 2020 19:38
Show Gist options
  • Select an option

  • Save hdoan741/bf51e5283b31dcb20f24f7b8a57913b5 to your computer and use it in GitHub Desktop.

Select an option

Save hdoan741/bf51e5283b31dcb20f24f7b8a57913b5 to your computer and use it in GitHub Desktop.
class AddTeacherToSite < Mutation
def required_arguments
[
model_or_id(:site, Site),
model_or_id(:teacher, Teacher),
]
end
def policy
# list the privacy policy required for this
end
def commit
# use passed in args to perform the update
end
end
# this call checks privacy policy, validates the args, and then calls commit
AddTeacherToSite.execute!(viewer, site: …, teacher: …)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment