query Posts($limit: Int!, $cursor: String) {
posts(cursor: $cursor, limit: $limit) {
hasMore
posts {
id
title
points
descriptionSnippet
createdAt
updatedAt
voteStatus
author {
id
username
email
}
}
}
}
query Post($id: Int!) {
post(id: $id) {
id
title
description
authorId
points
createdAt
updatedAt
}
}
query Me {
me {
id
username
}
}
##Mutations
mutation CreatePost($input: PostInput!) {
createPost(input: $input) {
id
title
description
authorId
points
createdAt
updatedAt
}
}
mutation UpdatePost(
$id: Int!
$authorId: Int!
$title: String!
$description: String!
) {
updatePost(
id: $id
authorId: $authorId
title: $title
description: $description
) {
id
title
description
descriptionSnippet
}
}
mutation DeletePost($id: Int!, $authorId: Int!) {
deletePost(id: $id, authorId: $authorId)
}
mutation Login($email: String!, $password: String!) {
login(email: $email, password: $password) {
errors {
field
message
}
user{
id
username
email
createdAt
}
}
}
mutation Register($email: String!, $username: String!, $password: String!) {
register(
options: { email: $email, username: $username, password: $password }
) {
errors {
field
message
}
user{
id
username
email
}
}
}
mutation Logout {
logout
}
mutation Vote($value: Int!, $postId: Int!) {
vote(value: $value, postId: $postId)
}
mutation ForgotPassword($email: String!) {
forgotPassword(email: $email)
}
mutation ChangePassword($token: String!, $newPassword: String!) {
changePassword(token: $token, newPassword: $newPassword) {
errors {
field
message
}
user{
id
username
email
}
}
}