-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.gql
346 lines (259 loc) · 6.55 KB
/
schema.gql
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
type Message {
"""Unique identifier for the resource."""
id: ID!
"""Date and time when the resource was created."""
createdAt: DateTime!
"""Date and time when the resource was last updated."""
updatedAt: DateTime!
"""Content of the message"""
content: String!
"""Whether the message is modified"""
isModified: Boolean!
"""Ids of users who have not read the message"""
unreadByIds: [ID!]!
"""The user who created the message."""
user: User!
"""The conversation the message belongs to."""
conversation: Conversation!
"""The message this message is a reply to."""
replyTo: Message
}
"""
A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.
"""
scalar DateTime
type Conversation {
"""Unique identifier for the resource."""
id: ID!
"""Date and time when the resource was created."""
createdAt: DateTime!
"""Date and time when the resource was last updated."""
updatedAt: DateTime!
lastMessageSentAt: DateTime
"""Get the creator of the conversation."""
creator: UserConversation!
"""Get the recipient of the conversation."""
recipient: UserConversation!
}
type Image {
"""Unique identifier for the resource."""
id: ID!
"""Date and time when the resource was created."""
createdAt: DateTime!
"""Date and time when the resource was last updated."""
updatedAt: DateTime!
"""Key of image"""
key: ID!
"""Blurhash of image"""
blurhash: String!
}
type User {
"""Unique identifier for the resource."""
id: ID!
"""Date and time when the resource was created."""
createdAt: DateTime!
"""Date and time when the resource was last updated."""
updatedAt: DateTime!
"""Username of user"""
username: String!
"""Avatar of a user"""
avatar: Image
}
type TokensOutput {
"""Access Token of user"""
accessToken: String!
"""Access Token of user"""
refreshToken: String!
}
type CreateConversationOutput {
"""The conversation created."""
conversation: Conversation!
"""Whether the conversation was created or not."""
created: Boolean!
}
type UserConversation {
"""Unique identifier for the resource."""
id: ID!
"""Date and time when the resource was created."""
createdAt: DateTime!
"""Date and time when the resource was last updated."""
updatedAt: DateTime!
"""Username of user"""
username: String!
"""Avatar of a user"""
avatar: Image
"""Get the id of the first unread message of the conversation."""
firstUnreadMessageId: ID
"""Get the count of unread messages of the conversation."""
unreadMessagesCount: Float!
}
type PaginationMessage {
"""Total number of nodes"""
totalCount: Int!
nodes: [Message!]!
}
type Query {
"""Get a user by args"""
FindOneUser(input: FindOneUserInput!): User
"""Get all friends of a user"""
UserFriends: [User!]!
"""Get all received requests of a user"""
UserReceivedRequestsFriends: [User!]!
"""Get all sent requests of a user"""
UserSentRequestsFriends: [User!]!
"""Find one conversation by id."""
FindOneConversation(
"""Id of conversation"""
id: ID
): Conversation
"""Find all conversations for user."""
UserConversations: [Conversation!]!
"""Find one message by id."""
FindOneMessage(
"""Id of message"""
id: ID
): Message
"""Pagination of messages."""
PaginationMessage(
"""Skip the first n nodes"""
skip: Int!
"""Take the first n nodes"""
take: Int!
"""Sort nodes"""
sortBy: PaginationSortBy
where: [PaginationMessageWhere]
): PaginationMessage!
"""Logout current user"""
Logout: Boolean!
"""Get current user"""
Profile: User!
}
input FindOneUserInput {
"""Id of user"""
id: ID
"""Username of user"""
username: String
}
input PaginationSortBy {
"""Sort by date of creation"""
createdAt: SortDirection
"""Sort by date of last update"""
updatedAt: SortDirection
}
enum SortDirection {
ASC
DESC
}
input PaginationMessageWhere {
"""Filter by id"""
id: ID
"""Filter by Conversation Id"""
conversationId: ID
"""Filter by createdAt date"""
createdAt: DateTime
}
type Mutation {
"""Update a user"""
UpdateUser(input: UpdateUserInput!): User!
"""Delete a user"""
DeleteUser: User!
"""Send a friend request"""
SendFriendRequest(
"""Username of user"""
username: String!
): User!
"""Accept a friend request"""
AcceptFriendRequest(
"""Id of user"""
id: ID!
): User!
"""Decline a friend request"""
DeclineFriendRequest(
"""Id of user"""
id: ID!
): User!
"""Cancel a friend request"""
CancelFriendRequest(
"""Id of user"""
id: ID!
): User!
"""Remove a friend"""
RemoveFriend(
"""Id of user"""
id: ID!
): User!
"""Create a new conversation."""
CreateConversation(input: CreateConversationInput!): CreateConversationOutput!
"""Delete a conversation by id."""
DeleteConversation(
"""Id of conversation"""
id: ID!
): ID!
"""Close a conversation for user."""
CloseConversation(
"""Id of conversation"""
id: ID!
): Conversation!
"""Create a new message."""
CreateMessage(input: CreateMessageInput!): Message!
"""Update a message by id."""
UpdateMessage(input: UpdateMessageInput!): Message!
"""Delete a message by id."""
DeleteMessage(
"""Id of message"""
id: ID!
): ID!
"""Read messages in a conversation."""
ReadMessages(
"""Id of the conversation"""
conversationId: ID!
): [String!]!
"""Sign up User"""
SignUp(input: CreateUserInput!): User!
"""Sign in User"""
SignIn(
"""Username of user"""
username: String!
"""Password of user"""
password: String!
): User!
"""Refresh Tokens of current user"""
RefreshTokens: TokensOutput!
}
input UpdateUserInput {
"""Username of user"""
username: String
"""Password of user"""
password: String
"""Avatar of user"""
avatar: Upload
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
input CreateConversationInput {
"""The user that will be part of the conversation."""
userId: ID!
}
input CreateMessageInput {
"""Content of the message"""
content: String!
"""ID of the conversation"""
conversationId: ID!
"""ID of the message to reply to"""
replyToId: ID
}
input UpdateMessageInput {
"""ID of the message"""
id: ID!
"""Content of the message"""
content: String
}
input CreateUserInput {
"""Username of user"""
username: String!
"""Password of user"""
password: String!
}