musora-content-services 1.0.38 → 1.0.40
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 +6 -0
- package/docs/config.js.html +2 -2
- package/docs/index.html +2 -2
- package/docs/module-Config.html +2 -2
- package/docs/module-Railcontent-Services.html +2 -2
- package/docs/module-Sanity-Services.html +26 -30
- package/docs/railcontent.js.html +2 -2
- package/docs/sanity.js.html +156 -118
- package/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/publish.sh +0 -0
- package/src/index.js +0 -2
- package/src/services/sanity.js +115 -115
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.40](https://github.com/railroadmedia/musora-content-services/compare/v1.0.39...v1.0.40) (2024-08-20)
|
|
6
|
+
|
|
7
|
+
### [1.0.39](https://github.com/railroadmedia/musora-content-services/compare/v1.0.37...v1.0.39) (2024-08-20)
|
|
8
|
+
|
|
9
|
+
### [1.0.37](https://github.com/railroadmedia/musora-content-services/compare/v1.0.35...v1.0.37) (2024-08-20)
|
|
10
|
+
|
|
5
11
|
### [1.0.35](https://github.com/railroadmedia/musora-content-services/compare/v1.0.34...v1.0.35) (2024-08-15)
|
|
6
12
|
|
|
7
13
|
### [1.0.34](https://github.com/railroadmedia/musora-content-services/compare/v1.0.32...v1.0.34) (2024-08-15)
|
package/docs/config.js.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -111,7 +111,7 @@ module.exports = {
|
|
|
111
111
|
<br class="clear">
|
|
112
112
|
|
|
113
113
|
<footer>
|
|
114
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
114
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
115
115
|
</footer>
|
|
116
116
|
|
|
117
117
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -110,7 +110,7 @@ Run the following to execute the tests</p>
|
|
|
110
110
|
<br class="clear">
|
|
111
111
|
|
|
112
112
|
<footer>
|
|
113
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
113
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
114
114
|
</footer>
|
|
115
115
|
|
|
116
116
|
<script>prettyPrint();</script>
|
package/docs/module-Config.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -656,7 +656,7 @@ initializeService({
|
|
|
656
656
|
<br class="clear">
|
|
657
657
|
|
|
658
658
|
<footer>
|
|
659
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
659
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
660
660
|
</footer>
|
|
661
661
|
|
|
662
662
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -783,7 +783,7 @@
|
|
|
783
783
|
<br class="clear">
|
|
784
784
|
|
|
785
785
|
<footer>
|
|
786
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
786
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
787
787
|
</footer>
|
|
788
788
|
|
|
789
789
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -2038,7 +2038,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2038
2038
|
|
|
2039
2039
|
|
|
2040
2040
|
|
|
2041
|
-
<h4 class="name" id=".
|
|
2041
|
+
<h4 class="name" id=".fetchCourseOverview"><span class="type-signature type-signature-static">(static) </span>fetchCourseOverview<span class="signature">(id)</span><span class="type-signature"> → {Promise.<(Object|null)>}</span></h4>
|
|
2042
2042
|
|
|
2043
2043
|
|
|
2044
2044
|
|
|
@@ -2048,13 +2048,13 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2048
2048
|
<dl class="details">
|
|
2049
2049
|
|
|
2050
2050
|
<dt class="tag-description">Description:</dt>
|
|
2051
|
-
<dd class="tag-description"><ul class="dummy"><li>Fetch the
|
|
2051
|
+
<dd class="tag-description"><ul class="dummy"><li>Fetch the data needed for the Course Overview screen.</li></ul></dd>
|
|
2052
2052
|
|
|
2053
2053
|
|
|
2054
2054
|
|
|
2055
2055
|
<dt class="tag-source">Source:</dt>
|
|
2056
2056
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2057
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
2057
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line822">line 822</a>
|
|
2058
2058
|
</li></ul></dd>
|
|
2059
2059
|
|
|
2060
2060
|
|
|
@@ -2101,8 +2101,8 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2101
2101
|
|
|
2102
2102
|
<h5 class="h5-examples">Example</h5>
|
|
2103
2103
|
|
|
2104
|
-
<pre class="prettyprint"><code>
|
|
2105
|
-
.then(
|
|
2104
|
+
<pre class="prettyprint"><code>fetchCourseOverview('course123')
|
|
2105
|
+
.then(course => console.log(course))
|
|
2106
2106
|
.catch(error => console.error(error));</code></pre>
|
|
2107
2107
|
|
|
2108
2108
|
|
|
@@ -2133,7 +2133,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2133
2133
|
|
|
2134
2134
|
<tr>
|
|
2135
2135
|
|
|
2136
|
-
<td class="name"><code>
|
|
2136
|
+
<td class="name"><code>id</code></td>
|
|
2137
2137
|
|
|
2138
2138
|
|
|
2139
2139
|
<td class="type">
|
|
@@ -2150,7 +2150,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2150
2150
|
|
|
2151
2151
|
|
|
2152
2152
|
|
|
2153
|
-
<td class="description last">The Railcontent ID of the
|
|
2153
|
+
<td class="description last">The Railcontent ID of the course</td>
|
|
2154
2154
|
</tr>
|
|
2155
2155
|
|
|
2156
2156
|
|
|
@@ -2176,7 +2176,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2176
2176
|
|
|
2177
2177
|
|
|
2178
2178
|
<div class="param-desc">
|
|
2179
|
-
- The
|
|
2179
|
+
- The course information and lessons or null if not found.
|
|
2180
2180
|
</div>
|
|
2181
2181
|
|
|
2182
2182
|
|
|
@@ -2203,7 +2203,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2203
2203
|
|
|
2204
2204
|
|
|
2205
2205
|
|
|
2206
|
-
<h4 class="name" id=".
|
|
2206
|
+
<h4 class="name" id=".fetchLessonContent"><span class="type-signature type-signature-static">(static) </span>fetchLessonContent<span class="signature">(railContentId)</span><span class="type-signature"> → {Promise.<(Object|null)>}</span></h4>
|
|
2207
2207
|
|
|
2208
2208
|
|
|
2209
2209
|
|
|
@@ -2213,17 +2213,13 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2213
2213
|
<dl class="details">
|
|
2214
2214
|
|
|
2215
2215
|
<dt class="tag-description">Description:</dt>
|
|
2216
|
-
<dd class="tag-description"><ul class="dummy"><li>Fetch
|
|
2217
|
-
and are currently ongoing based on their `length_in_seconds`.
|
|
2218
|
-
|
|
2219
|
-
This function retrieves events that have a `published_on` date within the last 48 hours or are currently
|
|
2220
|
-
ongoing based on the event's duration (`length_in_seconds`).</li></ul></dd>
|
|
2216
|
+
<dd class="tag-description"><ul class="dummy"><li>Fetch the page data for a specific lesson by Railcontent ID.</li></ul></dd>
|
|
2221
2217
|
|
|
2222
2218
|
|
|
2223
2219
|
|
|
2224
2220
|
<dt class="tag-source">Source:</dt>
|
|
2225
2221
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2226
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
2222
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line728">line 728</a>
|
|
2227
2223
|
</li></ul></dd>
|
|
2228
2224
|
|
|
2229
2225
|
|
|
@@ -2270,9 +2266,8 @@ ongoing based on the event's duration (`length_in_seconds`).</li></ul></dd>
|
|
|
2270
2266
|
|
|
2271
2267
|
<h5 class="h5-examples">Example</h5>
|
|
2272
2268
|
|
|
2273
|
-
<pre class="prettyprint"><code
|
|
2274
|
-
|
|
2275
|
-
.then(events => console.log(events))
|
|
2269
|
+
<pre class="prettyprint"><code>fetchLessonContent('lesson123')
|
|
2270
|
+
.then(data => console.log(data))
|
|
2276
2271
|
.catch(error => console.error(error));</code></pre>
|
|
2277
2272
|
|
|
2278
2273
|
|
|
@@ -2303,7 +2298,7 @@ fetchLiveEvent('drumeo')
|
|
|
2303
2298
|
|
|
2304
2299
|
<tr>
|
|
2305
2300
|
|
|
2306
|
-
<td class="name"><code>
|
|
2301
|
+
<td class="name"><code>railContentId</code></td>
|
|
2307
2302
|
|
|
2308
2303
|
|
|
2309
2304
|
<td class="type">
|
|
@@ -2320,7 +2315,7 @@ fetchLiveEvent('drumeo')
|
|
|
2320
2315
|
|
|
2321
2316
|
|
|
2322
2317
|
|
|
2323
|
-
<td class="description last">The
|
|
2318
|
+
<td class="description last">The Railcontent ID of the current lesson.</td>
|
|
2324
2319
|
</tr>
|
|
2325
2320
|
|
|
2326
2321
|
|
|
@@ -2346,7 +2341,7 @@ fetchLiveEvent('drumeo')
|
|
|
2346
2341
|
|
|
2347
2342
|
|
|
2348
2343
|
<div class="param-desc">
|
|
2349
|
-
-
|
|
2344
|
+
- The fetched page data or null if found.
|
|
2350
2345
|
</div>
|
|
2351
2346
|
|
|
2352
2347
|
|
|
@@ -2357,7 +2352,7 @@ fetchLiveEvent('drumeo')
|
|
|
2357
2352
|
</dt>
|
|
2358
2353
|
<dd>
|
|
2359
2354
|
|
|
2360
|
-
<span class="param-type">Promise.<(
|
|
2355
|
+
<span class="param-type">Promise.<(Object|null)></span>
|
|
2361
2356
|
|
|
2362
2357
|
|
|
2363
2358
|
|
|
@@ -2705,7 +2700,7 @@ fetchLiveEvent('drumeo')
|
|
|
2705
2700
|
|
|
2706
2701
|
<dt class="tag-source">Source:</dt>
|
|
2707
2702
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2708
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
2703
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line322">line 322</a>
|
|
2709
2704
|
</li></ul></dd>
|
|
2710
2705
|
|
|
2711
2706
|
|
|
@@ -3715,7 +3710,7 @@ fetchLiveEvent('drumeo')
|
|
|
3715
3710
|
|
|
3716
3711
|
<dt class="tag-source">Source:</dt>
|
|
3717
3712
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3718
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3713
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line863">line 863</a>
|
|
3719
3714
|
</li></ul></dd>
|
|
3720
3715
|
|
|
3721
3716
|
|
|
@@ -4710,14 +4705,15 @@ fetchSanity(query, true)
|
|
|
4710
4705
|
<dl class="details">
|
|
4711
4706
|
|
|
4712
4707
|
<dt class="tag-description">Description:</dt>
|
|
4713
|
-
<dd class="tag-description"><ul class="dummy"><li>Fetch the latest workouts for
|
|
4714
|
-
This function retrieves the latest workout content for a given brand,
|
|
4708
|
+
<dd class="tag-description"><ul class="dummy"><li>Fetch the latest workouts for a specific brand, including completion status and progress.
|
|
4709
|
+
This function retrieves up to five of the latest workout content for a given brand, sorted in descending order by their publication date.
|
|
4710
|
+
It also includes completion status and progress percentage for each workout by fetching additional data about user progress.</li></ul></dd>
|
|
4715
4711
|
|
|
4716
4712
|
|
|
4717
4713
|
|
|
4718
4714
|
<dt class="tag-source">Source:</dt>
|
|
4719
4715
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4720
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
4716
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line250">line 250</a>
|
|
4721
4717
|
</li></ul></dd>
|
|
4722
4718
|
|
|
4723
4719
|
|
|
@@ -4839,7 +4835,7 @@ This function retrieves the latest workout content for a given brand, fetching u
|
|
|
4839
4835
|
|
|
4840
4836
|
|
|
4841
4837
|
<div class="param-desc">
|
|
4842
|
-
- A promise that resolves to an array of workout data objects or null if no workouts are found.
|
|
4838
|
+
- A promise that resolves to an array of workout data objects with additional properties for completion status and progress percentage, or null if no workouts are found.
|
|
4843
4839
|
</div>
|
|
4844
4840
|
|
|
4845
4841
|
|
|
@@ -4881,7 +4877,7 @@ This function retrieves the latest workout content for a given brand, fetching u
|
|
|
4881
4877
|
<br class="clear">
|
|
4882
4878
|
|
|
4883
4879
|
<footer>
|
|
4884
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
4880
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
4885
4881
|
</footer>
|
|
4886
4882
|
|
|
4887
4883
|
<script>prettyPrint();</script>
|
package/docs/railcontent.js.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -201,7 +201,7 @@ export async function fetchContentInProgress(type="all", brand) {
|
|
|
201
201
|
<br class="clear">
|
|
202
202
|
|
|
203
203
|
<footer>
|
|
204
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
204
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
205
205
|
</footer>
|
|
206
206
|
|
|
207
207
|
<script>prettyPrint();</script>
|
package/docs/sanity.js.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#~initializeService">initializeService</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCurrentSongComplete">fetchCurrentSongComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllSongs">fetchAllSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodNextLesson">fetchMethodNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -281,33 +281,86 @@ export async function fetchSongCount(brand) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
* Fetch the latest workouts for
|
|
285
|
-
* This function retrieves the latest workout content for a given brand,
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
|
|
284
|
+
* Fetch the latest workouts for a specific brand, including completion status and progress.
|
|
285
|
+
* This function retrieves up to five of the latest workout content for a given brand, sorted in descending order by their publication date.
|
|
286
|
+
* It also includes completion status and progress percentage for each workout by fetching additional data about user progress.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
|
|
289
|
+
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of workout data objects with additional properties for completion status and progress percentage, or null if no workouts are found.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* fetchWorkouts('drumeo')
|
|
293
|
+
* .then(workouts => console.log(workouts))
|
|
294
|
+
* .catch(error => console.error(error));
|
|
295
|
+
*/
|
|
296
|
+
|
|
294
297
|
export async function fetchWorkouts(brand) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
298
|
+
const query = `*[_type == 'workout' && brand == '${brand}'] [0...5] {
|
|
299
|
+
"id": railcontent_id,
|
|
300
|
+
title,
|
|
301
|
+
"image": thumbnail.asset->url,
|
|
302
|
+
"artist_name": instructor[0]->name,
|
|
303
|
+
"artists": instructor[]->name,
|
|
304
|
+
difficulty,
|
|
305
|
+
difficulty_string,
|
|
306
|
+
length_in_seconds,
|
|
307
|
+
published_on,
|
|
308
|
+
"type": _type,
|
|
309
|
+
web_url_path,
|
|
310
|
+
} | order(published_on desc)[0...5]`;
|
|
311
|
+
|
|
312
|
+
try {
|
|
313
|
+
// Fetch the workouts
|
|
314
|
+
const workouts = await fetchSanity(query, true);
|
|
315
|
+
|
|
316
|
+
if (!workouts || workouts.length === 0) {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Extract content IDs
|
|
321
|
+
const contentIds = workouts.map(workout => workout.id);
|
|
322
|
+
|
|
323
|
+
// Fetch completion states using the existing function
|
|
324
|
+
const completedStatesObject = await fetchAllCompletedStates(contentIds);
|
|
325
|
+
|
|
326
|
+
// Check if completedStatesObject is an object and convert to array if necessary
|
|
327
|
+
if (typeof completedStatesObject !== 'object' || completedStatesObject === null) {
|
|
328
|
+
console.error('Completed states are not an object:', completedStatesObject);
|
|
329
|
+
return workouts;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Convert object to array and create a map for fast lookup
|
|
333
|
+
const completedStatesArray = Object.entries(completedStatesObject).map(([content_id, state]) => ({
|
|
334
|
+
content_id: parseInt(content_id, 10), // Convert key to integer if necessary
|
|
335
|
+
...state
|
|
336
|
+
}));
|
|
337
|
+
|
|
338
|
+
const completedStatesMap = completedStatesArray.reduce((map, state) => {
|
|
339
|
+
map[state.content_id] = state;
|
|
340
|
+
return map;
|
|
341
|
+
}, {});
|
|
342
|
+
|
|
343
|
+
// Add completion status and progress percentage to each workout
|
|
344
|
+
return workouts.map(workout => {
|
|
345
|
+
const state = completedStatesMap[workout.id];
|
|
346
|
+
if (state) {
|
|
347
|
+
workout.completed = state.state !== "not started";
|
|
348
|
+
workout.progress_percent = state.percent.toString();
|
|
349
|
+
} else {
|
|
350
|
+
workout.completed = false;
|
|
351
|
+
workout.progress_percent = "0";
|
|
352
|
+
}
|
|
353
|
+
//console.log(workout)
|
|
354
|
+
return workout;
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
} catch (error) {
|
|
358
|
+
console.error('Error fetching workouts with completion:', error);
|
|
359
|
+
return [];
|
|
360
|
+
}
|
|
309
361
|
}
|
|
310
362
|
|
|
363
|
+
|
|
311
364
|
/**
|
|
312
365
|
* Fetch the latest new releases for a specific brand.
|
|
313
366
|
* @param {string} brand - The brand for which to fetch new releases.
|
|
@@ -339,59 +392,6 @@ export async function fetchNewReleases(brand) {
|
|
|
339
392
|
}
|
|
340
393
|
|
|
341
394
|
|
|
342
|
-
/**
|
|
343
|
-
* Fetch upcoming events for a specific brand that are within 48 hours before their `published_on` date
|
|
344
|
-
* and are currently ongoing based on their `length_in_seconds`.
|
|
345
|
-
*
|
|
346
|
-
* This function retrieves events that have a `published_on` date within the last 48 hours or are currently
|
|
347
|
-
* ongoing based on the event's duration (`length_in_seconds`).
|
|
348
|
-
*
|
|
349
|
-
* @param {string} brand - The brand for which to fetch upcoming events (e.g., 'drumeo', 'pianote', etc.).
|
|
350
|
-
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of event objects or null if no events are found.
|
|
351
|
-
*
|
|
352
|
-
* @example
|
|
353
|
-
* // Example usage:
|
|
354
|
-
* fetchLiveEvent('drumeo')
|
|
355
|
-
* .then(events => console.log(events))
|
|
356
|
-
* .catch(error => console.error(error));
|
|
357
|
-
*
|
|
358
|
-
*/
|
|
359
|
-
export async function fetchLiveEvent(brand) {
|
|
360
|
-
const baseLiveTypes = ["student-review", "student-reviews", "student-focus", "coach-stream", "live", "question-and-answer", "student-review", "boot-camps", "recording", "pack-bundle-lesson"];
|
|
361
|
-
const liveTypes = {
|
|
362
|
-
'drumeo': [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "quick-tips", "student-collaborations", "live-streams", "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-drums"],
|
|
363
|
-
'pianote': baseLiveTypes,
|
|
364
|
-
'guitareo': [...baseLiveTypes, "archives"],
|
|
365
|
-
'singeo': baseLiveTypes,
|
|
366
|
-
'default': baseLiveTypes
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
const typesString = arrayJoinWithQuotes(liveTypes[brand] ?? liveTypes['default']);
|
|
370
|
-
const now = getSanityDate(new Date());
|
|
371
|
-
const twoDaysAgo = getSanityDate(new Date(Date.now() - 48 * 60 * 60 * 1000)); // 48 hours ago
|
|
372
|
-
|
|
373
|
-
// Adjust the query to filter events based on the calculated time window
|
|
374
|
-
const query = `
|
|
375
|
-
*[_type in [${typesString}] && brand == '${brand}'
|
|
376
|
-
&& published_on > '${twoDaysAgo}'
|
|
377
|
-
|| (published_on <= '${now}' && dateTime(published_on) + length_in_seconds * 1000 > '${now}')
|
|
378
|
-
] {
|
|
379
|
-
"id": railcontent_id,
|
|
380
|
-
title,
|
|
381
|
-
"image": thumbnail.asset->url,
|
|
382
|
-
"artist_name": instructor[0]->name,
|
|
383
|
-
"artists": instructor[]->name,
|
|
384
|
-
difficulty,
|
|
385
|
-
difficulty_string,
|
|
386
|
-
length_in_seconds,
|
|
387
|
-
published_on,
|
|
388
|
-
"type": _type,
|
|
389
|
-
web_url_path,
|
|
390
|
-
} | order(published_on asc)[0]`;
|
|
391
|
-
|
|
392
|
-
return fetchSanity(query, true);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
395
|
/**
|
|
396
396
|
* Fetch upcoming events for a specific brand.
|
|
397
397
|
*
|
|
@@ -519,48 +519,48 @@ export async function fetchAll(brand, type, {
|
|
|
519
519
|
} = {}) {
|
|
520
520
|
let config = contentTypeConfig[type] ?? {};
|
|
521
521
|
let additionalFields = config?.fields ?? [];
|
|
522
|
-
let isGroupByOneToOne = (groupBy ? config?.relationships[groupBy]?.isOneToOne : false) ?? false;
|
|
522
|
+
let isGroupByOneToOne = (groupBy ? config?.relationships?.[groupBy]?.isOneToOne : false) ?? false;
|
|
523
523
|
const start = (page - 1) * limit;
|
|
524
524
|
const end = start + limit;
|
|
525
525
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
526
|
+
// Construct the search filter
|
|
527
|
+
const searchFilter = searchTerm
|
|
528
|
+
? `&& (artist->name match "${searchTerm}*" || title match "${searchTerm}*")`
|
|
529
|
+
: "";
|
|
530
|
+
|
|
531
|
+
// Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
|
|
532
|
+
const includedFieldsFilter = includedFields.length > 0
|
|
533
|
+
? includedFields.map(field => {
|
|
534
|
+
let [key, value] = field.split(',');
|
|
535
|
+
if (key === 'difficulty') {
|
|
536
|
+
key = 'difficulty_string';
|
|
537
|
+
}
|
|
538
|
+
return `&& ${key} == "${value}"`;
|
|
539
|
+
}).join(' ')
|
|
540
|
+
: "";
|
|
541
|
+
|
|
542
|
+
// Determine the sort order
|
|
543
|
+
let sortOrder;
|
|
544
|
+
switch (sort) {
|
|
545
|
+
case "slug":
|
|
546
|
+
sortOrder = "artist->name asc";
|
|
547
|
+
break;
|
|
548
|
+
case "published_on":
|
|
549
|
+
sortOrder = "published_on asc";
|
|
550
|
+
break;
|
|
551
|
+
case "-published_on":
|
|
552
|
+
sortOrder = "published_on desc";
|
|
553
|
+
break;
|
|
554
|
+
case "-slug":
|
|
555
|
+
sortOrder = "artist->name desc";
|
|
556
|
+
break;
|
|
557
|
+
case "-popularity":
|
|
558
|
+
sortOrder = "popularity desc";
|
|
559
|
+
break;
|
|
560
|
+
default:
|
|
561
|
+
sortOrder = "published_on asc";
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
564
|
|
|
565
565
|
let defaultFields = [
|
|
566
566
|
'"id": railcontent_id',
|
|
@@ -856,6 +856,44 @@ export async function fetchPackChildren(railcontentId) {
|
|
|
856
856
|
return fetchChildren(railcontentId, 'pack');
|
|
857
857
|
}
|
|
858
858
|
|
|
859
|
+
/**
|
|
860
|
+
* Fetch the data needed for the Course Overview screen.
|
|
861
|
+
* @param {string} id - The Railcontent ID of the course
|
|
862
|
+
* @returns {Promise<Object|null>} - The course information and lessons or null if not found.
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* fetchCourseOverview('course123')
|
|
866
|
+
* .then(course => console.log(course))
|
|
867
|
+
* .catch(error => console.error(error));
|
|
868
|
+
*/
|
|
869
|
+
export async function fetchCourseOverview(id) {
|
|
870
|
+
// WIP
|
|
871
|
+
const query = `*[railcontent_id == ${id}]{
|
|
872
|
+
"id": railcontent_id,
|
|
873
|
+
railcontent_id,
|
|
874
|
+
title,
|
|
875
|
+
"image": thumbnail.asset->url,
|
|
876
|
+
"instructors": instructor[]->name,
|
|
877
|
+
difficulty,
|
|
878
|
+
difficulty_string,
|
|
879
|
+
web_url_path,
|
|
880
|
+
published_on,
|
|
881
|
+
"type": _type,
|
|
882
|
+
total_xp,
|
|
883
|
+
xp,
|
|
884
|
+
description,
|
|
885
|
+
resource,
|
|
886
|
+
"lessons": child[]->{
|
|
887
|
+
"id": railcontent_id,
|
|
888
|
+
title,
|
|
889
|
+
"image": thumbnail.asset->url,
|
|
890
|
+
"instructors": instructor[]->name,
|
|
891
|
+
length_in_seconds,
|
|
892
|
+
}
|
|
893
|
+
}`
|
|
894
|
+
return fetchSanity(query, false);
|
|
895
|
+
}
|
|
896
|
+
|
|
859
897
|
/**
|
|
860
898
|
* Fetch data from the Sanity API based on a provided query.
|
|
861
899
|
*
|
|
@@ -951,7 +989,7 @@ function checkSanityConfig(config) {
|
|
|
951
989
|
<br class="clear">
|
|
952
990
|
|
|
953
991
|
<footer>
|
|
954
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
992
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 20 2024 14:36:28 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
955
993
|
</footer>
|
|
956
994
|
|
|
957
995
|
<script>prettyPrint();</script>
|
package/link_mcs.sh
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
File without changes
|
package/src/index.js
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
fetchSongCount,
|
|
11
11
|
fetchWorkouts,
|
|
12
12
|
fetchNewReleases,
|
|
13
|
-
fetchLiveEvent,
|
|
14
13
|
fetchUpcomingEvents,
|
|
15
14
|
fetchByRailContentId,
|
|
16
15
|
fetchByRailContentIds,
|
|
@@ -44,7 +43,6 @@ export {
|
|
|
44
43
|
fetchSongCount,
|
|
45
44
|
fetchWorkouts,
|
|
46
45
|
fetchNewReleases,
|
|
47
|
-
fetchLiveEvent,
|
|
48
46
|
fetchUpcomingEvents,
|
|
49
47
|
fetchByRailContentId,
|
|
50
48
|
fetchByRailContentIds,
|
package/src/services/sanity.js
CHANGED
|
@@ -234,33 +234,86 @@ export async function fetchSongCount(brand) {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* Fetch the latest workouts for
|
|
238
|
-
* This function retrieves the latest workout content for a given brand,
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* @
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
|
|
237
|
+
* Fetch the latest workouts for a specific brand, including completion status and progress.
|
|
238
|
+
* This function retrieves up to five of the latest workout content for a given brand, sorted in descending order by their publication date.
|
|
239
|
+
* It also includes completion status and progress percentage for each workout by fetching additional data about user progress.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
|
|
242
|
+
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of workout data objects with additional properties for completion status and progress percentage, or null if no workouts are found.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* fetchWorkouts('drumeo')
|
|
246
|
+
* .then(workouts => console.log(workouts))
|
|
247
|
+
* .catch(error => console.error(error));
|
|
248
|
+
*/
|
|
249
|
+
|
|
247
250
|
export async function fetchWorkouts(brand) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
const query = `*[_type == 'workout' && brand == '${brand}'] [0...5] {
|
|
252
|
+
"id": railcontent_id,
|
|
253
|
+
title,
|
|
254
|
+
"image": thumbnail.asset->url,
|
|
255
|
+
"artist_name": instructor[0]->name,
|
|
256
|
+
"artists": instructor[]->name,
|
|
257
|
+
difficulty,
|
|
258
|
+
difficulty_string,
|
|
259
|
+
length_in_seconds,
|
|
260
|
+
published_on,
|
|
261
|
+
"type": _type,
|
|
262
|
+
web_url_path,
|
|
263
|
+
} | order(published_on desc)[0...5]`;
|
|
264
|
+
|
|
265
|
+
try {
|
|
266
|
+
// Fetch the workouts
|
|
267
|
+
const workouts = await fetchSanity(query, true);
|
|
268
|
+
|
|
269
|
+
if (!workouts || workouts.length === 0) {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Extract content IDs
|
|
274
|
+
const contentIds = workouts.map(workout => workout.id);
|
|
275
|
+
|
|
276
|
+
// Fetch completion states using the existing function
|
|
277
|
+
const completedStatesObject = await fetchAllCompletedStates(contentIds);
|
|
278
|
+
|
|
279
|
+
// Check if completedStatesObject is an object and convert to array if necessary
|
|
280
|
+
if (typeof completedStatesObject !== 'object' || completedStatesObject === null) {
|
|
281
|
+
console.error('Completed states are not an object:', completedStatesObject);
|
|
282
|
+
return workouts;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Convert object to array and create a map for fast lookup
|
|
286
|
+
const completedStatesArray = Object.entries(completedStatesObject).map(([content_id, state]) => ({
|
|
287
|
+
content_id: parseInt(content_id, 10), // Convert key to integer if necessary
|
|
288
|
+
...state
|
|
289
|
+
}));
|
|
290
|
+
|
|
291
|
+
const completedStatesMap = completedStatesArray.reduce((map, state) => {
|
|
292
|
+
map[state.content_id] = state;
|
|
293
|
+
return map;
|
|
294
|
+
}, {});
|
|
295
|
+
|
|
296
|
+
// Add completion status and progress percentage to each workout
|
|
297
|
+
return workouts.map(workout => {
|
|
298
|
+
const state = completedStatesMap[workout.id];
|
|
299
|
+
if (state) {
|
|
300
|
+
workout.completed = state.state !== "not started";
|
|
301
|
+
workout.progress_percent = state.percent.toString();
|
|
302
|
+
} else {
|
|
303
|
+
workout.completed = false;
|
|
304
|
+
workout.progress_percent = "0";
|
|
305
|
+
}
|
|
306
|
+
//console.log(workout)
|
|
307
|
+
return workout;
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
} catch (error) {
|
|
311
|
+
console.error('Error fetching workouts with completion:', error);
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
262
314
|
}
|
|
263
315
|
|
|
316
|
+
|
|
264
317
|
/**
|
|
265
318
|
* Fetch the latest new releases for a specific brand.
|
|
266
319
|
* @param {string} brand - The brand for which to fetch new releases.
|
|
@@ -292,59 +345,6 @@ export async function fetchNewReleases(brand) {
|
|
|
292
345
|
}
|
|
293
346
|
|
|
294
347
|
|
|
295
|
-
/**
|
|
296
|
-
* Fetch upcoming events for a specific brand that are within 48 hours before their `published_on` date
|
|
297
|
-
* and are currently ongoing based on their `length_in_seconds`.
|
|
298
|
-
*
|
|
299
|
-
* This function retrieves events that have a `published_on` date within the last 48 hours or are currently
|
|
300
|
-
* ongoing based on the event's duration (`length_in_seconds`).
|
|
301
|
-
*
|
|
302
|
-
* @param {string} brand - The brand for which to fetch upcoming events (e.g., 'drumeo', 'pianote', etc.).
|
|
303
|
-
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of event objects or null if no events are found.
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* // Example usage:
|
|
307
|
-
* fetchLiveEvent('drumeo')
|
|
308
|
-
* .then(events => console.log(events))
|
|
309
|
-
* .catch(error => console.error(error));
|
|
310
|
-
*
|
|
311
|
-
*/
|
|
312
|
-
export async function fetchLiveEvent(brand) {
|
|
313
|
-
const baseLiveTypes = ["student-review", "student-reviews", "student-focus", "coach-stream", "live", "question-and-answer", "student-review", "boot-camps", "recording", "pack-bundle-lesson"];
|
|
314
|
-
const liveTypes = {
|
|
315
|
-
'drumeo': [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "quick-tips", "student-collaborations", "live-streams", "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-drums"],
|
|
316
|
-
'pianote': baseLiveTypes,
|
|
317
|
-
'guitareo': [...baseLiveTypes, "archives"],
|
|
318
|
-
'singeo': baseLiveTypes,
|
|
319
|
-
'default': baseLiveTypes
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
const typesString = arrayJoinWithQuotes(liveTypes[brand] ?? liveTypes['default']);
|
|
323
|
-
const now = getSanityDate(new Date());
|
|
324
|
-
const twoDaysAgo = getSanityDate(new Date(Date.now() - 48 * 60 * 60 * 1000)); // 48 hours ago
|
|
325
|
-
|
|
326
|
-
// Adjust the query to filter events based on the calculated time window
|
|
327
|
-
const query = `
|
|
328
|
-
*[_type in [${typesString}] && brand == '${brand}'
|
|
329
|
-
&& published_on > '${twoDaysAgo}'
|
|
330
|
-
|| (published_on <= '${now}' && dateTime(published_on) + length_in_seconds * 1000 > '${now}')
|
|
331
|
-
] {
|
|
332
|
-
"id": railcontent_id,
|
|
333
|
-
title,
|
|
334
|
-
"image": thumbnail.asset->url,
|
|
335
|
-
"artist_name": instructor[0]->name,
|
|
336
|
-
"artists": instructor[]->name,
|
|
337
|
-
difficulty,
|
|
338
|
-
difficulty_string,
|
|
339
|
-
length_in_seconds,
|
|
340
|
-
published_on,
|
|
341
|
-
"type": _type,
|
|
342
|
-
web_url_path,
|
|
343
|
-
} | order(published_on asc)[0]`;
|
|
344
|
-
|
|
345
|
-
return fetchSanity(query, true);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
348
|
/**
|
|
349
349
|
* Fetch upcoming events for a specific brand.
|
|
350
350
|
*
|
|
@@ -476,44 +476,44 @@ export async function fetchAll(brand, type, {
|
|
|
476
476
|
const start = (page - 1) * limit;
|
|
477
477
|
const end = start + limit;
|
|
478
478
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
479
|
+
// Construct the search filter
|
|
480
|
+
const searchFilter = searchTerm
|
|
481
|
+
? `&& (artist->name match "${searchTerm}*" || title match "${searchTerm}*")`
|
|
482
|
+
: "";
|
|
483
|
+
|
|
484
|
+
// Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
|
|
485
|
+
const includedFieldsFilter = includedFields.length > 0
|
|
486
|
+
? includedFields.map(field => {
|
|
487
|
+
let [key, value] = field.split(',');
|
|
488
|
+
if (key === 'difficulty') {
|
|
489
|
+
key = 'difficulty_string';
|
|
490
|
+
}
|
|
491
|
+
return `&& ${key} == "${value}"`;
|
|
492
|
+
}).join(' ')
|
|
493
|
+
: "";
|
|
494
|
+
|
|
495
|
+
// Determine the sort order
|
|
496
|
+
let sortOrder;
|
|
497
|
+
switch (sort) {
|
|
498
|
+
case "slug":
|
|
499
|
+
sortOrder = "artist->name asc";
|
|
500
|
+
break;
|
|
501
|
+
case "published_on":
|
|
502
|
+
sortOrder = "published_on asc";
|
|
503
|
+
break;
|
|
504
|
+
case "-published_on":
|
|
505
|
+
sortOrder = "published_on desc";
|
|
506
|
+
break;
|
|
507
|
+
case "-slug":
|
|
508
|
+
sortOrder = "artist->name desc";
|
|
509
|
+
break;
|
|
510
|
+
case "-popularity":
|
|
511
|
+
sortOrder = "popularity desc";
|
|
512
|
+
break;
|
|
513
|
+
default:
|
|
514
|
+
sortOrder = "published_on asc";
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
517
|
|
|
518
518
|
let defaultFields = [
|
|
519
519
|
'"id": railcontent_id',
|