-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
169 lines (140 loc) · 3.83 KB
/
schema.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
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
164
165
166
167
168
169
### This file was generated by Nexus Schema
### Do not make changes to this file directly
type BatchPosts {
cursorId: String!
posts: [Post]
}
union BatchPostsResponse = BatchPosts | CommonError
type Comment {
createdAt: DateTime!
id: String!
post: Post
text: String!
user: User
votes: [CommentVote]
}
union CommentResponse = Comment | CommonError
type CommentVote {
comment: Comment
createdAt: DateTime!
id: String!
type: VoteType!
votedBy: User
}
union CommentVoteResponse = CommentVote | CommonError
type CommonError {
message: String!
}
type Community {
banner: String!
createdAt: DateTime!
creator: User
description: String!
id: String!
members: [User]!
picture: String!
posts: [Post]
title: String!
}
type CommunityList {
communities: [Community]
}
union CommunityListResponse = CommonError | CommunityList
union CommunityResponse = CommonError | Community
"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
"""
scalar DateTime
enum FilterType {
NEW
TOP
}
type IRefresh {
success: Boolean!
}
union LogoutResponse = CommonError | Success
type Mutation {
authenticate: UserResponse!
createBookmark(postId: String!): PostResponse!
createComment(postId: String!, text: String!): CommentResponse!
createCommunity(description: String!, name: String!): CommunityResponse!
createPost(community: String!, content: String!, title: String!): PostResponse!
createUser(email: String!, name: String!, password: String!): UserResponse!
joinCommunity(communityId: String!): CommunityResponse!
leaveCommunity(communityId: String!): CommunityResponse!
login(email: String!, password: String!): UserResponse!
logout: LogoutResponse!
refresh: RefreshResponse!
register(email: String!, name: String!, password: String!): UserResponse!
removeBookmark(postId: String!): PostResponse!
removeCommentVote(commentId: String!, voteId: String!): CommentVoteResponse!
removeVote(communityId: String!, postId: String!, voteId: String!): VoteResponse!
vote(data: VoteArgs): VoteResponse!
voteComment(commentId: String!, type: VoteType!): CommentVoteResponse!
}
type Password {
id: String!
password: String!
user: User
}
type Post {
bookmarkedBy: [User]
comments: [Comment]
community: Community
content: String!
createdAt: DateTime!
id: String!
postedBy: User
title: String!
votes: [Vote]!
}
union PostResponse = CommonError | Post
type Query {
fetchAllCommunities: CommunityListResponse!
fetchAllPostsByTime(cursorId: String, skip: Int, take: Int!): BatchPostsResponse!
fetchAllPostsByVotes(cursorId: String, take: Int!): BatchPostsResponse!
fetchAllUserPostsByTime(cursorId: String, skip: Int, take: Int!): BatchPostsResponse!
fetchAllUserPostsByVote(cursorId: String, skip: Int, take: Int!): BatchPostsResponse!
fetchCommunity(name: String!): CommunityResponse!
fetchPost(postId: String!): PostResponse!
fetchUser: UserResponse!
fetchUserBookmarks(cursorId: String, take: Int!): BatchPostsResponse!
}
union RefreshResponse = CommonError | IRefresh
type Success {
success: Boolean!
}
type User {
bookmarks: [Post]
commentVotes: [CommentVote]!
commentedOn: [Comment]
communitiesCreated: [Community!]
createdAt: DateTime!
email: String!
id: String!
joinedCommunities: [Community!]
name: String!
password: Password
picture: String!
posts: [Post]
tokenVersion: Int!
votes: [Vote]
}
union UserResponse = CommonError | User
type Vote {
createdAt: DateTime!
id: String!
post: Post
type: VoteType!
voteUser: User
}
input VoteArgs {
communityId: String!
postId: String!
type: VoteType!
}
union VoteResponse = CommonError | Vote
enum VoteType {
DOWNVOTE
UPVOTE
}