musora-content-services 1.2.4 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,38 +1,38 @@
1
1
  //import {AWSUrl, CloudFrontURl} from "./services/config";
2
- export const AWSUrl = 'https://s3.us-east-1.amazonaws.com/musora-web-platform';
3
- export const CloudFrontURl = 'https://d3fzm1tzeyr5n3.cloudfront.net';
2
+ export const AWSUrl = 'https://s3.us-east-1.amazonaws.com/musora-web-platform'
3
+ export const CloudFrontURl = 'https://d3fzm1tzeyr5n3.cloudfront.net'
4
4
  export const DEFAULT_FIELDS = [
5
- "'sanity_id' : _id",
6
- "'id': railcontent_id",
7
- 'railcontent_id',
8
- artistOrInstructorName(),
9
- "artist",
10
- "title",
11
- "'image': thumbnail.asset->url",
12
- "'thumbnail': thumbnail.asset->url",
13
- "difficulty",
14
- "difficulty_string",
15
- "web_url_path",
16
- "'url': web_url_path",
17
- "published_on",
18
- "'type': _type",
19
- "progress_percent",
20
- "'length_in_seconds' : coalesce(length_in_seconds, soundslice[0].soundslice_length_in_second)",
21
- "brand",
22
- "'genre': genre[]->name",
23
- 'status',
24
- "'slug' : slug.current",
25
- "'permission_id': permission[]->railcontent_id",
26
- "xp",
27
- "child_count"
28
- ];
5
+ "'sanity_id' : _id",
6
+ "'id': railcontent_id",
7
+ 'railcontent_id',
8
+ artistOrInstructorName(),
9
+ 'artist',
10
+ 'title',
11
+ "'image': thumbnail.asset->url",
12
+ "'thumbnail': thumbnail.asset->url",
13
+ 'difficulty',
14
+ 'difficulty_string',
15
+ 'web_url_path',
16
+ "'url': web_url_path",
17
+ 'published_on',
18
+ "'type': _type",
19
+ 'progress_percent',
20
+ "'length_in_seconds' : coalesce(length_in_seconds, soundslice[0].soundslice_length_in_second)",
21
+ 'brand',
22
+ "'genre': genre[]->name",
23
+ 'status',
24
+ "'slug' : slug.current",
25
+ "'permission_id': permission[]->railcontent_id",
26
+ 'xp',
27
+ 'child_count',
28
+ ]
29
29
 
30
- export const descriptionField = 'description[0].children[0].text';
30
+ export const descriptionField = 'description[0].children[0].text'
31
31
  // this pulls both any defined resources for the document as well as any resources in the parent document
32
32
  export const resourcesField = `[
33
33
  ... resource[]{resource_name, _key, "resource_url": coalesce('${CloudFrontURl}'+string::split(resource_aws.asset->fileURL, '${AWSUrl}')[1], resource_url )},
34
34
  ... *[railcontent_id == ^.parent_content_data[0].id] [0].resource[]{resource_name, _key, "resource_url": coalesce('${CloudFrontURl}'+string::split(resource_aws.asset->fileURL, '${AWSUrl}')[1], resource_url )},
35
- ]`;
35
+ ]`
36
36
 
37
37
  /*
38
38
  * NOTE: TP-366 - Arrays can be either arrays of different objects or arrays of different primitives, not both
@@ -57,88 +57,113 @@ export const assignmentsField = `"assignments":assignment[]{
57
57
  },`
58
58
 
59
59
  const contentWithInstructorsField = {
60
- 'fields': [
61
- '"instructors": instructor[]->name',
62
- ]
60
+ fields: ['"instructors": instructor[]->name'],
63
61
  }
64
62
 
65
63
  const contentWithSortField = {
66
- 'fields': [
67
- 'sort',
68
- ]
64
+ fields: ['sort'],
69
65
  }
70
66
  export const showsTypes = {
71
- 'drumeo': ['odd-times', 'drum-fest-international-2022', 'spotlight', 'the-history-of-electronic-drums', 'backstage-secret', 'quick-tips', 'question-and-answer', 'student-collaboration',
72
- 'live', 'podcast', 'solo', 'boot-camp', 'gear-guide', 'performance', 'in-rhythm', 'challenges', 'on-the-road', 'diy-drum-experiment', 'rhythmic-adventures-of-captain-carson',
73
- 'study-the-greats', 'rhythms-from-another-planet', 'tama', 'paiste-cymbals', 'behind-the-scenes', 'exploring-beats', 'sonor'
74
- ],
75
- 'pianote': ['student-review', 'question-and-answer'],
76
- 'guitareo': ['student-review', 'question-and-answer', 'archives', 'recording'],
77
- 'singeo': ['student-review', 'question-and-answer']
67
+ drumeo: [
68
+ 'odd-times',
69
+ 'drum-fest-international-2022',
70
+ 'spotlight',
71
+ 'the-history-of-electronic-drums',
72
+ 'backstage-secret',
73
+ 'quick-tips',
74
+ 'question-and-answer',
75
+ 'student-collaboration',
76
+ 'live',
77
+ 'podcast',
78
+ 'solo',
79
+ 'boot-camp',
80
+ 'gear-guide',
81
+ 'performance',
82
+ 'in-rhythm',
83
+ 'challenges',
84
+ 'on-the-road',
85
+ 'diy-drum-experiment',
86
+ 'rhythmic-adventures-of-captain-carson',
87
+ 'study-the-greats',
88
+ 'rhythms-from-another-planet',
89
+ 'tama',
90
+ 'paiste-cymbals',
91
+ 'behind-the-scenes',
92
+ 'exploring-beats',
93
+ 'sonor',
94
+ ],
95
+ pianote: ['student-review', 'question-and-answer'],
96
+ guitareo: ['student-review', 'question-and-answer', 'archives', 'recording'],
97
+ singeo: ['student-review', 'question-and-answer'],
78
98
  }
79
99
 
80
- export const coachLessonsTypes = ['course', 'course-part', 'coach-stream', 'student-focus', 'quick-tips', 'pack', 'semester-pack', 'question-and-answer', 'song-tutorial', 'song-tutorial-children', 'workout'];
100
+ export const coachLessonsTypes = [
101
+ 'course',
102
+ 'course-part',
103
+ 'coach-stream',
104
+ 'student-focus',
105
+ 'quick-tips',
106
+ 'pack',
107
+ 'semester-pack',
108
+ 'question-and-answer',
109
+ 'song-tutorial',
110
+ 'song-tutorial-children',
111
+ 'workout',
112
+ ]
81
113
 
82
114
  export let contentTypeConfig = {
83
- 'song': {
84
- 'fields': [
85
- 'album',
86
- 'soundslice',
87
- 'instrumentless',
88
- `"resources": ${resourcesField}`,
89
- ],
90
- 'relationships': {
91
- 'artist': {
92
- isOneToOne: true
93
- }
94
- },
95
- 'slug': 'songs',
115
+ song: {
116
+ fields: ['album', 'soundslice', 'instrumentless', `"resources": ${resourcesField}`],
117
+ relationships: {
118
+ artist: {
119
+ isOneToOne: true,
120
+ },
96
121
  },
97
- 'song-tutorial': {
98
- 'fields': [
99
- '"lesson_count": child_count',
100
- `"lessons": child[]->{
122
+ slug: 'songs',
123
+ },
124
+ 'song-tutorial': {
125
+ fields: [
126
+ '"lesson_count": child_count',
127
+ `"lessons": child[]->{
101
128
  "id": railcontent_id,
102
129
  title,
103
130
  "image": thumbnail.asset->url,
104
131
  "instructors": instructor[]->name,
105
132
  length_in_seconds,
106
133
  }`,
107
- ],
108
- 'relationships': {
109
- 'artist': {
110
- isOneToOne: true
111
- }
112
- },
113
- },
114
- 'song-tutorial-children': {
115
- 'fields': [
116
- `"resources": ${resourcesField}`,
117
- ],
134
+ ],
135
+ relationships: {
136
+ artist: {
137
+ isOneToOne: true,
138
+ },
118
139
  },
119
- 'challenge': {
120
- 'fields': [
121
- 'enrollment_start_time',
122
- 'enrollment_end_time',
123
- "'registration_url': '/' + brand + '/enrollment/' + slug.current",
124
- '"lesson_count": child_count',
125
- '"primary_cta_text": select(dateTime(published_on) > dateTime(now()) && dateTime(enrollment_start_time) > dateTime(now()) => "Notify Me", "Start Challenge")',
126
- 'challenge_state',
127
- 'challenge_state_text',
128
- `"description": ${descriptionField}`,
129
- 'total_xp',
130
- 'xp',
131
- '"instructors": instructor[]->name',
132
- '"instructor_signature": instructor[0]->signature.asset->url',
133
- '"header_image_url": thumbnail.asset->url',
134
- '"logo_image_url": logo_image_url.asset->url',
135
- '"award": award.asset->url',
136
- 'award_custom_text',
137
- '"gold_award": gold_award.asset->url',
138
- '"silver_award": silver_award.asset->url',
139
- '"bronze_award": bronze_award.asset->url',
140
- 'is_solo',
141
- `"lessons": child[]->{
140
+ },
141
+ 'song-tutorial-children': {
142
+ fields: [`"resources": ${resourcesField}`],
143
+ },
144
+ challenge: {
145
+ fields: [
146
+ 'enrollment_start_time',
147
+ 'enrollment_end_time',
148
+ "'registration_url': '/' + brand + '/enrollment/' + slug.current",
149
+ '"lesson_count": child_count',
150
+ '"primary_cta_text": select(dateTime(published_on) > dateTime(now()) && dateTime(enrollment_start_time) > dateTime(now()) => "Notify Me", "Start Challenge")',
151
+ 'challenge_state',
152
+ 'challenge_state_text',
153
+ `"description": ${descriptionField}`,
154
+ 'total_xp',
155
+ 'xp',
156
+ '"instructors": instructor[]->name',
157
+ '"instructor_signature": instructor[0]->signature.asset->url',
158
+ '"header_image_url": thumbnail.asset->url',
159
+ '"logo_image_url": logo_image_url.asset->url',
160
+ '"award": award.asset->url',
161
+ 'award_custom_text',
162
+ '"gold_award": gold_award.asset->url',
163
+ '"silver_award": silver_award.asset->url',
164
+ '"bronze_award": bronze_award.asset->url',
165
+ 'is_solo',
166
+ `"lessons": child[]->{
142
167
  "id": railcontent_id,
143
168
  title,
144
169
  "image": thumbnail.asset->url,
@@ -150,36 +175,36 @@ export let contentTypeConfig = {
150
175
  is_always_unlocked_for_challenge,
151
176
  is_bonus_content_for_challenge,
152
177
  }`,
153
- ]
154
- },
155
- 'course': {
156
- 'fields': [
157
- '"lesson_count": child_count',
158
- '"instructors": instructor[]->name',
159
- `"description": ${descriptionField}`,
160
- `"resource": ${resourcesField}`,
161
- 'xp',
162
- 'total_xp',
163
- `"lessons": child[]->{
178
+ ],
179
+ },
180
+ course: {
181
+ fields: [
182
+ '"lesson_count": child_count',
183
+ '"instructors": instructor[]->name',
184
+ `"description": ${descriptionField}`,
185
+ `"resource": ${resourcesField}`,
186
+ 'xp',
187
+ 'total_xp',
188
+ `"lessons": child[]->{
164
189
  "id": railcontent_id,
165
190
  title,
166
191
  "image": thumbnail.asset->url,
167
192
  "instructors": instructor[]->name,
168
193
  length_in_seconds,
169
194
  }`,
170
- ],
171
- 'slug': 'courses',
172
- },
173
- 'parent-download': {
174
- 'fields': [
175
- '"lesson_count": child_count',
176
- '"instructors": instructor[]->name',
177
- `"description": ${descriptionField}`,
178
- `"resource": ${resourcesField}`,
179
- 'xp',
180
- 'total_xp',
181
- '"thumbnail_url":thumbnail.asset->url',
182
- `"lessons": child[]->{
195
+ ],
196
+ slug: 'courses',
197
+ },
198
+ 'parent-download': {
199
+ fields: [
200
+ '"lesson_count": child_count',
201
+ '"instructors": instructor[]->name',
202
+ `"description": ${descriptionField}`,
203
+ `"resource": ${resourcesField}`,
204
+ 'xp',
205
+ 'total_xp',
206
+ '"thumbnail_url":thumbnail.asset->url',
207
+ `"lessons": child[]->{
183
208
  "id": railcontent_id,
184
209
  title,
185
210
  published_on,
@@ -212,138 +237,128 @@ export let contentTypeConfig = {
212
237
  video,
213
238
  parent_content_data,
214
239
  }`,
215
- ],
216
- },
217
- 'method': {
218
- 'fields': [
219
- `"description": ${descriptionField}`,
220
- 'hide_from_recsys',
221
- '"image": thumbnail.asset->url',
222
- '"instructors":instructor[]->name',
223
- '"lesson_count": child_count',
224
- 'length_in_seconds',
225
- 'permission',
226
- 'popularity',
227
- 'published_on',
228
- 'railcontent_id',
229
- '"thumbnail_logo": logo_image_url.asset->url',
230
- 'title',
231
- 'total_xp',
232
- '"type": _type',
233
- 'xp',
234
- ]
235
- },
236
- 'learning-path-course': {
237
- 'fields': [
238
- '"lesson_count": child_count',
239
- '"instructors": instructor[]->name',
240
- `"description": ${descriptionField}`,
241
- `"resource": ${resourcesField}`,
242
- 'xp',
243
- 'total_xp',
244
- `"lessons": child[]->{
240
+ ],
241
+ },
242
+ method: {
243
+ fields: [
244
+ `"description": ${descriptionField}`,
245
+ 'hide_from_recsys',
246
+ '"image": thumbnail.asset->url',
247
+ '"instructors":instructor[]->name',
248
+ '"lesson_count": child_count',
249
+ 'length_in_seconds',
250
+ 'permission',
251
+ 'popularity',
252
+ 'published_on',
253
+ 'railcontent_id',
254
+ '"thumbnail_logo": logo_image_url.asset->url',
255
+ 'title',
256
+ 'total_xp',
257
+ '"type": _type',
258
+ 'xp',
259
+ ],
260
+ },
261
+ 'learning-path-course': {
262
+ fields: [
263
+ '"lesson_count": child_count',
264
+ '"instructors": instructor[]->name',
265
+ `"description": ${descriptionField}`,
266
+ `"resource": ${resourcesField}`,
267
+ 'xp',
268
+ 'total_xp',
269
+ `"lessons": child[]->{
245
270
  "id": railcontent_id,
246
271
  title,
247
272
  "image": thumbnail.asset->url,
248
273
  "instructors": instructor[]->name,
249
274
  length_in_seconds,
250
275
  }`,
251
- ]
252
- },
253
- 'learning-path-level': {
254
- 'fields': [
255
- '"lesson_count": child_count',
256
- '"instructors": instructor[]->name',
257
- `"description": ${descriptionField}`,
258
- `"resource": ${resourcesField}`,
259
- 'xp',
260
- 'total_xp',
261
- `"lessons": child[]->{
276
+ ],
277
+ },
278
+ 'learning-path-level': {
279
+ fields: [
280
+ '"lesson_count": child_count',
281
+ '"instructors": instructor[]->name',
282
+ `"description": ${descriptionField}`,
283
+ `"resource": ${resourcesField}`,
284
+ 'xp',
285
+ 'total_xp',
286
+ `"lessons": child[]->{
262
287
  "id": railcontent_id,
263
288
  title,
264
289
  "image": thumbnail.asset->url,
265
290
  "instructors": instructor[]->name,
266
291
  length_in_seconds,
267
292
  }`,
268
- ]
269
- },
270
- 'workout': {
271
- 'fields': [
272
- artistOrInstructorNameAsArray(),
273
- ],
274
- 'slug': 'workouts',
275
- },
276
- 'play-along': {
277
- 'fields': [
278
- '"style": genre[]->name',
279
- 'mp3_no_drums_no_click_url',
280
- 'mp3_yes_drums_yes_click_url',
281
- 'mp3_no_drums_yes_click_url',
282
- 'mp3_yes_drums_no_click_url',
283
- 'bpm',
284
- ],
285
- 'slug': 'play-alongs',
286
- },
287
- 'pack': {
288
- 'fields': [
289
- '"lesson_count": coalesce(count(child[]->.child[]->), 0)',
290
- 'xp',
291
- `"description": ${descriptionField}`,
292
- '"instructors": instructor[]->name',
293
- '"logo_image_url": logo_image_url.asset->url',
294
- 'total_xp',
295
- `"children": child[]->{
293
+ ],
294
+ },
295
+ workout: {
296
+ fields: [artistOrInstructorNameAsArray()],
297
+ slug: 'workouts',
298
+ },
299
+ 'play-along': {
300
+ fields: [
301
+ '"style": genre[]->name',
302
+ 'mp3_no_drums_no_click_url',
303
+ 'mp3_yes_drums_yes_click_url',
304
+ 'mp3_no_drums_yes_click_url',
305
+ 'mp3_yes_drums_no_click_url',
306
+ 'bpm',
307
+ ],
308
+ slug: 'play-alongs',
309
+ },
310
+ pack: {
311
+ fields: [
312
+ '"lesson_count": coalesce(count(child[]->.child[]->), 0)',
313
+ 'xp',
314
+ `"description": ${descriptionField}`,
315
+ '"instructors": instructor[]->name',
316
+ '"logo_image_url": logo_image_url.asset->url',
317
+ 'total_xp',
318
+ `"children": child[]->{
296
319
  "description": ${descriptionField},
297
320
  "lesson_count": child_count,
298
321
  ${getFieldsForContentType()}
299
322
  }`,
300
- `"resources": ${resourcesField}`,
301
- '"thumbnail": thumbnail.asset->url',
302
- '"light_logo": light_mode_logo_url.asset->url',
303
- '"dark_logo": dark_mode_logo_url.asset->url',
304
- `"description": ${descriptionField}`,
305
- ],
306
- },
307
- 'rudiment': {
308
- 'fields': [
309
- 'sheet_music_thumbnail_url',
310
- ],
311
- 'slug': 'rudiments',
312
- },
313
- 'routine': {
314
- 'fields': [
315
- `"description": ${descriptionField}`,
316
- 'high_soundslice_slug',
317
- 'low_soundslice_slug'
318
- ],
319
- 'slug': 'routines',
320
- },
321
- 'pack-children': {
322
- 'fields': [
323
- 'child_count',
324
- `"children": child[]->{
323
+ `"resources": ${resourcesField}`,
324
+ '"thumbnail": thumbnail.asset->url',
325
+ '"light_logo": light_mode_logo_url.asset->url',
326
+ '"dark_logo": dark_mode_logo_url.asset->url',
327
+ `"description": ${descriptionField}`,
328
+ ],
329
+ },
330
+ rudiment: {
331
+ fields: ['sheet_music_thumbnail_url'],
332
+ slug: 'rudiments',
333
+ },
334
+ routine: {
335
+ fields: [`"description": ${descriptionField}`, 'high_soundslice_slug', 'low_soundslice_slug'],
336
+ slug: 'routines',
337
+ },
338
+ 'pack-children': {
339
+ fields: [
340
+ 'child_count',
341
+ `"children": child[]->{
325
342
  "description": ${descriptionField},
326
343
  ${getFieldsForContentType()}
327
344
  }`,
328
- `"resources": ${resourcesField}`,
329
- '"image": logo_image_url.asset->url',
330
- '"thumbnail": thumbnail.asset->url',
331
- '"light_logo": light_mode_logo_url.asset->url',
332
- '"dark_logo": dark_mode_logo_url.asset->url',
333
- `"description": ${descriptionField}`,
334
- 'total_xp',
335
- ]
336
- },
337
- 'pack-bundle-lesson': {
338
- 'fields': [
339
- `"resources": ${resourcesField}`,
340
- ],
341
- },
342
- 'foundation': {
343
- 'fields': [
344
- `"description": ${descriptionField}`,
345
- `"instructors":instructor[]->name`,
346
- `"units": child[]->{
345
+ `"resources": ${resourcesField}`,
346
+ '"image": logo_image_url.asset->url',
347
+ '"thumbnail": thumbnail.asset->url',
348
+ '"light_logo": light_mode_logo_url.asset->url',
349
+ '"dark_logo": dark_mode_logo_url.asset->url',
350
+ `"description": ${descriptionField}`,
351
+ 'total_xp',
352
+ ],
353
+ },
354
+ 'pack-bundle-lesson': {
355
+ fields: [`"resources": ${resourcesField}`],
356
+ },
357
+ foundation: {
358
+ fields: [
359
+ `"description": ${descriptionField}`,
360
+ `"instructors":instructor[]->name`,
361
+ `"units": child[]->{
347
362
  "id": railcontent_id,
348
363
  published_on,
349
364
  child_count,
@@ -357,113 +372,192 @@ export let contentTypeConfig = {
357
372
  xp,
358
373
  web_url_path,
359
374
  "url": web_url_path,
360
- }`
361
- ]
362
- },
363
- 'unit': {
364
- 'fields': [
365
- '"lesson_count": child_count',
366
- '"instructors": instructor[]->name',
367
- `"description": ${descriptionField}`,
368
- `"resource": ${resourcesField}`,
369
- 'xp',
370
- 'total_xp',
371
- `"lessons": child[]->{
375
+ }`,
376
+ ],
377
+ },
378
+ unit: {
379
+ fields: [
380
+ '"lesson_count": child_count',
381
+ '"instructors": instructor[]->name',
382
+ `"description": ${descriptionField}`,
383
+ `"resource": ${resourcesField}`,
384
+ 'xp',
385
+ 'total_xp',
386
+ `"lessons": child[]->{
372
387
  "id": railcontent_id,
373
388
  title,
374
389
  "image": thumbnail.asset->url,
375
390
  "instructors": instructor[]->name,
376
391
  length_in_seconds,
377
392
  }`,
378
- ],
379
- },
380
- 'instructor': {
381
- 'fields': [
382
- '"coach_top_banner_image": coach_top_banner_image.asset->url',
383
- '"coach_bottom_banner_image": coach_bottom_banner_image.asset->url',
384
- '"coach_card_image": coach_card_image.asset->url',
385
- '"coach_featured_image": coach_featured_image.asset->url',
386
- '"coach_top_banner_image": coach_top_banner_image.asset->url',
387
- '"focus": focus[]->name',
388
- 'focus_text',
389
- 'forum_thread_id',
390
- '"long_bio": long_bio[0].children[0].text',
391
- 'name',
392
- '"short_bio" : short_bio[0].children[0].text',
393
- 'bands',
394
- 'endorsements',
395
- ]
396
- },
397
- // content with just the added 'instructors' Field
398
- 'student-focus': contentWithInstructorsField,
399
- 'quick-tips': contentWithInstructorsField,
400
- 'drum-fest-international-2022': contentWithInstructorsField,
401
- 'spotlight': contentWithInstructorsField,
402
- 'the-history-of-electronic-drums': contentWithInstructorsField,
403
- 'backstage-secret': contentWithInstructorsField,
404
- 'question-and-answer': contentWithInstructorsField,
405
- 'student-collaboration': contentWithInstructorsField,
406
- 'live': { ...contentWithInstructorsField, 'slug': 'live-streams' },
407
- 'solo': { ...contentWithInstructorsField, 'slug': 'solos' },
408
- 'boot-camp': contentWithInstructorsField,
409
- 'gear-guids': contentWithInstructorsField,
410
- 'performance': contentWithInstructorsField,
411
- 'challenges': contentWithInstructorsField,
412
- 'on-the-road': contentWithInstructorsField,
413
- // content with just the added 'sort' field
414
- 'podcast': contentWithSortField,
415
- 'in-rhythm': contentWithSortField,
416
- 'diy-drum-experiment': contentWithSortField,
417
- 'rhythmic-adventures-of-captain-carson': contentWithSortField,
418
- 'study-the-greats': contentWithSortField,
419
- 'rhythms-from-another-planet': contentWithSortField,
420
- 'paiste-cymbals': contentWithInstructorsField,
421
- 'behind-the-scenes': contentWithSortField,
422
- 'exploring-beats': contentWithSortField,
423
- 'sonor': contentWithSortField,
393
+ ],
394
+ },
395
+ instructor: {
396
+ fields: [
397
+ '"coach_top_banner_image": coach_top_banner_image.asset->url',
398
+ '"coach_bottom_banner_image": coach_bottom_banner_image.asset->url',
399
+ '"coach_card_image": coach_card_image.asset->url',
400
+ '"coach_featured_image": coach_featured_image.asset->url',
401
+ '"coach_top_banner_image": coach_top_banner_image.asset->url',
402
+ '"focus": focus[]->name',
403
+ 'focus_text',
404
+ 'forum_thread_id',
405
+ '"long_bio": long_bio[0].children[0].text',
406
+ 'name',
407
+ '"short_bio" : short_bio[0].children[0].text',
408
+ 'bands',
409
+ 'endorsements',
410
+ ],
411
+ },
412
+ // content with just the added 'instructors' Field
413
+ 'student-focus': contentWithInstructorsField,
414
+ 'quick-tips': contentWithInstructorsField,
415
+ 'drum-fest-international-2022': contentWithInstructorsField,
416
+ spotlight: contentWithInstructorsField,
417
+ 'the-history-of-electronic-drums': contentWithInstructorsField,
418
+ 'backstage-secret': contentWithInstructorsField,
419
+ 'question-and-answer': contentWithInstructorsField,
420
+ 'student-collaboration': contentWithInstructorsField,
421
+ live: { ...contentWithInstructorsField, slug: 'live-streams' },
422
+ solo: { ...contentWithInstructorsField, slug: 'solos' },
423
+ 'boot-camp': contentWithInstructorsField,
424
+ 'gear-guids': contentWithInstructorsField,
425
+ performance: contentWithInstructorsField,
426
+ challenges: contentWithInstructorsField,
427
+ 'on-the-road': contentWithInstructorsField,
428
+ // content with just the added 'sort' field
429
+ podcast: contentWithSortField,
430
+ 'in-rhythm': contentWithSortField,
431
+ 'diy-drum-experiment': contentWithSortField,
432
+ 'rhythmic-adventures-of-captain-carson': contentWithSortField,
433
+ 'study-the-greats': contentWithSortField,
434
+ 'rhythms-from-another-planet': contentWithSortField,
435
+ 'paiste-cymbals': contentWithInstructorsField,
436
+ 'behind-the-scenes': contentWithSortField,
437
+ 'exploring-beats': contentWithSortField,
438
+ sonor: contentWithSortField,
424
439
  }
425
440
 
426
- export const songAccessMembership = 94;
441
+ export const songAccessMembership = 94
427
442
 
428
443
  export function getNewReleasesTypes(brand) {
429
- const baseNewTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "workout", "challenge", "challenge-part", "podcasts", "pack", "song", "learning-path-level", "play-along", "course", "unit"];
430
- switch (brand) {
431
- case 'drumeo':
432
- return [...baseNewTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
433
- case 'guitareo':
434
- return [...baseNewTypes, "archives", "recording", "chords-and-scales"];
435
- case 'pianote':
436
- case 'singeo':
437
- default:
438
- return baseNewTypes
439
- }
444
+ const baseNewTypes = [
445
+ 'student-review',
446
+ 'student-review',
447
+ 'student-focus',
448
+ 'coach-stream',
449
+ 'live',
450
+ 'question-and-answer',
451
+ 'boot-camps',
452
+ 'quick-tips',
453
+ 'workout',
454
+ 'challenge',
455
+ 'challenge-part',
456
+ 'podcasts',
457
+ 'pack',
458
+ 'song',
459
+ 'learning-path-level',
460
+ 'play-along',
461
+ 'course',
462
+ 'unit',
463
+ ]
464
+ switch (brand) {
465
+ case 'drumeo':
466
+ return [
467
+ ...baseNewTypes,
468
+ 'drum-fest-international-2022',
469
+ 'spotlight',
470
+ 'the-history-of-electronic-drums',
471
+ 'backstage-secrets',
472
+ 'student-collaborations',
473
+ 'live',
474
+ 'solos',
475
+ 'gear-guides',
476
+ 'performances',
477
+ 'in-rhythm',
478
+ 'challenges',
479
+ 'on-the-road',
480
+ 'diy-drum-experiments',
481
+ 'rhythmic-adventures-of-captain-carson',
482
+ 'study-the-greats',
483
+ 'rhythms-from-another-planet',
484
+ 'tama-drums',
485
+ 'paiste-cymbals',
486
+ 'behind-the-scenes',
487
+ 'exploring-beats',
488
+ 'sonor',
489
+ ]
490
+ case 'guitareo':
491
+ return [...baseNewTypes, 'archives', 'recording', 'chords-and-scales']
492
+ case 'pianote':
493
+ case 'singeo':
494
+ default:
495
+ return baseNewTypes
496
+ }
440
497
  }
441
498
 
442
499
  export function getUpcomingEventsTypes(brand) {
443
- const baseLiveTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "recording", "pack-bundle-lesson"];
444
- switch (brand) {
445
- case 'drumeo':
446
- return [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live", "podcasts", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
447
- case 'guitareo':
448
- return [...baseLiveTypes, "archives"];
449
- case 'pianote':
450
- case 'singeo':
451
- default:
452
- return baseLiveTypes;
453
- }
500
+ const baseLiveTypes = [
501
+ 'student-review',
502
+ 'student-review',
503
+ 'student-focus',
504
+ 'coach-stream',
505
+ 'live',
506
+ 'question-and-answer',
507
+ 'boot-camps',
508
+ 'quick-tips',
509
+ 'recording',
510
+ 'pack-bundle-lesson',
511
+ ]
512
+ switch (brand) {
513
+ case 'drumeo':
514
+ return [
515
+ ...baseLiveTypes,
516
+ 'drum-fest-international-2022',
517
+ 'spotlight',
518
+ 'the-history-of-electronic-drums',
519
+ 'backstage-secrets',
520
+ 'student-collaborations',
521
+ 'live',
522
+ 'podcasts',
523
+ 'solos',
524
+ 'gear-guides',
525
+ 'performances',
526
+ 'in-rhythm',
527
+ 'challenges',
528
+ 'on-the-road',
529
+ 'diy-drum-experiments',
530
+ 'rhythmic-adventures-of-captain-carson',
531
+ 'study-the-greats',
532
+ 'rhythms-from-another-planet',
533
+ 'tama-drums',
534
+ 'paiste-cymbals',
535
+ 'behind-the-scenes',
536
+ 'exploring-beats',
537
+ 'sonor',
538
+ ]
539
+ case 'guitareo':
540
+ return [...baseLiveTypes, 'archives']
541
+ case 'pianote':
542
+ case 'singeo':
543
+ default:
544
+ return baseLiveTypes
545
+ }
454
546
  }
455
547
 
456
548
  export function artistOrInstructorName(key = 'artist_name') {
457
- return `'${key}': coalesce(artist->name, instructor[0]->name)`;
549
+ return `'${key}': coalesce(artist->name, instructor[0]->name)`
458
550
  }
459
551
 
460
552
  export function artistOrInstructorNameAsArray(key = 'artists') {
461
- return `'${key}': select(artist->name != null => [artist->name], instructor[]->name)`;
553
+ return `'${key}': select(artist->name != null => [artist->name], instructor[]->name)`
462
554
  }
463
555
 
464
556
  export function getFieldsForContentType(contentType, asQueryString = true) {
465
- const fields = contentType ? DEFAULT_FIELDS.concat(contentTypeConfig?.[contentType]?.fields ?? []) : DEFAULT_FIELDS;
466
- return asQueryString ? fields.toString() + ',' : fields;
557
+ const fields = contentType
558
+ ? DEFAULT_FIELDS.concat(contentTypeConfig?.[contentType]?.fields ?? [])
559
+ : DEFAULT_FIELDS
560
+ return asQueryString ? fields.toString() + ',' : fields
467
561
  }
468
562
 
469
563
  /**
@@ -473,86 +567,97 @@ export function getFieldsForContentType(contentType, asQueryString = true) {
473
567
  * @returns {string} - A string that can be used in a groq query
474
568
  */
475
569
  export function filtersToGroq(filters, selectedFilters = []) {
476
- if (!filters) {
477
- filters = [];
478
- }
570
+ if (!filters) {
571
+ filters = []
572
+ }
479
573
 
480
- //Account for multiple railcontent id's
481
- let multipleIdFilters = '';
482
- filters.forEach(item => {
483
- if (item.includes('railcontent_id in')) {
484
- filters.pop(item);
485
- multipleIdFilters += ` && ${item} `;
486
- }
487
- })
574
+ //Account for multiple railcontent id's
575
+ let multipleIdFilters = ''
576
+ filters.forEach((item) => {
577
+ if (item.includes('railcontent_id in')) {
578
+ filters.pop(item)
579
+ multipleIdFilters += ` && ${item} `
580
+ }
581
+ })
488
582
 
489
- //Group All Other filters
490
- const groupedFilters = groupFilters(filters);
583
+ //Group All Other filters
584
+ const groupedFilters = groupFilters(filters)
491
585
 
492
- //Format groupFilter itemsss
493
- const filterClauses = Object.entries(groupedFilters).map(([key, values]) => {
494
- if (!key || values.length === 0) return '';
495
- if (key.startsWith('is_')) {
496
- return `&& ${key} == true`;
497
- }
498
- // Filter out values that exist in selectedFilters
499
- const joinedValues = values.map(value => {
500
- if (key === 'bpm' && !selectedFilters.includes('bpm')) {
501
- if (value.includes('-')) {
502
- const [min, max] = value.split('-').map(Number);
503
- return `(bpm > ${min} && bpm < ${max})`;
504
- } else if (value.includes('+')) {
505
- const min = parseInt(value, 10);
506
- return `(bpm > ${min})`;
507
- } else {
508
- return `bpm == ${value}`;
509
- }
510
- } else if (['creativity', 'essential', 'focus', 'genre', 'lifestyle', 'theory', 'topic'].includes(key) && !selectedFilters.includes(key)) {
511
- return `"${value}" in ${key}[]->name`;
512
- } else if (key === 'gear' && !selectedFilters.includes('gear')) {
513
- return `gear match "${value}"`;
514
- } else if (key === 'instrumentless' && !selectedFilters.includes(key)) {
515
- if (value === "Full Song Only") {
516
- return `(!instrumentless || instrumentless == null)`;
517
- } else if (value === "Instrument Removed") {
518
- return `instrumentless`;
519
- } else {
520
- return `instrumentless == ${value}`;
521
- }
522
- } else if (key === 'difficulty' && !selectedFilters.includes(key)) {
523
- return `difficulty_string == "${value}"`;
524
- } else if (key === 'type' && !selectedFilters.includes(key)) {
525
- return `_type == "${value}"`;
526
- } else if (key === 'length_in_seconds') {
527
- if (value.includes('-')) {
528
- const [min, max] = value.split('-').map(Number);
529
- return `(${key} > ${min} && ${key} < ${max})`;
530
- } else if (value.includes('+')) {
531
- const min = parseInt(value, 10);
532
- return `(${key} > ${min})`;
533
- } else {
534
- return `${key} == ${value}`;
535
- }
536
- } else if (!selectedFilters.includes(key)) {
537
- return ` ${key} == ${/^\d+$/.test(value) ? value : `"$${value}"`}`;
586
+ //Format groupFilter itemsss
587
+ const filterClauses = Object.entries(groupedFilters)
588
+ .map(([key, values]) => {
589
+ if (!key || values.length === 0) return ''
590
+ if (key.startsWith('is_')) {
591
+ return `&& ${key} == true`
592
+ }
593
+ // Filter out values that exist in selectedFilters
594
+ const joinedValues = values
595
+ .map((value) => {
596
+ if (key === 'bpm' && !selectedFilters.includes('bpm')) {
597
+ if (value.includes('-')) {
598
+ const [min, max] = value.split('-').map(Number)
599
+ return `(bpm > ${min} && bpm < ${max})`
600
+ } else if (value.includes('+')) {
601
+ const min = parseInt(value, 10)
602
+ return `(bpm > ${min})`
603
+ } else {
604
+ return `bpm == ${value}`
605
+ }
606
+ } else if (
607
+ ['creativity', 'essential', 'focus', 'genre', 'lifestyle', 'theory', 'topic'].includes(
608
+ key
609
+ ) &&
610
+ !selectedFilters.includes(key)
611
+ ) {
612
+ return `"${value}" in ${key}[]->name`
613
+ } else if (key === 'gear' && !selectedFilters.includes('gear')) {
614
+ return `gear match "${value}"`
615
+ } else if (key === 'instrumentless' && !selectedFilters.includes(key)) {
616
+ if (value === 'Full Song Only') {
617
+ return `(!instrumentless || instrumentless == null)`
618
+ } else if (value === 'Instrument Removed') {
619
+ return `instrumentless`
620
+ } else {
621
+ return `instrumentless == ${value}`
538
622
  }
539
- }).filter(Boolean).join(' || ');
623
+ } else if (key === 'difficulty' && !selectedFilters.includes(key)) {
624
+ return `difficulty_string == "${value}"`
625
+ } else if (key === 'type' && !selectedFilters.includes(key)) {
626
+ return `_type == "${value}"`
627
+ } else if (key === 'length_in_seconds') {
628
+ if (value.includes('-')) {
629
+ const [min, max] = value.split('-').map(Number)
630
+ return `(${key} > ${min} && ${key} < ${max})`
631
+ } else if (value.includes('+')) {
632
+ const min = parseInt(value, 10)
633
+ return `(${key} > ${min})`
634
+ } else {
635
+ return `${key} == ${value}`
636
+ }
637
+ } else if (!selectedFilters.includes(key)) {
638
+ return ` ${key} == ${/^\d+$/.test(value) ? value : `"$${value}"`}`
639
+ }
640
+ })
641
+ .filter(Boolean)
642
+ .join(' || ')
540
643
 
541
- // Return the constructed filter clause
542
- return joinedValues.length > 0 ? `&& (${joinedValues})` : '';
543
- }).filter(Boolean).join(' ');
644
+ // Return the constructed filter clause
645
+ return joinedValues.length > 0 ? `&& (${joinedValues})` : ''
646
+ })
647
+ .filter(Boolean)
648
+ .join(' ')
544
649
 
545
- //Return
546
- return `${multipleIdFilters} ${filterClauses}`;
650
+ //Return
651
+ return `${multipleIdFilters} ${filterClauses}`
547
652
  }
548
653
 
549
654
  function groupFilters(filters) {
550
- if (filters.length === 0) return {};
655
+ if (filters.length === 0) return {}
551
656
 
552
- return filters.reduce((acc, filter) => {
553
- const [category, value] = filter.split(',');
554
- if (!acc[category]) acc[category] = [];
555
- acc[category].push(value);
556
- return acc;
557
- }, {});
657
+ return filters.reduce((acc, filter) => {
658
+ const [category, value] = filter.split(',')
659
+ if (!acc[category]) acc[category] = []
660
+ acc[category].push(value)
661
+ return acc
662
+ }, {})
558
663
  }