Skip to content

Instantly share code, notes, and snippets.

@frectonz
Created February 13, 2023 08:25
Show Gist options
  • Save frectonz/5a105a46470f262cc52aab8fd8116f0b to your computer and use it in GitHub Desktop.
Save frectonz/5a105a46470f262cc52aab8fd8116f0b to your computer and use it in GitHub Desktop.
type Query {
hello: String!
allPosts(query: PostsQuery): [Post!]!
featuredPosts(query: PostsQuery): [Post!]!
postsInCategory(categoryId: Int!, query: PostsQuery): [Post!]!
allTags(query: TagsQuery): [Tag]
viewer: User!
}
type Post {
id: Int!
slug: String!
featured: Boolean!
title: String!
content: String!
createdAt: DateTime!
updatedAt: DateTime!
tags: [Tag!]!
likeCount: Int!
likedByViewer: Boolean!
}
input NewPost {
title: String!
content: String!
categoryId: Int!
tags: [String!]!
}
input UpdatePost {
title: String
content: String
categoryId: Int
tags: [String!]
}
type Mutation {
createPost(newPost: NewPost!): Post!
updatePost(id: Int!, updatePost: UpdatePost!): Post!
deletePost(id: Int!): Boolean!
likePost(id: Int!): Post!
createTag(name: String!): Tag
updateUserDetails(details: UserDetailsInput!): User!
}
input PostsQuery {
limit: Int
offset: Int
sortBy: SortKey
sortDirection: SortDirection
}
enum SortKey {
createdAt
likeCount
viewCount
}
enum SortDirection {
asc
desc
}
input TagsQuery {
limit: Int
offset: Int
search: String
}
type Tag {
name: String!
slug: String!
posts(query: PostsQuery): [Post]
}
scalar DateTime
type User {
id: Int!
email: String!
username: String!
avatarUrl: String
bio: String
website: String
location: String
occupation: String
githubUsername: String
twitterUsername: String
instagramUsername: String
blocked: Boolean!
emailVerified: Boolean!
createdAt: DateTime!
updatedAt: DateTime!
posts(query: PostsQuery): [Post!]!
}
input UserDetailsInput {
bio: String
location: String
website: String
occupation: String
githubUsername: String
twitterUsername: String
instagramUsername: String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment