musora-content-services 1.0.12 → 1.0.14

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.
@@ -0,0 +1,39 @@
1
+ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3
+
4
+ name: Node.js CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ "main" ]
9
+ pull_request:
10
+ branches: [ "main" ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [20.x]
20
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Use Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+ cache: 'npm'
29
+ - run: npm ci
30
+ - run: npm run build --if-present
31
+ - name: 'Create env file'
32
+ run: |
33
+ touch .env
34
+ echo SANITY_API_TOKEN=${{ secrets.SANITY_API_TOKEN }} >> .env
35
+ echo SANITY_PROJECT_ID=4032r8py >> .env
36
+ echo SANITY_DATASET=staging >> .env
37
+ echo SANITY_USE_CACHED_API=false >> .env
38
+ cat .env
39
+ - run: npm test
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.0.14](https://github.com/railroadmedia/musora-content-services/compare/v1.0.13...v1.0.14) (2024-08-13)
6
+
7
+ ### [1.0.13](https://github.com/railroadmedia/musora-content-services/compare/v1.0.12...v1.0.13) (2024-08-13)
8
+
5
9
  ### [1.0.12](https://github.com/railroadmedia/musora-content-services/compare/v1.0.11...v1.0.12) (2024-08-12)
6
10
 
7
11
  ### [1.0.11](https://github.com/railroadmedia/musora-content-services/compare/v1.0.10...v1.0.11) (2024-08-12)
package/docs/global.html CHANGED
@@ -146,7 +146,7 @@
146
146
 
147
147
  <dt class="tag-source">Source:</dt>
148
148
  <dd class="tag-source"><ul class="dummy"><li>
149
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line530">line 530</a>
149
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line538">line 538</a>
150
150
  </li></ul></dd>
151
151
 
152
152
 
@@ -639,7 +639,7 @@ The filter options are dynamically generated based on the provided filters, styl
639
639
 
640
640
  <dt class="tag-source">Source:</dt>
641
641
  <dd class="tag-source"><ul class="dummy"><li>
642
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line674">line 674</a>
642
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line682">line 682</a>
643
643
  </li></ul></dd>
644
644
 
645
645
 
@@ -1612,7 +1612,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1612
1612
 
1613
1613
  <dt class="tag-source">Source:</dt>
1614
1614
  <dd class="tag-source"><ul class="dummy"><li>
1615
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line463">line 463</a>
1615
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line471">line 471</a>
1616
1616
  </li></ul></dd>
1617
1617
 
1618
1618
 
@@ -1777,7 +1777,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1777
1777
 
1778
1778
  <dt class="tag-source">Source:</dt>
1779
1779
  <dd class="tag-source"><ul class="dummy"><li>
1780
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line489">line 489</a>
1780
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line497">line 497</a>
1781
1781
  </li></ul></dd>
1782
1782
 
1783
1783
 
@@ -1942,7 +1942,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1942
1942
 
1943
1943
  <dt class="tag-source">Source:</dt>
1944
1944
  <dd class="tag-source"><ul class="dummy"><li>
1945
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line716">line 716</a>
1945
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line724">line 724</a>
1946
1946
  </li></ul></dd>
1947
1947
 
1948
1948
 
@@ -2100,7 +2100,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2100
2100
 
2101
2101
  <dt class="tag-source">Source:</dt>
2102
2102
  <dd class="tag-source"><ul class="dummy"><li>
2103
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line794">line 794</a>
2103
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line802">line 802</a>
2104
2104
  </li></ul></dd>
2105
2105
 
2106
2106
 
@@ -2265,7 +2265,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2265
2265
 
2266
2266
  <dt class="tag-source">Source:</dt>
2267
2267
  <dd class="tag-source"><ul class="dummy"><li>
2268
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line758">line 758</a>
2268
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line766">line 766</a>
2269
2269
  </li></ul></dd>
2270
2270
 
2271
2271
 
@@ -2423,7 +2423,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2423
2423
 
2424
2424
  <dt class="tag-source">Source:</dt>
2425
2425
  <dd class="tag-source"><ul class="dummy"><li>
2426
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line737">line 737</a>
2426
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line745">line 745</a>
2427
2427
  </li></ul></dd>
2428
2428
 
2429
2429
 
@@ -2581,7 +2581,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2581
2581
 
2582
2582
  <dt class="tag-source">Source:</dt>
2583
2583
  <dd class="tag-source"><ul class="dummy"><li>
2584
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line393">line 393</a>
2584
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line401">line 401</a>
2585
2585
  </li></ul></dd>
2586
2586
 
2587
2587
 
@@ -2739,7 +2739,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2739
2739
 
2740
2740
  <dt class="tag-source">Source:</dt>
2741
2741
  <dd class="tag-source"><ul class="dummy"><li>
2742
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line768">line 768</a>
2742
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line776">line 776</a>
2743
2743
  </li></ul></dd>
2744
2744
 
2745
2745
 
@@ -2897,7 +2897,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2897
2897
 
2898
2898
  <dt class="tag-source">Source:</dt>
2899
2899
  <dd class="tag-source"><ul class="dummy"><li>
2900
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line848">line 848</a>
2900
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line856">line 856</a>
2901
2901
  </li></ul></dd>
2902
2902
 
2903
2903
 
@@ -3055,7 +3055,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3055
3055
 
3056
3056
  <dt class="tag-source">Source:</dt>
3057
3057
  <dd class="tag-source"><ul class="dummy"><li>
3058
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line874">line 874</a>
3058
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line882">line 882</a>
3059
3059
  </li></ul></dd>
3060
3060
 
3061
3061
 
@@ -3220,7 +3220,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3220
3220
 
3221
3221
  <dt class="tag-source">Source:</dt>
3222
3222
  <dd class="tag-source"><ul class="dummy"><li>
3223
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line827">line 827</a>
3223
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line835">line 835</a>
3224
3224
  </li></ul></dd>
3225
3225
 
3226
3226
 
@@ -3591,7 +3591,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3591
3591
 
3592
3592
  <dt class="tag-source">Source:</dt>
3593
3593
  <dd class="tag-source"><ul class="dummy"><li>
3594
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line891">line 891</a>
3594
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line899">line 899</a>
3595
3595
  </li></ul></dd>
3596
3596
 
3597
3597
 
@@ -4427,7 +4427,7 @@ fetchSanity(query, true)
4427
4427
 
4428
4428
  <dt class="tag-source">Source:</dt>
4429
4429
  <dd class="tag-source"><ul class="dummy"><li>
4430
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line427">line 427</a>
4430
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line435">line 435</a>
4431
4431
  </li></ul></dd>
4432
4432
 
4433
4433
 
@@ -4576,7 +4576,7 @@ fetchSanity(query, true)
4576
4576
 
4577
4577
 
4578
4578
 
4579
- <h4 class="name" id="fetchWorkouts"><span class="type-signature type-signature-async">(async) </span>fetchWorkouts<span class="signature">(brand)</span><span class="type-signature"> &rarr; {Promise.&lt;(Object|null)>}</span></h4>
4579
+ <h4 class="name" id="fetchWorkouts"><span class="type-signature type-signature-async">(async) </span>fetchWorkouts<span class="signature">(brand)</span><span class="type-signature"> &rarr; {Promise.&lt;(Array.&lt;Object>|null)>}</span></h4>
4580
4580
 
4581
4581
 
4582
4582
 
@@ -4586,13 +4586,14 @@ fetchSanity(query, true)
4586
4586
  <dl class="details">
4587
4587
 
4588
4588
  <dt class="tag-description">Description:</dt>
4589
- <dd class="tag-description"><ul class="dummy"><li>Fetch the latest workouts for the home page of a specific brand.</li></ul></dd>
4589
+ <dd class="tag-description"><ul class="dummy"><li>Fetch the latest workouts for the home page of a specific brand.
4590
+ This function retrieves the latest workout content for a given brand, fetching up to five workouts. The workouts are sorted in descending order by their publication date.</li></ul></dd>
4590
4591
 
4591
4592
 
4592
4593
 
4593
4594
  <dt class="tag-source">Source:</dt>
4594
4595
  <dd class="tag-source"><ul class="dummy"><li>
4595
- <a href="index.js.html">index.js</a>, <a href="index.js.html#line373">line 373</a>
4596
+ <a href="index.js.html">index.js</a>, <a href="index.js.html#line379">line 379</a>
4596
4597
  </li></ul></dd>
4597
4598
 
4598
4599
 
@@ -4637,6 +4638,13 @@ fetchSanity(query, true)
4637
4638
 
4638
4639
 
4639
4640
 
4641
+ <h5 class="h5-examples">Example</h5>
4642
+
4643
+ <pre class="prettyprint"><code>fetchWorkouts('drumeo')
4644
+ .then(workouts => console.log(workouts))
4645
+ .catch(error => console.error(error));</code></pre>
4646
+
4647
+
4640
4648
 
4641
4649
 
4642
4650
  <h5 class="h5-parameters">Parameters:</h5>
@@ -4681,7 +4689,7 @@ fetchSanity(query, true)
4681
4689
 
4682
4690
 
4683
4691
 
4684
- <td class="description last">The brand for which to fetch workouts.</td>
4692
+ <td class="description last">The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').</td>
4685
4693
  </tr>
4686
4694
 
4687
4695
 
@@ -4707,7 +4715,7 @@ fetchSanity(query, true)
4707
4715
 
4708
4716
 
4709
4717
  <div class="param-desc">
4710
- - The fetched workout data or null if not found.
4718
+ - A promise that resolves to an array of workout data objects or null if no workouts are found.
4711
4719
  </div>
4712
4720
 
4713
4721
 
@@ -4718,7 +4726,7 @@ fetchSanity(query, true)
4718
4726
  </dt>
4719
4727
  <dd>
4720
4728
 
4721
- <span class="param-type">Promise.&lt;(Object|null)></span>
4729
+ <span class="param-type">Promise.&lt;(Array.&lt;Object>|null)></span>
4722
4730
 
4723
4731
 
4724
4732
 
@@ -5152,7 +5160,7 @@ initializeSanityService({
5152
5160
  <br class="clear">
5153
5161
 
5154
5162
  <footer>
5155
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Mon Aug 12 2024 15:31:44 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
5163
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 13 2024 03:05:39 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
5156
5164
  </footer>
5157
5165
 
5158
5166
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -103,7 +103,7 @@ Run the following to execute the tests</p>
103
103
  <br class="clear">
104
104
 
105
105
  <footer>
106
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Mon Aug 12 2024 15:31:44 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
106
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 13 2024 03:05:39 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
107
107
  </footer>
108
108
 
109
109
  <script>prettyPrint();</script>
@@ -132,7 +132,7 @@ async function fetchArtists(brand) {
132
132
  */
133
133
  async function fetchSongArtistCount(brand) {
134
134
  const query = `count(*[_type == 'artist']{'lessonsCount': count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; references(^._id)]._id)}[lessonsCount > 0])`;
135
- return fetchSanity(query, false);
135
+ return fetchSanity(query, true);
136
136
  }
137
137
 
138
138
  /**
@@ -304,21 +304,21 @@ async function fetchAllSongs(brand, {
304
304
  'head_shot_picture_url': thumbnail_url.asset->url,
305
305
  'all_lessons_count': count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == artist._ref ]._id),
306
306
  'lessons': *[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == artist._ref ]{
307
- railcontent_id,
307
+ "id": railcontent_id,
308
+ "type": _type,
308
309
  title,
309
- "image": thumbnail.asset->url,
310
+ "thumbnail_url": thumbnail.asset->url,
310
311
  "artist_name": artist->name,
311
- artist,
312
- difficulty,
313
312
  difficulty_string,
314
- web_url_path,
315
- published_on
313
+ published_on,
314
+ soundslice,
315
+ instrumentless,
316
316
  }[0...10]
317
317
  }
318
318
  |order(${sortOrder})
319
319
  [${start}...${end}]
320
320
  }`;
321
- } else if (groupBy === "genre") {
321
+ } else if (groupBy === "style") {
322
322
  query = `
323
323
  {
324
324
  "total": count(*[_type == 'genre' &amp;&amp; count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in genre[]._ref ]._id) > 0]),
@@ -331,15 +331,15 @@ async function fetchAllSongs(brand, {
331
331
  'head_shot_picture_url': thumbnail_url.asset->url,
332
332
  'all_lessons_count': count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in genre[]._ref ]._id),
333
333
  'lessons': *[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in genre[]._ref ]{
334
- railcontent_id,
334
+ "id": railcontent_id,
335
+ "type": _type,
335
336
  title,
336
- "image": thumbnail.asset->url,
337
+ "thumbnail_url": thumbnail.asset->url,
337
338
  "artist_name": artist->name,
338
- artist,
339
- difficulty,
340
339
  difficulty_string,
341
- web_url_path,
342
- published_on
340
+ published_on,
341
+ soundslice,
342
+ instrumentless,
343
343
  }[0...10]
344
344
  }
345
345
  |order(${sortOrder})
@@ -349,22 +349,22 @@ async function fetchAllSongs(brand, {
349
349
  query = `
350
350
  {
351
351
  "entity": *[_type == 'song' &amp;&amp; brand == "${brand}" ${searchFilter} ${includedFieldsFilter}] | order(${sortOrder}) [${start}...${end}] {
352
- railcontent_id,
352
+ "id": railcontent_id,
353
+ "type": _type,
353
354
  title,
354
- "image": thumbnail.asset->url,
355
+ "thumbnail_url": thumbnail.asset->url,
355
356
  "artist_name": artist->name,
356
- artist,
357
- difficulty,
358
357
  difficulty_string,
359
- web_url_path,
360
- published_on
358
+ published_on,
359
+ soundslice,
360
+ instrumentless,
361
361
  },
362
362
  "total": count(*[_type == 'song' &amp;&amp; brand == "${brand}" ${searchFilter} ${includedFieldsFilter}])
363
363
  }
364
364
  `;
365
365
  }
366
366
 
367
- return fetchSanity(query, false);
367
+ return fetchSanity(query, true);
368
368
  }
369
369
 
370
370
  /**
@@ -382,24 +382,24 @@ async function fetchSongFilterOptions(brand) {
382
382
  const query = `
383
383
  {
384
384
  "difficulty": [
385
- {"type": "Introductory", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; difficulty_string == "Introductory"]._id)},
386
- {"type": "Beginner", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; difficulty_string == "Beginner"]._id)},
387
- {"type": "Intermediate", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; difficulty_string == "Intermediate"]._id)},
388
- {"type": "Advanced", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; difficulty_string == "Advanced"]._id)},
389
- {"type": "Expert", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; difficulty_string == "Expert"]._id)}
385
+ {"type": "Introductory", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; difficulty_string == "Introductory"]._id)},
386
+ {"type": "Beginner", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; difficulty_string == "Beginner"]._id)},
387
+ {"type": "Intermediate", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; difficulty_string == "Intermediate"]._id)},
388
+ {"type": "Advanced", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; difficulty_string == "Advanced"]._id)},
389
+ {"type": "Expert", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; difficulty_string == "Expert"]._id)}
390
390
  ],
391
391
  "genre": *[_type == 'genre' &amp;&amp; 'song' in filter_types] {
392
392
  "type": name,
393
- "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; references(^._id)]._id)
393
+ "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; references(^._id)]._id)
394
394
  },
395
395
  "instrumentless": [
396
- {"type": "Full Song Only", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; instrumentless == false]._id)},
397
- {"type": "Instrument Removed", "count": count(*[_type == 'song' &amp;&amp; brand == ${brand} &amp;&amp; instrumentless == true]._id)}
396
+ {"type": "Full Song Only", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; instrumentless == false]._id)},
397
+ {"type": "Instrument Removed", "count": count(*[_type == 'song' &amp;&amp; brand == '${brand}' &amp;&amp; instrumentless == true]._id)}
398
398
  ]
399
399
  }
400
400
  `;
401
401
 
402
- return fetchSanity(query, false);
402
+ return fetchSanity(query, true);
403
403
  }
404
404
 
405
405
  /**
@@ -414,20 +414,28 @@ async function fetchSongCount(brand) {
414
414
 
415
415
  /**
416
416
  * Fetch the latest workouts for the home page of a specific brand.
417
- * @param {string} brand - The brand for which to fetch workouts.
418
- * @returns {Promise&lt;Object|null>} - The fetched workout data or null if not found.
417
+ * This function retrieves the latest workout content for a given brand, fetching up to five workouts. The workouts are sorted in descending order by their publication date.
418
+ * @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
419
+ * @returns {Promise&lt;Array&lt;Object>|null>} - A promise that resolves to an array of workout data objects or null if no workouts are found.
420
+ *
421
+ * @example
422
+ * fetchWorkouts('drumeo')
423
+ * .then(workouts => console.log(workouts))
424
+ * .catch(error => console.error(error));
419
425
  */
420
426
  async function fetchWorkouts(brand) {
421
427
  const query = `*[_type == 'workout' &amp;&amp; brand == '${brand}'] [0...5] {
422
428
  railcontent_id,
423
429
  title,
424
430
  "image": thumbnail.asset->url,
425
- "artist_name": artist->name,
426
- artist,
431
+ "artist_name": instructor[0]->name,
432
+ "artists": instructor[]->name,
427
433
  difficulty,
428
434
  difficulty_string,
435
+ length_in_seconds,
436
+ published_on,
437
+ "type": _type,
429
438
  web_url_path,
430
- published_on
431
439
  } | order(published_on desc)[0...5]`
432
440
  return fetchSanity(query, true);
433
441
  }
@@ -1027,7 +1035,6 @@ module.exports = {
1027
1035
  fetchPackChildren,
1028
1036
  fetchLessonContent
1029
1037
  };
1030
-
1031
1038
  </code></pre>
1032
1039
  </article>
1033
1040
  </section>
@@ -1042,7 +1049,7 @@ module.exports = {
1042
1049
  <br class="clear">
1043
1050
 
1044
1051
  <footer>
1045
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Mon Aug 12 2024 15:31:44 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1052
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 13 2024 03:05:39 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1046
1053
  </footer>
1047
1054
 
1048
1055
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -367,20 +367,28 @@ async function fetchSongCount(brand) {
367
367
 
368
368
  /**
369
369
  * Fetch the latest workouts for the home page of a specific brand.
370
- * @param {string} brand - The brand for which to fetch workouts.
371
- * @returns {Promise<Object|null>} - The fetched workout data or null if not found.
370
+ * This function retrieves the latest workout content for a given brand, fetching up to five workouts. The workouts are sorted in descending order by their publication date.
371
+ * @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
372
+ * @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of workout data objects or null if no workouts are found.
373
+ *
374
+ * @example
375
+ * fetchWorkouts('drumeo')
376
+ * .then(workouts => console.log(workouts))
377
+ * .catch(error => console.error(error));
372
378
  */
373
379
  async function fetchWorkouts(brand) {
374
380
  const query = `*[_type == 'workout' && brand == '${brand}'] [0...5] {
375
381
  railcontent_id,
376
382
  title,
377
383
  "image": thumbnail.asset->url,
378
- "artist_name": artist->name,
379
- artist,
384
+ "artist_name": instructor[0]->name,
385
+ "artists": instructor[]->name,
380
386
  difficulty,
381
387
  difficulty_string,
388
+ length_in_seconds,
389
+ published_on,
390
+ "type": _type,
382
391
  web_url_path,
383
- published_on
384
392
  } | order(published_on desc)[0...5]`
385
393
  return fetchSanity(query, true);
386
394
  }