Last active
May 10, 2020 12:32
-
-
Save DanishSiddiq/59193eec42aea423a4709c18db9363e5 to your computer and use it in GitHub Desktop.
GraphQL Student Client Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
createdAt | |
updatedAt | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment