YetAnotherToDoList/example.graphql

177 lines
2.0 KiB
GraphQL
Raw Permalink 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
}
roles {
role {
id
roleName
isAdmin
isUserCreator
}
userIsRoleManager
}
}
}
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
roleMembers {
user {
id
}
}
}
}
query getRole {
role(id: 2) {
id
roleName
roleMembers {
user {
id
}
}
}
}
mutation createRole {
createRole(
input: { roleName: "moderator", isAdmin: false, isUserCreator: true }
) {
id
}
}
mutation deleteRole {
deleteRole(id: 2)
}
mutation addUserRole {
addUserRole(userId: 1, roleId: 2, userIsRoleManager: false) {
role {
roleName
}
userIsRoleManager
}
}
mutation updateUserRole {
2024-02-02 21:31:50 +01:00
updateUserRole(userId: 1, roleId: 2, userIsRoleManager: true) {
role {
roleName
}
userIsRoleManager
}
}
mutation removeUserRole {
removeUserRole(userId: 2, roleId: 1) {
role {
roleName
}
userIsRoleManager
}
}