-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathblog.graphql
102 lines (81 loc) · 2.11 KB
/
blog.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
"""
Comment is a comment on a post.
"""
type Comment implements Linkable {
id: ID!
post: Post
user: User!
content: String!
created: Time!
modified: Time!
"uri returns an absolute link to this comment."
uri: URI!
}
"""
A post is an individual post in the blog.
"""
type Post implements Linkable {
id: ID!
title: String!
content: String!
summary: String!
readtime: Int!
social_image: URI!
"datetime is the published time of an article."
datetime: Time!
created: Time!
modified: Time!
draft: Boolean!
tags: [String!]!
"links are the links referenced in a post."
links: [Link]!
"uri returns an absolute link to this post."
uri: URI!
next: Post
prev: Post
"A list of related posts. Maximum returned will be 10."
related(input: Limit): [Post]!
comments(input: Limit): [Comment]!
}
input EditPost {
id: ID
content: String
title: String
datetime: Time
draft: Boolean
}
input Limit {
limit: Int
offset: Int
}
input AddComment {
content: String!
post_id: ID!
}
extend type Query {
"Returns an array of inprogress posts."
drafts(input: Limit): [Post]! @hasRole(role: admin)
"Returns an array of unpublished posts."
futurePosts(input: Limit): [Post]! @hasRole(role: admin)
"Returns an array of all posts, ordered by reverse chronological order, using provided limit and offset."
posts(input: Limit): [Post]!
"Returns most recent comments for all published posts."
comments(input: Limit): [Comment]!
"Returns a selection of posts that match the search."
search(query: String!, input: Limit): [Post]!
"Returns a single post by ID."
post(id: ID!): Post
"Returns post id for the next post chronologically."
nextPost(id: ID!): Post
"Returns post id for the previous post chronologically."
prevPost(id: ID!): Post
"Returns all posts that contain a tag."
postsByTag(id: String!): [Post]!
"Returns all tags used in a post."
tags: [String!]!
}
extend type Mutation {
addComment(input: AddComment!): Comment! @loggedIn
createPost(input: EditPost!): Post! @hasRole(role: admin)
editPost(input: EditPost!): Post! @hasRole(role: admin)
}