This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
237 lines (171 loc) · 4.96 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# This node serves as an immutable entrypoint to the graph. It contains fields which we can use for traversing through the graph and obtaining information.
type Query {
# Echoes the authorization token of the user.
token: String
# Gets the details of the User mentioned in arguments.
user(name: String, id: ID): User
# Gets the details of the Role mentioned in arguments.
role(name: String, id: ID): Role
# Gets the details of the Profile mentioned in arguments.
profile(id: ID!): Profile
# Check if a User is subscribed to a Course.
isSubscribed(userID: ID!, courseID: ID!): Boolean
# Get the Post with a matching ID.
post(id: ID!): Post
# Get a list of Posts with a matching search query.
posts(q: String, offset: Int): [Post]
# Get the Course with a matching ID.
course(id: ID!): Course
# Get a list of Courses with matching names.
courses(name: String): [Course]
}
# This node holds all the necessary user details.
type User {
uuid: ID!
# A unique username.
name: String!
# Profile that maps to this User.
profile: Profile
# Posts written by this Person.
posts(offset: Int): [Post]!
# Roles that the User is assigned.
roles: [Role]!
}
# This node holds additional information related to a User.
type Profile {
userID: ID!
about: String!
# User that maps to this profile.
user: User!
# The full name of the profile.
fullName: String!
# URL to the display picture of the profile.
display_pic: String!
# The list of courses the user has subscribed to.
interests: [Course]!
}
type Course {
uuid: ID!
# Name of the course.
name: String!
# Moderator roles for the course.
mods: [Role!]!
# Course Description.
description: String
# Users subscribed to the course.
subscribers(offset: Int): [Profile]
# TODO
posts(offset: Int): [Post]
}
# This node describes a Role for a list of users.
type Role {
uuid: ID!
# The name of the role.
name: String!
# List of users that have the role.
users: [User]!
}
# This node holds all Post details, and references to their comments.
type Post {
uuid: ID!
# The time of publication, as a Date object String.
time: String!
# The Post body, written in markdown.
text: String!
# The Post author details.
author: User!
# The parent post. Null by default. No edits allowed.
parent: Post
# The Post attachment URL. Null by default. No edits allowed.
attachmentURL: String
# The course under which the post belongs. Null by default. No edits allowed.
course: Course
# A list containing all comments made under the Post.
comments(offset: Int): [Post]!
# Flag signifying the post has been reported.
reported: Boolean
# Flag signifying the post has been approved.
approved: Boolean
}
# This node serves as a mutable entrypoint to the graph. It contains fields which we can use for traversing through the graph and performing write, update and delete operations.
type Mutation {
# Create User with given credentials.
createUser(username: String!, password: String!): User
# Update User details to given credentials.
updateUser(username: String!, newPassword: String!): User
# Delete User of given credentials.
deleteUser(username: String!): User
# Create Role with given name.
createRole(name: String!): Role
# Delete Role of given name.
deleteRole(name: String!): Role
# Give Role to a User.
giveRole(username: String!, role: String!): Role
# Updates the Profile according to arguments.
updateProfile(
id: ID!
fullName: String!
about: String!
display_pic: String!
): Profile
# Deletes the Profile according to the ID.
deleteProfile(id: ID!): Profile
# TODO
createPost(
# The text body of the post. Supports markdown.
text: String!
# The Course ID the post should be added under.
course: ID
# URL to attach to the post.
attachmentURL: String
# ID of the parent post. To be added only if the post currently being created is a comment.
parent: ID
): Post
# TODO
editPost(
id: ID!
# The text body of the post. Supports markdown.
text: String!
): Post
# TODO
deletePost(id: ID!): Post
# TODO
subscribeToCourse(
# The user's ID.
uuid: ID
# The courseID the user is subscribing to.
courseID: ID
): Profile
# TODO
addCourse(name: String, description: String): Course
# TODO
unsubscribeFromCourse(
# The user's ID.
uuid: ID
# The courseID the user is unsubscribing from.
courseID: ID
): Profile
# TODO
deleteCourse(id: ID): Course
# TODO
updateCourse(id: ID, name: String, description: String): Course
}
# todo
type Subscription {
# todo
postAdded: Notification!
}
# todo
type Notification {
uuid: ID!
# Timestamp of the notification.
time: String!
# The event which triggered the notification.
channel: String!
# The course details.
course: Course
# The notification body.
body: String!
# The URL to redirect to when the notification is clicked.
link: String!
}