-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathTick.gql
More file actions
194 lines (174 loc) · 5.56 KB
/
Tick.gql
File metadata and controls
194 lines (174 loc) · 5.56 KB
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
type Query {
"""
Gets all of the users current ticks by their Auth-0 userId or username
"""
userTicks(userId: MUUID, username: String, limit: Int, offset: Int): [TickType]
"""
Gets all of the users current ticks for a specific climb by their
Auth-0 userId and Open-Beta ClimbId
"""
userTicksByClimbId(userId: String, climbId: String, limit: Int, offset: Int): [TickType]
}
type Mutation {
"""
Adds a tick to the MongoDB
NOTE: climbId is created from the hash function on the backend,
input the MP id into the function to create it, or just search for the climb on open beta
NOTE: source is either MP or OB, which stand for Mountain project and open beta respectively
the database will reject anything else. This allows us to determine where the tick was created
"""
addTick(input: Tick): TickType
"""
Deletes a tick from MongoDB by the _id property created in the database
"""
deleteTick(_id: ID): DeleteSingleTickResult
"""
Deletes all ticks created by a user by the userId,
mainly a dev feature for while we are working on getting the schema correct
"""
deleteAllTicks(userId: String): DeleteAllTickResult
"""
Imports a users ticks from mountain project, this feature also deletes all ticks previously imported from mountain project
before importing them, allowing users to constantly update their ticks without creating duplicates
"""
importTicks(input: [Tick]): [TickType]
editTick(input: TickFilter): TickType
}
"""
This is our tick type, containing the name, notes climbId,
etc of the ticked climb NOTE: source must either be MP or OB
which stand for Mountain Project, or Open Beta respectively
"""
type TickType {
_id: ID
"User that this tick belongs to "
userId: String
"""
The name of this climb.
When the tick is imported from an external data source, there is no relational guarentee,
and as such we need this field filled out to be able to display the name of the climb.
Native ticks may have this field enforced against the climb that it relates to.
If the name changes in its related climb document, the value stored here may be back-updated
to reflect the new name.
"""
name: String
"""
freeform text field that a user fills out as commentary on this tick. This unstructured data
is one of the most important ones on the tick, as users may give their human opinion on the
climb attempt that they made.
Sandbagged, Chipped, bad conditions, may all be examples of notes that a user may submit to accompany
the tick.
"""
notes: String
"""
Which climb is ascociated with this tick? There is weak-relationship between this ID
and a climb document in the climbs collection. This is because we support importing
climbs from external sources, and we may not have a climb document for every climb
When source is OpenBeta, this can be understood as a foreign key to the climbs collection uuid.
"""
climbId: String
"""
Arbitrary string that represents the style of the climb.
Lead, toprope, bouldering, would be examples of values you might find here.
If this is a native tick, you can enforce updated values here by referencing
the climb document (climbId -> climbs:uuid)
"""
style: TickStyle
"""
Describe the type of successful attempt that was made here.
Attempt, Flash, Redpoint, Onsight, would be examples of values you might find here.
This is again a free-form field. Data of practically any descriptive nature may find
itself here.
"""
attemptType: TickAttemptType
"""
Not the same as date created. Ticks can be back-filled by the user, and do
not need to be logged at the time that the tick is created inside the mongo
database.
This is a string because we do not enforce any particular date format at this time.
"""
dateClimbed: Date
"""
What grade is this tick ascociated with?
This exists in the tick document both for easy-fetching and to ensure
proper operation when importing ticks for entities that cannot be located
within OpenBeta's database.
"""
grade: String
source: TickSource
"""User public profile"""
user: UserPublicProfile!
"""The climb associated with this tick. Null when the climb doesn't exist in our database."""
climb: Climb
}
"The tick sources that openbeta supports."
enum TickSource {
"OpenBeta (native tick)"
OB
"MountainProject (imported tick)"
MP
}
"""The type of attempt the user wants to tick for a route."""
enum TickAttemptType {
"Onsight: Sending a route fist try with no prior knowledge"
Onsight
"Flash: Sending a route first try with prior knowledge"
Flash
"Pinkpoint: Sending a route with no falls on pre-placed gear"
Pinkpoint
"French Free: Doing the route with pulling on gear or draws"
Frenchfree
"Attempt"
Attempt
"Send: Sending a route with no falls"
Send
"Redpoint"
Redpoint
"Repeat"
Repeat
}
enum TickStyle {
"Lead"
Lead
"Solo"
Solo
"tr"
TR
"Follow"
Follow
"Aid"
Aid
"Boulder"
Boulder
}
"""
This is our tick type input, containing the name,
notes climbId, etc of the ticked climb, all fields are required
NOTE: source must either be MP or OB which stand for Mountain Project, or Open Beta respectively
"""
input Tick {
name: String!
notes: String
climbId: String!
userId: String!
style: TickStyle
attemptType: TickAttemptType
dateClimbed: Date!
grade: String
source: TickSource!
}
"""
Takes in the MongoId and a tick object to replace the old tick object with
"""
input TickFilter {
_id: ID!
updatedTick: Tick
}
type DeleteSingleTickResult {
_id: ID!
removed: Boolean!
}
type DeleteAllTickResult {
removed: Boolean!
deletedCount: Int
}