Skip to content

Instantly share code, notes, and snippets.

@thebergamo
Forked from steveluscher/realworld.graphql
Last active November 10, 2017 16:56
Show Gist options
  • Save thebergamo/ec739d3ccd50488a6f511fddf3d80f47 to your computer and use it in GitHub Desktop.
Save thebergamo/ec739d3ccd50488a6f511fddf3d80f47 to your computer and use it in GitHub Desktop.
The schema for thebergamo/realworld-graphql
### Articles
type Article {
author: Profile!
body: String!
comments(first: Int, after: String): CommentsConnection
createdAt: String!
description: String!
favorited: Boolean!
favoritesCount: Int!
slug: String!
tags: [String],
title: String!
updatedAt: String!
}
type ArticleEdge {
cursor: String!
node: Article
}
type ArticlesConnection {
count: Int!
edges: [ArticleEdge]
pageInfo: PageInfo!
}
### Comments
type Comment {
author: Profile!
article: Article!
body: String!
createdAt: String!
updatedAt: String!
}
type CommentEdge {
cursor: String!
node: Comment
}
type CommentsConnection {
count: Int!
edges: [CommentEdge]
pageInfo: PageInfo!
}
type DeletionStatus {
success: Boolean!
}
type PageInfo {
endCursor: String
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
}
### Profile
type Profile {
articles(first: Int, after: String): ArticlesConnection
bio: String!
comments(first: Int, after: String): CommentsConnection
favorites(first: Int, after: String): ArticlesConnection
following: Boolean!
#image: String
user: User!
feed(first: Int, after: String): ArticlesConnection
}
### User
type User {
email: String!
profile: Profile!
token: String!
username: String!
}
## Mutations
# Input types.
input UpdateArticleInput {
body: String
description: String
title: String
}
input CreateArticleInput {
body: String!
description: String!
tags: [String]
title: String!
}
type ArticlePayload {
article: Article
}
type CommentPayload {
comment: Comment
}
input CreateUserInput {
email: String!
username: String!
password: String!
bio: String
#image: String // Skipping for a while
}
input UpdateUserInput {
bio: String
email: String
#image: String // Skipping for a while
password: String
username: String
}
type UserPayload {
user: User
}
type ProfilePayload {
profile: Profile
}
type Session {
token: String!
user: User
}
# Build the schema.
type Query {
article(slug: String!): Article
articles(
first: Int,
after: String,
authoredBy: String
favoritedBy: String
withTag: String
): ArticlesConnection
me: User
feed(first: Int, after: String): ArticlesConnection
profile(username: String!): Profile
tags: [String]
}
type Mutation {
### User & Profile
createUser(input: CreateUserInput): Session
authenticate(password: String!, email: String!): Session
updateUser(changes: UpdateUserInput!): UserPayload
profile(username: String!): ProfilePayload
followUser(username: String!): ProfilePayload
unfollowUser(username: String!): ProfilePayload
### Article
createArticle(input: CreateArticleInput!): ArticlePayload
updateArticle(changes: UpdateArticleInput!): ArticlePayload
favoriteArticle(slug: String!): ArticlePayload
deleteArticle(slug: String!): ArticlePayload
### Comment
addComment(slug: String!, body: String!): CommentPayload
deleteComment(id: ID!): CommentPayload
}
schema {
query: Query
mutation: Mutation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment