Skip to content

Commit 38006be

Browse files
authored
Improve analytics on teams (codesandbox#3906)
* Improve analytics on teams * Add it on accepting team invitation
1 parent 6042d67 commit 38006be

File tree

8 files changed

+339
-199
lines changed

8 files changed

+339
-199
lines changed

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

Lines changed: 170 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# source: https://codesandbox.io/api/graphql
2-
# timestamp: Wed Apr 08 2020 13:07:11 GMT+0200 (Central European Summer Time)
2+
# timestamp: Wed Apr 15 2020 12:57:51 GMT+0200 (Central European Summer Time)
33

44
schema {
55
query: RootQuery
@@ -21,7 +21,9 @@ type Bookmarked {
2121
isBookmarked: Boolean
2222
}
2323

24-
"""A team or the current user"""
24+
"""
25+
A team or the current user
26+
"""
2527
union BookmarkEntity = Team | User
2628

2729
input CodeReference {
@@ -38,7 +40,9 @@ type CodeReferenceMetadata {
3840
path: String!
3941
}
4042

41-
"""A collaborator on a sandbox"""
43+
"""
44+
A collaborator on a sandbox
45+
"""
4246
type Collaborator {
4347
authorization: Authorization!
4448
id: ID!
@@ -114,7 +118,9 @@ type Git {
114118
username: String
115119
}
116120

117-
"""An invitation to a sandbox"""
121+
"""
122+
An invitation to a sandbox
123+
"""
118124
type Invitation {
119125
authorization: Authorization!
120126
email: String
@@ -149,96 +155,179 @@ type Reference {
149155
type: String!
150156
}
151157

152-
"""The metadata of a reference"""
158+
"""
159+
The metadata of a reference
160+
"""
153161
union ReferenceMetadata = CodeReferenceMetadata
154162

155163
type RootMutation {
156-
"""Reject an invitation to a team"""
157-
rejectTeamInvitation(teamId: ID!): String
158-
159-
"""Rename a collection and all subfolders"""
160-
renameCollection(newPath: String!, newTeamId: ID, path: String!, teamId: ID): [Collection!]!
161-
162-
"""Revoke an invitation to a team"""
163-
revokeTeamInvitation(teamId: ID!, userId: ID!): Team
164-
revokeSandboxInvitation(invitationId: ID!, sandboxId: ID!): Invitation!
165-
updateComment(commentId: ID!, content: String, sandboxId: ID!): Comment!
166-
changeSandboxInvitationAuthorization(authorization: Authorization!, invitationId: ID!, sandboxId: ID!): Invitation!
164+
"""
165+
Change authorization of a collaborator
166+
"""
167+
changeCollaboratorAuthorization(
168+
authorization: Authorization!
169+
sandboxId: ID!
170+
username: String!
171+
): Collaborator!
172+
173+
"""
174+
Clear notification unread count
175+
"""
176+
clearNotificationCount: User
177+
renameSandbox(id: ID!, title: String!): Sandbox!
167178

168-
"""Delete a collection and all subfolders"""
179+
"""
180+
Add sandboxes to a collection
181+
"""
182+
addToCollection(
183+
collectionPath: String!
184+
sandboxIds: [ID]!
185+
teamId: ID
186+
): Collection!
187+
188+
"""
189+
Delete a collection and all subfolders
190+
"""
169191
deleteCollection(path: String!, teamId: ID): [Collection!]!
170-
redeemSandboxInvitation(invitationToken: String!, sandboxId: ID!): Invitation!
171192

172-
"""Unbookmark a template"""
173-
unbookmarkTemplate(teamId: ID, templateId: ID!): Template
174-
175-
"""Set the description of the team"""
176-
setTeamDescription(description: String!, teamId: ID!): Team
177-
createSandboxInvitation(authorization: Authorization!, email: String!, sandboxId: ID!): Invitation!
178-
179-
"""Accept an invitation to a team"""
180-
acceptTeamInvitation(teamId: ID!): Team
193+
"""
194+
Revoke an invitation to a team
195+
"""
196+
revokeTeamInvitation(teamId: ID!, userId: ID!): Team
181197

182-
"""Create a collection"""
183-
createCollection(path: String!, teamId: ID): Collection!
184-
unresolveComment(commentId: ID!, sandboxId: ID!): Comment!
198+
"""
199+
Soft delete a comment. Note: all child comments will also be deleted.
200+
"""
201+
deleteComment(commentId: ID!, sandboxId: ID!): Comment!
202+
changeSandboxInvitationAuthorization(
203+
authorization: Authorization!
204+
invitationId: ID!
205+
sandboxId: ID!
206+
): Invitation!
207+
resolveComment(commentId: ID!, sandboxId: ID!): Comment!
208+
createSandboxInvitation(
209+
authorization: Authorization!
210+
email: String!
211+
sandboxId: ID!
212+
): Invitation!
213+
214+
"""
215+
Create a team
216+
"""
217+
createTeam(name: String!): Team
185218

186-
"""Mark all notifications as read"""
187-
markAllNotificationsAsRead: User
219+
"""
220+
Rename a collection and all subfolders
221+
"""
222+
renameCollection(
223+
newPath: String!
224+
newTeamId: ID
225+
path: String!
226+
teamId: ID
227+
): [Collection!]!
228+
229+
"""
230+
Convert templates back to sandboxes
231+
"""
232+
unmakeSandboxesTemplates(sandboxIds: [ID!]!): [Template!]!
188233

189-
"""Delete sandboxes"""
234+
"""
235+
Delete sandboxes
236+
"""
190237
deleteSandboxes(sandboxIds: [ID!]!): [Sandbox!]!
191238

192-
"""Remove a collaborator"""
193-
removeCollaborator(sandboxId: ID!, username: String!): Collaborator!
194-
permanentlyDeleteSandboxes(sandboxIds: [ID!]!): [Sandbox!]!
195-
resolveComment(commentId: ID!, sandboxId: ID!): Comment!
196-
setSandboxesPrivacy(privacy: Int, sandboxIds: [ID!]!): [Sandbox!]!
197-
198-
"""Soft delete a comment. Note: all child comments will also be deleted."""
199-
deleteComment(commentId: ID!, sandboxId: ID!): Comment!
200-
201-
"""Invite someone to a team"""
202-
inviteToTeam(teamId: ID!, username: String): Team
203-
renameSandbox(id: ID!, title: String!): Sandbox!
239+
"""
240+
Unbookmark a template
241+
"""
242+
unbookmarkTemplate(teamId: ID, templateId: ID!): Template
204243

205-
"""Leave a team"""
244+
"""
245+
Leave a team
246+
"""
206247
leaveTeam(teamId: ID!): String
207248

208-
"""Add a collaborator"""
209-
addCollaborator(authorization: Authorization!, sandboxId: ID!, username: String!): Collaborator!
210-
211-
"""Add sandboxes to a collection"""
212-
addToCollection(collectionPath: String!, sandboxIds: [ID]!, teamId: ID): Collection!
249+
"""
250+
bookmark a template
251+
"""
252+
bookmarkTemplate(teamId: ID, templateId: ID!): Template
253+
updateComment(commentId: ID!, content: String, sandboxId: ID!): Comment!
254+
createComment(
255+
codeReference: CodeReference
256+
content: String!
257+
id: ID
258+
parentCommentId: ID
259+
sandboxId: ID!
260+
): Comment!
261+
262+
"""
263+
Reject an invitation to a team
264+
"""
265+
rejectTeamInvitation(teamId: ID!): String
213266

214-
"""Clear notification unread count"""
215-
clearNotificationCount: User
267+
"""
268+
Accept an invitation to a team
269+
"""
270+
acceptTeamInvitation(teamId: ID!): Team
216271

217-
"""Make templates from sandboxes"""
272+
"""
273+
Make templates from sandboxes
274+
"""
218275
makeSandboxesTemplates(sandboxIds: [ID!]!): [Template!]!
219276

220-
"""Change authorization of a collaborator"""
221-
changeCollaboratorAuthorization(authorization: Authorization!, sandboxId: ID!, username: String!): Collaborator!
277+
"""
278+
Create a collection
279+
"""
280+
createCollection(path: String!, teamId: ID): Collection!
281+
282+
"""
283+
Remove a collaborator
284+
"""
285+
removeCollaborator(sandboxId: ID!, username: String!): Collaborator!
286+
setSandboxesPrivacy(privacy: Int, sandboxIds: [ID!]!): [Sandbox!]!
222287

223-
"""Remove someone from a team"""
288+
"""
289+
Remove someone from a team
290+
"""
224291
removeFromTeam(teamId: ID!, userId: ID!): Team
225292

226-
"""bookmark a template"""
227-
bookmarkTemplate(teamId: ID, templateId: ID!): Template
228-
createComment(codeReference: CodeReference, content: String!, id: ID, parentCommentId: ID, sandboxId: ID!): Comment!
293+
"""
294+
Set the description of the team
295+
"""
296+
setTeamDescription(description: String!, teamId: ID!): Team
297+
permanentlyDeleteSandboxes(sandboxIds: [ID!]!): [Sandbox!]!
229298

230-
"""Convert templates back to sandboxes"""
231-
unmakeSandboxesTemplates(sandboxIds: [ID!]!): [Template!]!
299+
"""
300+
Add a collaborator
301+
"""
302+
addCollaborator(
303+
authorization: Authorization!
304+
sandboxId: ID!
305+
username: String!
306+
): Collaborator!
307+
308+
"""
309+
Invite someone to a team
310+
"""
311+
inviteToTeam(teamId: ID!, username: String): Team
312+
unresolveComment(commentId: ID!, sandboxId: ID!): Comment!
313+
redeemSandboxInvitation(invitationToken: String!, sandboxId: ID!): Invitation!
314+
revokeSandboxInvitation(invitationId: ID!, sandboxId: ID!): Invitation!
232315

233-
"""Create a team"""
234-
createTeam(name: String!): Team
316+
"""
317+
Mark all notifications as read
318+
"""
319+
markAllNotificationsAsRead: User
235320
}
236321

237322
type RootQuery {
238-
"""Get current user"""
323+
"""
324+
Get current user
325+
"""
239326
me: CurrentUser
240327

241-
"""Get a sandbox"""
328+
"""
329+
Get a sandbox
330+
"""
242331
sandbox(sandboxId: ID!): Sandbox
243332
}
244333

@@ -255,7 +344,9 @@ type RootSubscriptionType {
255344
sandboxChanged(sandboxId: ID!): Sandbox!
256345
}
257346

258-
"""A Sandbox"""
347+
"""
348+
A Sandbox
349+
"""
259350
type Sandbox {
260351
alias: String
261352
author: User
@@ -265,12 +356,16 @@ type Sandbox {
265356
comment(commentId: ID!): Comment
266357
comments: [Comment!]!
267358

268-
"""If the sandbox is a template this will be set"""
359+
"""
360+
If the sandbox is a template this will be set
361+
"""
269362
customTemplate: Template
270363
description: String
271364
forkedTemplate: Template
272365

273-
"""If the sandbox has a git repo tied to it this will be set"""
366+
"""
367+
If the sandbox has a git repo tied to it this will be set
368+
"""
274369
git: Git
275370
id: ID!
276371
insertedAt: String!
@@ -301,7 +396,9 @@ type Team {
301396
users: [User!]!
302397
}
303398

304-
"""A Template"""
399+
"""
400+
A Template
401+
"""
305402
type Template {
306403
bookmarked: [Bookmarked]
307404
color: String
@@ -315,7 +412,9 @@ type Template {
315412
updatedAt: String
316413
}
317414

318-
"""A CodeSandbox User"""
415+
"""
416+
A CodeSandbox User
417+
"""
319418
type User {
320419
avatarUrl: String!
321420
firstName: String

0 commit comments

Comments
 (0)