Skip to content

Commit c70686e

Browse files
authored
Fake backend is now real backend (codesandbox#3692)
1 parent 2d974bc commit c70686e

File tree

33 files changed

+1150
-1023
lines changed

33 files changed

+1150
-1023
lines changed

packages/app/src/app/graphql/schema.graphql

Lines changed: 121 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# source: https://codesandbox.stream/api/graphql
2-
# timestamp: Wed Feb 26 2020 09:54:02 GMT+0100 (Central European Standard Time)
1+
# source: https://codesandbox.io/api/graphql
2+
# timestamp: Thu Mar 19 2020 19:20:51 GMT+0100 (Central European Standard Time)
33

44
schema {
55
query: RootQuery
@@ -47,6 +47,29 @@ type Collection {
4747
user: User
4848
}
4949

50+
"""
51+
A comment as part of a thread
52+
"""
53+
type Comment {
54+
content: String
55+
id: ID!
56+
insertedAt: NaiveDateTime!
57+
updatedAt: NaiveDateTime!
58+
user: User!
59+
}
60+
61+
"""
62+
A comment thread
63+
"""
64+
type CommentThread {
65+
comments: [Comment!]!
66+
id: ID!
67+
initialComment: Comment!
68+
insertedAt: NaiveDateTime!
69+
isResolved: Boolean!
70+
updatedAt: NaiveDateTime!
71+
}
72+
5073
type CurrentUser {
5174
bookmarkedTemplates: [Template]
5275
collection(path: String!, teamId: ID): Collection
@@ -97,6 +120,13 @@ type Invitation {
97120
token: String!
98121
}
99122

123+
"""
124+
The `Naive DateTime` scalar type represents a naive date and time without
125+
timezone. The DateTime appears in a JSON response as an ISO8601 formatted
126+
string.
127+
"""
128+
scalar NaiveDateTime
129+
100130
type Notification {
101131
data: String
102132
id: ID
@@ -111,141 +141,166 @@ input OrderBy {
111141

112142
type RootMutation {
113143
"""
114-
Accept an invitation to a team
144+
Revoke an invitation to a team
115145
"""
116-
acceptTeamInvitation(teamId: ID!): Team
146+
revokeTeamInvitation(teamId: ID!, userId: ID!): Team
117147

118148
"""
119-
Add a collaborator
149+
Change authorization of a collaborator
120150
"""
121-
addCollaborator(
151+
changeCollaboratorAuthorization(
122152
authorization: Authorization!
123153
sandboxId: ID!
124154
username: String!
125155
): Collaborator!
126156

127157
"""
128-
Add sandboxes to a collection
158+
bookmark a template
129159
"""
130-
addToCollection(
131-
collectionPath: String!
132-
sandboxIds: [ID]!
133-
teamId: ID
134-
): Collection
160+
bookmarkTemplate(teamId: ID, templateId: ID!): Template
135161

136162
"""
137-
bookmark a template
163+
Set the description of the team
138164
"""
139-
bookmarkTemplate(teamId: ID, templateId: ID!): Template
165+
setTeamDescription(description: String!, teamId: ID!): Team
140166

141167
"""
142-
Change authorization of a collaborator
168+
Remove someone from a team
143169
"""
144-
changeCollaboratorAuthorization(
145-
authorization: Authorization!
146-
sandboxId: ID!
147-
username: String!
148-
): Collaborator!
170+
removeFromTeam(teamId: ID!, userId: ID!): Team
171+
redeemSandboxInvitation(invitationToken: String!, sandboxId: ID!): Invitation!
172+
173+
"""
174+
Delete sandboxes
175+
"""
176+
deleteSandboxes(sandboxIds: [ID]!): [Sandbox]
149177
changeSandboxInvitationAuthorization(
150178
authorization: Authorization!
151179
invitationId: ID!
152180
sandboxId: ID!
153181
): Invitation!
154182

183+
"""
184+
Convert templates back to sandboxes
185+
"""
186+
unmakeSandboxesTemplates(sandboxIds: [ID]!): [Template]
187+
155188
"""
156189
Clear notification unread count
157190
"""
158191
clearNotificationCount: User
192+
createComment(
193+
commentThreadId: ID!
194+
content: String!
195+
sandboxId: ID!
196+
): Comment!
159197

160198
"""
161-
Create a collection
199+
Create a comment thread, the content will be used to fill in the first comment
162200
"""
163-
createCollection(path: String!, teamId: ID): Collection
164-
createSandboxInvitation(
165-
authorization: Authorization!
166-
email: String!
167-
sandboxId: ID!
168-
): Invitation!
201+
createCommentThread(content: String!, sandboxId: ID!): CommentThread!
169202

170203
"""
171204
Create a team
172205
"""
173206
createTeam(name: String!): Team
174207

175208
"""
176-
Delete a collection and all subfolders
209+
Delete a comment from the thread. Note: if you delete the first comment, the full thread will be deleted
177210
"""
178-
deleteCollection(path: String!, teamId: ID): [Collection]
211+
deleteComment(commentId: ID!, sandboxId: ID!): Comment!
179212

180213
"""
181-
Delete sandboxes
214+
Rename a collection and all subfolders
182215
"""
183-
deleteSandboxes(sandboxIds: [ID]!): [Sandbox]
216+
renameCollection(
217+
newPath: String!
218+
newTeamId: ID
219+
path: String!
220+
teamId: ID
221+
): [Collection]
222+
renameSandbox(id: ID!, title: String!): Sandbox
184223

185224
"""
186-
Invite someone to a team
225+
Unbookmark a template
187226
"""
188-
inviteToTeam(teamId: ID!, username: String): Team
227+
unbookmarkTemplate(teamId: ID, templateId: ID!): Template
189228

190229
"""
191-
Leave a team
230+
Add a collaborator
192231
"""
193-
leaveTeam(teamId: ID!): String
232+
addCollaborator(
233+
authorization: Authorization!
234+
sandboxId: ID!
235+
username: String!
236+
): Collaborator!
194237

195238
"""
196-
Make templates from sandboxes
239+
Invite someone to a team
197240
"""
198-
makeSandboxesTemplates(sandboxIds: [ID]!): [Template]
199-
permanentlyDeleteSandboxes(sandboxIds: [ID]!): [Sandbox]
200-
redeemSandboxInvitation(invitationToken: String!, sandboxId: ID!): Invitation!
241+
inviteToTeam(teamId: ID!, username: String): Team
242+
updateComment(commentId: ID!, content: String!, sandboxId: ID!): Comment!
201243

202244
"""
203-
Reject an invitation to a team
245+
Delete a collection and all subfolders
204246
"""
205-
rejectTeamInvitation(teamId: ID!): String
247+
deleteCollection(path: String!, teamId: ID): [Collection]
248+
249+
"""
250+
Update the info of a comment thread
251+
"""
252+
updateCommentThread(
253+
commentThreadId: ID!
254+
isResolved: Boolean
255+
sandboxId: ID!
256+
): CommentThread!
257+
createSandboxInvitation(
258+
authorization: Authorization!
259+
email: String!
260+
sandboxId: ID!
261+
): Invitation!
262+
setSandboxesPrivacy(privacy: Int, sandboxIds: [ID]!): [Sandbox]
206263

207264
"""
208265
Remove a collaborator
209266
"""
210267
removeCollaborator(sandboxId: ID!, username: String!): Collaborator!
268+
revokeSandboxInvitation(invitationId: ID!, sandboxId: ID!): Invitation!
211269

212270
"""
213-
Remove someone from a team
271+
Reject an invitation to a team
214272
"""
215-
removeFromTeam(teamId: ID!, userId: ID!): Team
273+
rejectTeamInvitation(teamId: ID!): String
216274

217275
"""
218-
Rename a collection and all subfolders
276+
Create a collection
219277
"""
220-
renameCollection(
221-
newPath: String!
222-
newTeamId: ID
223-
path: String!
224-
teamId: ID
225-
): [Collection]
226-
renameSandbox(id: ID!, title: String!): Sandbox
227-
revokeSandboxInvitation(invitationId: ID!, sandboxId: ID!): Invitation!
278+
createCollection(path: String!, teamId: ID): Collection
228279

229280
"""
230-
Revoke an invitation to a team
281+
Leave a team
231282
"""
232-
revokeTeamInvitation(teamId: ID!, userId: ID!): Team
233-
setSandboxesPrivacy(privacy: Int, sandboxIds: [ID]!): [Sandbox]
283+
leaveTeam(teamId: ID!): String
234284

235285
"""
236-
Set the description of the team
286+
Make templates from sandboxes
237287
"""
238-
setTeamDescription(description: String!, teamId: ID!): Team
288+
makeSandboxesTemplates(sandboxIds: [ID]!): [Template]
289+
permanentlyDeleteSandboxes(sandboxIds: [ID]!): [Sandbox]
239290

240291
"""
241-
Unbookmark a template
292+
Add sandboxes to a collection
242293
"""
243-
unbookmarkTemplate(teamId: ID, templateId: ID!): Template
294+
addToCollection(
295+
collectionPath: String!
296+
sandboxIds: [ID]!
297+
teamId: ID
298+
): Collection
244299

245300
"""
246-
Convert templates back to sandboxes
301+
Accept an invitation to a team
247302
"""
248-
unmakeSandboxesTemplates(sandboxIds: [ID]!): [Template]
303+
acceptTeamInvitation(teamId: ID!): Team
249304
}
250305

251306
type RootQuery {
@@ -264,6 +319,9 @@ type RootSubscriptionType {
264319
collaboratorAdded(sandboxId: ID!): Collaborator!
265320
collaboratorChanged(sandboxId: ID!): Collaborator!
266321
collaboratorRemoved(sandboxId: ID!): Collaborator!
322+
commentThreadCreated(sandboxId: ID!): CommentThread!
323+
commentThreadDeleted(sandboxId: ID!): CommentThread!
324+
commentThreadUpdated(sandboxId: ID!): CommentThread!
267325
invitationChanged(sandboxId: ID!): Invitation!
268326
invitationCreated(sandboxId: ID!): Invitation!
269327
invitationRemoved(sandboxId: ID!): Invitation!
@@ -279,6 +337,8 @@ type Sandbox {
279337
authorization: Authorization!
280338
collaborators: [Collaborator!]!
281339
collection: Collection
340+
commentThread(commentThreadId: ID!): CommentThread
341+
commentThreads: [CommentThread!]!
282342

283343
"""
284344
If the sandbox is a template this will be set

0 commit comments

Comments
 (0)