2023-10-10 22:26:07 +02:00
|
|
|
# you first have to add a user to create todos
|
|
|
|
|
|
|
|
query getUser {
|
2023-10-20 13:59:19 +02:00
|
|
|
user(id: 1) {
|
|
|
|
id
|
|
|
|
userName
|
|
|
|
fullName
|
|
|
|
todos {
|
|
|
|
id
|
|
|
|
text
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
query getTodo {
|
2023-10-20 13:59:19 +02:00
|
|
|
todo(id: 1) {
|
|
|
|
id
|
|
|
|
text
|
|
|
|
done
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
query getTodos {
|
2023-10-20 13:59:19 +02:00
|
|
|
todos {
|
|
|
|
id
|
|
|
|
text
|
|
|
|
done
|
|
|
|
user {
|
|
|
|
id
|
|
|
|
userName
|
|
|
|
fullName
|
|
|
|
todos {
|
|
|
|
id # you could continue this
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
query getUsers {
|
2023-10-20 13:59:19 +02:00
|
|
|
users {
|
|
|
|
id
|
|
|
|
userName
|
|
|
|
fullName
|
|
|
|
todos {
|
|
|
|
id # ...and this too
|
|
|
|
}
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mutation createTodo {
|
2023-10-20 13:59:19 +02:00
|
|
|
createTodo(input: { userId: 2, text: "adding a router and CSRF header" }) {
|
|
|
|
id
|
|
|
|
text
|
|
|
|
done
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mutation updateTodo {
|
2023-10-20 13:59:19 +02:00
|
|
|
updateTodo(id: 1, changes: { done: true }) {
|
|
|
|
id
|
|
|
|
text
|
|
|
|
done
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mutation createUser {
|
2023-11-17 19:09:01 +01:00
|
|
|
createUser(
|
|
|
|
input: {
|
|
|
|
userName: "1234Lorem"
|
|
|
|
fullName: "Lorem I."
|
|
|
|
password: "t1meToDoSometh1ng"
|
|
|
|
}
|
|
|
|
) {
|
2023-10-20 13:59:19 +02:00
|
|
|
id
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mutation updateUser {
|
2023-10-20 13:59:19 +02:00
|
|
|
updateUser(id: "1", changes: { fullName: "Lorem Ipsum" }) {
|
|
|
|
fullName
|
|
|
|
}
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
2023-11-17 19:09:01 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|