Skip to content

Instantly share code, notes, and snippets.

@DanishSiddiq
Last active May 10, 2020 12:32
Show Gist options
  • Save DanishSiddiq/59193eec42aea423a4709c18db9363e5 to your computer and use it in GitHub Desktop.
Save DanishSiddiq/59193eec42aea423a4709c18db9363e5 to your computer and use it in GitHub Desktop.
GraphQL Student Client Queries
query getStudent($studentId: String, $firstName: String) {
byId: findOne(input: {_id: $studentId}) {
...studentFields
}
byName: findOne(input: {firstName: $firstName}) {
...studentFields
}
}
mutation createStudent($firstName: String!, $lastName: String!, $registrationNumber: Int!, $email: String!) {
create(input: {firstName: $firstName, lastName: $lastName, registrationNumber: $registrationNumber, email: $email}) {
...studentFields
}
}
mutation updateStudent($studentId: String!, $firstName: String!) {
update(_id: $studentId, input: {firstName: $firstName}) {
code
msg
}
}
mutation deleteStudent($studentId: String!) {
delete(_id: $studentId) {
code
msg
}
}
fragment studentFields on Student {
_id
firstName
lastName
registrationNumber
email
createdAt
updatedAt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment