YetAnotherToDoList/example.graphql

143 lines
1.6 KiB
GraphQL
Raw Normal View History

# you first have to add a user to create todos
query getUser {
user(id: 1) {
id
userName
fullName
todos {
id
text
done
}
}
}
query getTodo {
todo(id: 1) {
id
text
done
}
}
query getTodos {
todos {
id
text
done
user {
id
userName
fullName
todos {
id # you could continue this
}
}
}
}
query getUsers {
users {
id
userName
fullName
todos {
id # ...and this too
}
}
}
mutation createTodo {
createTodo(input: { userId: 2, text: "adding a router and CSRF header" }) {
id
text
done
}
}
mutation updateTodo {
updateTodo(id: 1, changes: { done: true }) {
id
text
done
}
}
mutation createUser {
createUser(
input: {
userName: "1234Lorem"
fullName: "Lorem I."
password: "t1meToDoSometh1ng"
}
) {
id
}
}
mutation updateUser {
updateUser(id: "1", changes: { fullName: "Lorem Ipsum" }) {
fullName
}
}
query getRefreshTokens {
refreshTokens {
id
userId
tokenName
}
}
mutation createRefreshToken {
createRefreshToken(input: { tokenName: "myNewDevice" }) {
userId
tokenName
selector
token
}
}
mutation deleteRefreshToken {
deleteRefreshToken(id: 1)
}
query getRoles {
roles {
id
roleName
}
}
query getRole {
role(id: 2) {
id
roleName
}
}
mutation createRole {
createRole(
input: { roleName: "moderator", isAdmin: false, isUserCreator: true }
) {
id
}
}
mutation deleteRole {
deleteRole(id: 2)
}
mutation addRole {
addRole(userId: 1, roleId: 2) {
roleName
}
}
mutation removeRole {
removeRole(userId: 2, roleId: 1) {
roleName
}
}