musora-content-services 1.0.104 → 1.0.107

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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.107](https://github.com/railroadmedia/musora-content-services/compare/v1.0.106...v1.0.107) (2024-09-19)
6
+
7
+ ### [1.0.106](https://github.com/railroadmedia/musora-content-services/compare/v1.0.105...v1.0.106) (2024-09-19)
8
+
9
+ ### [1.0.105](https://github.com/railroadmedia/musora-content-services/compare/v1.0.104...v1.0.105) (2024-09-19)
10
+
5
11
  ### [1.0.104](https://github.com/railroadmedia/musora-content-services/compare/v1.0.103...v1.0.104) (2024-09-18)
6
12
 
7
13
  ### [1.0.103](https://github.com/railroadmedia/musora-content-services/compare/v1.0.102...v1.0.103) (2024-09-18)
@@ -114,7 +114,7 @@ module.exports = {
114
114
  <br class="clear">
115
115
 
116
116
  <footer>
117
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
117
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
118
118
  </footer>
119
119
 
120
120
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -61,7 +61,44 @@
61
61
 
62
62
  <section class="readme usertext">
63
63
  <article><h1>Musora Content Services</h1>
64
- <p>Welcome to the <strong>musora-content-services</strong> repository. This package provides a collection of utility functions designed to fetch and manage content from our Sanity Studio. These functions are tailored to interact with our Sanity backend, allowing you to easily retrieve, filter, and manipulate content for use in various applications.</p>
64
+ <p>Welcome to the <strong>musora-content-services</strong> repository. This package provides a collection of utility functions designed
65
+ to fetch and manage content from our Sanity Studio. These functions are tailored to interact with our Sanity backend,
66
+ allowing you to easily retrieve, filter, and manipulate content for use in various applications.</p>
67
+ <h2>Setup</h2>
68
+ <p>To set up the Musora Content Services project for local development, follow these steps:</p>
69
+ <ul>
70
+ <li>Pull the latest railenvironment <code>php-8-3-upgrade</code> branch changes</li>
71
+ <li>In the railenvironment directory, start up the container with the <code>./rrr.sh</code> command</li>
72
+ <li>Run <code>r setup musora-content-services</code></li>
73
+ <li>Run <code>npm install --save-dev jest</code></li>
74
+ <li>Create a new <code>.env</code> file in the root of the project and copy the contents from 1Password &quot;musora-content-services .env&quot;</li>
75
+ </ul>
76
+ <p>You're now set for doing basic development and running tests through npm. To set up an even better developer experience,
77
+ you can also do the following:</p>
78
+ <ul>
79
+ <li>Find the location of node within the container by running <code>which node</code> in your terminal (inside the rrr shell)
80
+ <ul>
81
+ <li>This should be something along the lines of <em>/home/.nvm/versions/node/v20.14.0/bin/node</em></li>
82
+ </ul>
83
+ </li>
84
+ <li>Add the Node interpreter to your IDE. The following steps are for PHPStorm:
85
+ <ul>
86
+ <li>Go to File &gt; Settings</li>
87
+ <li>Under Languages &amp; Frameworks, click on Node.js</li>
88
+ <li>Under the Node interpreter dropdown, click &quot;Add...&quot; and select &quot;Add Remote...&quot;</li>
89
+ <li>In the next window, choose the Docker option
90
+ <ul>
91
+ <li>Set the Server to Docker</li>
92
+ <li>For the Image name, use the dropdown to select <em>railenvironment_docker-manager:latest</em> (this is the docker image
93
+ that we're in when running the rrr shell)</li>
94
+ <li>For the Node.js interpreter path, paste in the path from step 1 (e.g. /home/.nvm/versions/node/v20.14.0/bin/node)</li>
95
+ </ul>
96
+ </li>
97
+ <li>Apply the changes and click OK</li>
98
+ </ul>
99
+ </li>
100
+ <li>You now have a Node interpreter set up that will assist in linting, tests, etc.</li>
101
+ </ul>
65
102
  <h2>Features</h2>
66
103
  <ul>
67
104
  <li><strong>Fetch Content by ID</strong>: Retrieve specific content items using their unique Railcontent ID.</li>
@@ -86,17 +123,18 @@
86
123
  <pre class="prettyprint source"><code>chmod +x &lt;command>
87
124
  </code></pre>
88
125
  <h2>Publish Documentation</h2>
89
- <p>This repo uses JSDoc to generate API documention. To update the docs, run:</p>
126
+ <p>This repo uses JSDoc to generate API documentation. To update the docs, run:</p>
90
127
  <pre class="prettyprint source lang-bash"><code>npm run doc
91
128
  </code></pre>
92
- <h2>Github Page Documentation</h2>
129
+ <h2>GitHub Page Documentation</h2>
93
130
  <p>https://railroadmedia.github.io/musora-content-services/</p>
94
131
  <h2>Run tests</h2>
95
- <p>Copy .env file from 1Password &quot;musora-content-services .env&quot;
96
- Run the following to execute the tests
97
- You may need to install jest (npm install --save-dev jest)</p>
132
+ <p>Ensure that the setup process has been completed, including copying .env file from 1Password &quot;musora-content-services .env&quot;
133
+ and having jest installed (<code>npm install --save-dev jest</code>). To run the full test suite, simply run the following:</p>
98
134
  <pre class="prettyprint source"><code>npm test
99
- </code></pre></article>
135
+ </code></pre>
136
+ <p>You can also filter down to specific tests with the <code>-- -t=&quot;...&quot;</code> option. e.g. you can run the userContext test suite
137
+ with <code>npm test -- -t=&quot;userContext&quot;</code> or just the contentLiked test with <code>npm test -- -t=&quot;contentLiked&quot;</code></p></article>
100
138
  </section>
101
139
 
102
140
 
@@ -111,7 +149,7 @@ You may need to install jest (npm install --save-dev jest)</p>
111
149
  <br class="clear">
112
150
 
113
151
  <footer>
114
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
152
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
115
153
  </footer>
116
154
 
117
155
  <script>prettyPrint();</script>
@@ -681,7 +681,7 @@ initializeService({
681
681
  <br class="clear">
682
682
 
683
683
  <footer>
684
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
684
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
685
685
  </footer>
686
686
 
687
687
  <script>prettyPrint();</script>
@@ -1518,7 +1518,7 @@
1518
1518
  <br class="clear">
1519
1519
 
1520
1520
  <footer>
1521
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1521
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1522
1522
  </footer>
1523
1523
 
1524
1524
  <script>prettyPrint();</script>
@@ -714,7 +714,7 @@ The filter options are dynamically generated based on the provided filters, styl
714
714
 
715
715
  <dt class="tag-source">Source:</dt>
716
716
  <dd class="tag-source"><ul class="dummy"><li>
717
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line561">line 561</a>
717
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line564">line 564</a>
718
718
  </li></ul></dd>
719
719
 
720
720
 
@@ -1090,7 +1090,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1090
1090
 
1091
1091
  <dt class="tag-source">Source:</dt>
1092
1092
  <dd class="tag-source"><ul class="dummy"><li>
1093
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line917">line 917</a>
1093
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line921">line 921</a>
1094
1094
  </li></ul></dd>
1095
1095
 
1096
1096
 
@@ -1810,7 +1810,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1810
1810
 
1811
1811
  <dt class="tag-source">Source:</dt>
1812
1812
  <dd class="tag-source"><ul class="dummy"><li>
1813
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1123">line 1123</a>
1813
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1127">line 1127</a>
1814
1814
  </li></ul></dd>
1815
1815
 
1816
1816
 
@@ -2562,7 +2562,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2562
2562
 
2563
2563
  <dt class="tag-source">Source:</dt>
2564
2564
  <dd class="tag-source"><ul class="dummy"><li>
2565
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1086">line 1086</a>
2565
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1090">line 1090</a>
2566
2566
  </li></ul></dd>
2567
2567
 
2568
2568
 
@@ -2728,7 +2728,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
2728
2728
 
2729
2729
  <dt class="tag-source">Source:</dt>
2730
2730
  <dd class="tag-source"><ul class="dummy"><li>
2731
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1259">line 1259</a>
2731
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1263">line 1263</a>
2732
2732
  </li></ul></dd>
2733
2733
 
2734
2734
 
@@ -2893,7 +2893,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
2893
2893
 
2894
2894
  <dt class="tag-source">Source:</dt>
2895
2895
  <dd class="tag-source"><ul class="dummy"><li>
2896
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1009">line 1009</a>
2896
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1013">line 1013</a>
2897
2897
  </li></ul></dd>
2898
2898
 
2899
2899
 
@@ -3058,7 +3058,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3058
3058
 
3059
3059
  <dt class="tag-source">Source:</dt>
3060
3060
  <dd class="tag-source"><ul class="dummy"><li>
3061
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line609">line 609</a>
3061
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line612">line 612</a>
3062
3062
  </li></ul></dd>
3063
3063
 
3064
3064
 
@@ -3260,7 +3260,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3260
3260
 
3261
3261
  <dt class="tag-source">Source:</dt>
3262
3262
  <dd class="tag-source"><ul class="dummy"><li>
3263
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1037">line 1037</a>
3263
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1041">line 1041</a>
3264
3264
  </li></ul></dd>
3265
3265
 
3266
3266
 
@@ -3425,7 +3425,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3425
3425
 
3426
3426
  <dt class="tag-source">Source:</dt>
3427
3427
  <dd class="tag-source"><ul class="dummy"><li>
3428
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1068">line 1068</a>
3428
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1072">line 1072</a>
3429
3429
  </li></ul></dd>
3430
3430
 
3431
3431
 
@@ -3590,7 +3590,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3590
3590
 
3591
3591
  <dt class="tag-source">Source:</dt>
3592
3592
  <dd class="tag-source"><ul class="dummy"><li>
3593
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line655">line 655</a>
3593
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line658">line 658</a>
3594
3594
  </li></ul></dd>
3595
3595
 
3596
3596
 
@@ -3748,7 +3748,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3748
3748
 
3749
3749
  <dt class="tag-source">Source:</dt>
3750
3750
  <dd class="tag-source"><ul class="dummy"><li>
3751
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1164">line 1164</a>
3751
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1168">line 1168</a>
3752
3752
  </li></ul></dd>
3753
3753
 
3754
3754
 
@@ -3961,7 +3961,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
3961
3961
 
3962
3962
  <dt class="tag-source">Source:</dt>
3963
3963
  <dd class="tag-source"><ul class="dummy"><li>
3964
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line821">line 821</a>
3964
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line825">line 825</a>
3965
3965
  </li></ul></dd>
3966
3966
 
3967
3967
 
@@ -4126,7 +4126,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4126
4126
 
4127
4127
  <dt class="tag-source">Source:</dt>
4128
4128
  <dd class="tag-source"><ul class="dummy"><li>
4129
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line668">line 668</a>
4129
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line671">line 671</a>
4130
4130
  </li></ul></dd>
4131
4131
 
4132
4132
 
@@ -4308,7 +4308,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4308
4308
 
4309
4309
  <dt class="tag-source">Source:</dt>
4310
4310
  <dd class="tag-source"><ul class="dummy"><li>
4311
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line705">line 705</a>
4311
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line709">line 709</a>
4312
4312
  </li></ul></dd>
4313
4313
 
4314
4314
 
@@ -4466,7 +4466,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4466
4466
 
4467
4467
  <dt class="tag-source">Source:</dt>
4468
4468
  <dd class="tag-source"><ul class="dummy"><li>
4469
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line759">line 759</a>
4469
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line763">line 763</a>
4470
4470
  </li></ul></dd>
4471
4471
 
4472
4472
 
@@ -4624,7 +4624,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4624
4624
 
4625
4625
  <dt class="tag-source">Source:</dt>
4626
4626
  <dd class="tag-source"><ul class="dummy"><li>
4627
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line726">line 726</a>
4627
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line730">line 730</a>
4628
4628
  </li></ul></dd>
4629
4629
 
4630
4630
 
@@ -4806,7 +4806,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4806
4806
 
4807
4807
  <dt class="tag-source">Source:</dt>
4808
4808
  <dd class="tag-source"><ul class="dummy"><li>
4809
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line743">line 743</a>
4809
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line747">line 747</a>
4810
4810
  </li></ul></dd>
4811
4811
 
4812
4812
 
@@ -4995,7 +4995,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
4995
4995
 
4996
4996
  <dt class="tag-source">Source:</dt>
4997
4997
  <dd class="tag-source"><ul class="dummy"><li>
4998
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line643">line 643</a>
4998
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line646">line 646</a>
4999
4999
  </li></ul></dd>
5000
5000
 
5001
5001
 
@@ -5311,7 +5311,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
5311
5311
 
5312
5312
  <dt class="tag-source">Source:</dt>
5313
5313
  <dd class="tag-source"><ul class="dummy"><li>
5314
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line795">line 795</a>
5314
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line799">line 799</a>
5315
5315
  </li></ul></dd>
5316
5316
 
5317
5317
 
@@ -5469,7 +5469,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
5469
5469
 
5470
5470
  <dt class="tag-source">Source:</dt>
5471
5471
  <dd class="tag-source"><ul class="dummy"><li>
5472
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line931">line 931</a>
5472
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line935">line 935</a>
5473
5473
  </li></ul></dd>
5474
5474
 
5475
5475
 
@@ -5627,7 +5627,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
5627
5627
 
5628
5628
  <dt class="tag-source">Source:</dt>
5629
5629
  <dd class="tag-source"><ul class="dummy"><li>
5630
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line995">line 995</a>
5630
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line999">line 999</a>
5631
5631
  </li></ul></dd>
5632
5632
 
5633
5633
 
@@ -5789,7 +5789,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
5789
5789
 
5790
5790
  <dt class="tag-source">Source:</dt>
5791
5791
  <dd class="tag-source"><ul class="dummy"><li>
5792
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line626">line 626</a>
5792
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line629">line 629</a>
5793
5793
  </li></ul></dd>
5794
5794
 
5795
5795
 
@@ -5941,7 +5941,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
5941
5941
 
5942
5942
  <dt class="tag-source">Source:</dt>
5943
5943
  <dd class="tag-source"><ul class="dummy"><li>
5944
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line870">line 870</a>
5944
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line874">line 874</a>
5945
5945
  </li></ul></dd>
5946
5946
 
5947
5947
 
@@ -6123,7 +6123,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
6123
6123
 
6124
6124
  <dt class="tag-source">Source:</dt>
6125
6125
  <dd class="tag-source"><ul class="dummy"><li>
6126
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line892">line 892</a>
6126
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line896">line 896</a>
6127
6127
  </li></ul></dd>
6128
6128
 
6129
6129
 
@@ -6477,7 +6477,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
6477
6477
 
6478
6478
  <dt class="tag-source">Source:</dt>
6479
6479
  <dd class="tag-source"><ul class="dummy"><li>
6480
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1208">line 1208</a>
6480
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1212">line 1212</a>
6481
6481
  </li></ul></dd>
6482
6482
 
6483
6483
 
@@ -7815,7 +7815,7 @@ It also includes completion status and progress percentage for each workout by f
7815
7815
  <br class="clear">
7816
7816
 
7817
7817
  <footer>
7818
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
7818
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
7819
7819
  </footer>
7820
7820
 
7821
7821
  <script>prettyPrint();</script>
@@ -197,15 +197,15 @@ export async function fetchSongsInProgress(brand) {
197
197
  * .then(songs => console.log(songs))
198
198
  * .catch(error => console.error(error));
199
199
  */
200
- export async function fetchContentInProgress(type="all", brand, {
201
- page = 1,
202
- limit = 10,
203
- } = {}) {
200
+ export async function fetchContentInProgress(type="all", brand, { page, limit } = {}) {
204
201
  let url;
202
+ const limitString = limit ? `&amp;limit=${limit}` : '';
203
+ const pageString = page ? `&amp;page=${page}` : '';
204
+
205
205
  if(type === "all") {
206
- url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
206
+ url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}${limitString}${pageString}`;
207
207
  } else {
208
- url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
208
+ url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`;
209
209
  }
210
210
  const headers = {
211
211
  'Content-Type': 'application/json',
@@ -239,15 +239,15 @@ export async function fetchContentInProgress(type="all", brand, {
239
239
  * .then(songs => console.log(songs))
240
240
  * .catch(error => console.error(error));
241
241
  */
242
- export async function fetchCompletedContent(type="all", brand, {
243
- page = 1,
244
- limit = 10,
245
- } = {}) {
242
+ export async function fetchCompletedContent(type="all", brand, { page, limit } = {}) {
246
243
  let url;
244
+ const limitString = limit ? `&amp;limit=${limit}` : '';
245
+ const pageString = page ? `&amp;page=${page}` : '';
246
+
247
247
  if(type === "all") {
248
- url = `/content/completed/${globalConfig.railcontentConfig.userId}?brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
248
+ url = `/content/completed/${globalConfig.railcontentConfig.userId}?brand=${brand}${limitString}${pageString}`;
249
249
  } else {
250
- url = `/content/completed/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
250
+ url = `/content/completed/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`;
251
251
  }
252
252
  const headers = {
253
253
  'Content-Type': 'application/json',
@@ -372,7 +372,7 @@ export async function fetchUnlikeContent(contentId) {
372
372
  <br class="clear">
373
373
 
374
374
  <footer>
375
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
375
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
376
376
  </footer>
377
377
 
378
378
  <script>prettyPrint();</script>
@@ -480,6 +480,7 @@ export async function fetchAll(brand, type, {
480
480
  let config = contentTypeConfig[type] ?? {};
481
481
  let additionalFields = config?.fields ?? [];
482
482
  let isGroupByOneToOne = (groupBy ? config?.relationships?.[groupBy]?.isOneToOne : false) ?? false;
483
+ let webUrlPathType = config?.slug ?? type;
483
484
  const start = (page - 1) * limit;
484
485
  const end = start + limit;
485
486
 
@@ -508,6 +509,7 @@ export async function fetchAll(brand, type, {
508
509
  // Determine the group by clause
509
510
  let query = "";
510
511
  if (groupBy !== "" &amp;&amp; isGroupByOneToOne) {
512
+ let webUrlPath = 'artists';
511
513
  query = `
512
514
  {
513
515
  "total": count(*[_type == '${groupBy}' &amp;&amp; count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0]),
@@ -517,7 +519,7 @@ export async function fetchAll(brand, type, {
517
519
  'type': _type,
518
520
  name,
519
521
  'head_shot_picture_url': thumbnail_url.asset->url,
520
- web_url_path,
522
+ 'web_url_path': '/${brand}/${webUrlPath}/'+name+'?included_fieds[]=type,${type}',
521
523
  'all_lessons_count': count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id),
522
524
  'lessons': *[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
523
525
  ${fieldsString},
@@ -528,6 +530,7 @@ export async function fetchAll(brand, type, {
528
530
  [${start}...${end}]
529
531
  }`;
530
532
  } else if (groupBy !== "") {
533
+ let webUrlPath = (groupBy == 'genre')?'/genres':'';
531
534
  query = `
532
535
  {
533
536
  "total": count(*[_type == '${groupBy}' &amp;&amp; count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0]),
@@ -537,7 +540,7 @@ export async function fetchAll(brand, type, {
537
540
  'type': _type,
538
541
  name,
539
542
  'head_shot_picture_url': thumbnail_url.asset->url,
540
- web_url_path,
543
+ 'web_url_path': select(defined(web_url_path)=> web_url_path +'?included_fieds[]=type,${type}',!defined(web_url_path)=> '/${brand}${webUrlPath}/'+name+'/${webUrlPathType}'),
541
544
  'all_lessons_count': count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id),
542
545
  'lessons': *[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
543
546
  ${fieldsString},
@@ -723,6 +726,7 @@ export async function fetchMethod(brand, slug) {
723
726
  status,
724
727
  title,
725
728
  video,
729
+ length_in_seconds,
726
730
  "type": _type,
727
731
  "levels": child[]->
728
732
  {
@@ -1369,7 +1373,7 @@ function checkSanityConfig(config) {
1369
1373
  <br class="clear">
1370
1374
 
1371
1375
  <footer>
1372
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Sep 18 2024 16:11:26 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1376
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1373
1377
  </footer>
1374
1378
 
1375
1379
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.104",
3
+ "version": "1.0.107",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -54,12 +54,14 @@ let contentTypeConfig = {
54
54
  'artist': {
55
55
  isOneToOne: true
56
56
  }
57
- }
57
+ },
58
+ 'slug':'songs',
58
59
  },
59
60
  'song-tutorial': {
60
61
  'fields': [
61
62
  '"lesson_count": child_count',
62
- ]
63
+ ],
64
+ 'slug':'song-tutorials',
63
65
  },
64
66
  'challenge':{
65
67
  'fields': [
@@ -93,7 +95,8 @@ let contentTypeConfig = {
93
95
  "instructors": instructor[]->name,
94
96
  length_in_seconds,
95
97
  }`,
96
- ]
98
+ ],
99
+ 'slug':'courses',
97
100
  },
98
101
  'method': {
99
102
  'fields': [
@@ -118,7 +121,8 @@ let contentTypeConfig = {
118
121
  'workout': {
119
122
  'fields': [
120
123
  artistOrInstructorNameAsArray(),
121
- ]
124
+ ],
125
+ 'slug':'workouts',
122
126
  },
123
127
  'play-along': {
124
128
  'fields': [
@@ -128,7 +132,8 @@ let contentTypeConfig = {
128
132
  'mp3_no_drums_yes_click_url',
129
133
  'mp3_yes_drums_no_click_url',
130
134
  'bpm',
131
- ]
135
+ ],
136
+ 'slug':'play-alongs',
132
137
  },
133
138
  'pack': {
134
139
  'fields': [
@@ -143,14 +148,16 @@ let contentTypeConfig = {
143
148
  'rudiment': {
144
149
  'fields': [
145
150
  'sheet_music_thumbnail_url',
146
- ]
151
+ ],
152
+ 'slug':'rudiments',
147
153
  },
148
154
  'routine':{
149
155
  'fields': [
150
156
  `"description": ${descriptionField}`,
151
157
  'high_soundslice_slug',
152
158
  'low_soundslice_slug'
153
- ]
159
+ ],
160
+ 'slug':'routines',
154
161
  },
155
162
  'pack-children': {
156
163
  'fields': [
@@ -208,29 +215,30 @@ let contentTypeConfig = {
208
215
  // content with just the added 'instructors' Field
209
216
  'student-focus': contentWithInstructorsField,
210
217
  'quick-tips': contentWithInstructorsField,
211
- 'drum-fest-international-aa2022': contentWithInstructorsField,
218
+ 'drum-fest-international-2022': contentWithInstructorsField,
212
219
  'spotlight': contentWithInstructorsField,
213
220
  'the-history-of-electronic-drums': contentWithInstructorsField,
214
221
  'backstage-secrets': contentWithInstructorsField,
215
222
  'question-and-answer': contentWithInstructorsField,
216
223
  'student-collaborations': contentWithInstructorsField,
217
- 'live': contentWithInstructorsField,
218
- 'solos': contentWithInstructorsField,
224
+ 'live': { ...contentWithInstructorsField, 'slug': 'live-streams' },
225
+ 'solo': { ...contentWithInstructorsField, 'slug': 'solos' },
219
226
  'boot-camps': contentWithInstructorsField,
220
227
  'gear-guids': contentWithInstructorsField,
221
228
  'performances': contentWithInstructorsField,
222
229
  'challenges': contentWithInstructorsField,
223
230
  'on-the-road': contentWithInstructorsField,
224
231
  // content with just the added 'sort' field
225
- 'podcasts': contentWithSortField,
232
+ 'podcast': contentWithSortField,
226
233
  'in-rhythm': contentWithSortField,
227
- 'diy-drum-experiments': contentWithSortField,
234
+ 'diy-drum-experiment': contentWithSortField,
228
235
  'rhythmic-adventures-of-captain-carson': contentWithSortField,
229
236
  'study-the-greats': contentWithSortField,
230
237
  'rhythms-from-another-planet': contentWithSortField,
231
238
  'paiste-cymbals': contentWithInstructorsField,
232
239
  'behind-the-scenes': contentWithSortField,
233
240
  'exploring-beats': contentWithSortField,
241
+ 'sonor': contentWithSortField,
234
242
  }
235
243
 
236
244
  function getNewReleasesTypes(brand) {
@@ -281,7 +289,7 @@ function getFieldsForContentType(contentType, asQueryString=true) {
281
289
  function filtersToGroq(filters) {
282
290
  const groq = filters.map(field => {
283
291
  let [key, value] = field.split(',');
284
- if(key && value){
292
+ if(key && value && field.split(',').length === 2){
285
293
  switch (key) {
286
294
  case 'difficulty':
287
295
  return `&& difficulty_string == "${value}"`;