-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.ts
163 lines (134 loc) · 2.67 KB
/
schema.ts
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import { buildSchema } from 'graphql';
const schema = buildSchema(`
scalar DateTime
enum Role {
USER
ADMIN
}
type User {
avatar: String!
createdAt: DateTime!
displayName: String
id: ID!
uid: ID!
inactive: Boolean!
updatedAt: DateTime!
posts(input: PaginationInput): PostConnection!
comments(input: PaginationInput): CommentConnection!
role: Role!
}
type Post {
content: String
createdAt: DateTime
comments: [Comment!]
id: ID!
isDraft: Boolean!
title: String!
updatedAt: DateTime
previewImage: String
images: [String!]
upvotes: Int!
user: User!
}
type Comment {
createdAt: DateTime
id: ID!
post: Post!
text: String!
updatedAt: DateTime
upvotes: Int
user: User!
}
input CreateUserInput {
avatar: String
displayName: String
}
input UpdateUserInput {
avatar: String
displayName: String
}
input CreatePostInput {
title: String!
content: String
previewImage: String
images: [String!]
}
input UpdatePostInput {
id: ID!
}
input PublishPostInput {
id: ID!
}
input DeletePostInput {
id: ID!
}
input CreateCommentInput {
postId: ID!
text: String!
}
input UpdateCommentInput {
id: ID!
text: String!
}
input DeleteCommentInput {
id: ID!
}
input PostInput {
id: ID!
}
type PageInfo {
cursor: String
hasMore: Boolean!
}
type CommentEdge {
cursor: String!
node: Comment!
}
type PostEdge {
cursor: String!
node: Post!
}
type UserEdge {
cursor: String!
node: User!
}
type UserConnection {
edges: [UserEdge!]!
pageInfo: PageInfo!
}
type PostConnection {
edges: [PostEdge!]!
pageInfo: PageInfo!
}
type CommentConnection {
edges: [CommentEdge!]!
pageInfo: PageInfo!
}
input PaginationInput {
first: Int
after: String
}
input UserInput {
uid: ID!
}
type Query {
currentUser: User!
user(input: UserInput!): User!
users(input: PaginationInput): UserConnection!
posts(input: PaginationInput): PostConnection!
comments(input: PaginationInput): CommentConnection!
post(input: PostInput!): Post!
}
type Mutation {
updateUser(input: UpdateUserInput!): User
deleteUser: User
createPost(input: CreatePostInput!): Post
updatePost(input: UpdatePostInput!): Post
publishPost(input: PublishPostInput!): Post
deletePost(input: DeletePostInput!): Post
createComment(input: CreateCommentInput!): Comment
updateComment(input: UpdateCommentInput!): Comment
deleteComment(input: DeleteCommentInput!): ID
}
`);
export default schema;