musora-content-services 1.0.137 → 1.0.138
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 +2 -0
- package/docs/config.js.html +10 -3
- package/docs/index.html +8 -2
- package/docs/module-Config.html +85 -3
- package/docs/module-Railcontent-Services.html +90 -173
- package/docs/module-Sanity-Services.html +960 -72
- package/docs/railcontent.js.html +44 -42
- package/docs/sanity.js.html +99 -54
- package/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +11 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/services/sanity.js +26 -1
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#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</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#.fetchContentPageUserData">fetchContentPageUserData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li
|
|
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#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</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#.fetchContentPageUserData">fetchContentPageUserData</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#.fetchAllPacks">fetchAllPacks</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#.fetchArtistLessons">fetchArtistLessons</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#.fetchByReference">fetchByReference</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCatalogMetadata">fetchCatalogMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChallengeOverview">fetchChallengeOverview</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#.fetchCoachLessons">fetchCoachLessons</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#.fetchFoundation">fetchFoundation</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchGenreLessons">fetchGenreLessons</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#.fetchMetadata">fetchMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethod">fetchMethod</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#.fetchMethodChildrenIds">fetchMethodChildrenIds</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#.fetchMethodPreviousNextLesson">fetchMethodPreviousNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethods">fetchMethods</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#.fetchPackData">fetchPackData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchParentByRailContentId">fetchParentByRailContentId</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#.fetchRelatedMethodLessons">fetchRelatedMethodLessons</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#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</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
|
|
|
@@ -51,6 +51,13 @@
|
|
|
51
51
|
|
|
52
52
|
const {globalConfig} = require('./config');
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Exported functions that are excluded from index generation.
|
|
56
|
+
*
|
|
57
|
+
* @type {string[]}
|
|
58
|
+
*/
|
|
59
|
+
const excludeFromGeneratedIndex = ['fetchUserLikes', 'postContentLiked', 'postContentUnliked'];
|
|
60
|
+
|
|
54
61
|
|
|
55
62
|
/**
|
|
56
63
|
* Fetches the completion status of a specific lesson for the current user.
|
|
@@ -85,40 +92,6 @@ export async function fetchCompletedState(content_id) {
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
/**
|
|
89
|
-
* Fetches the vimeo meta-data
|
|
90
|
-
*
|
|
91
|
-
* @param {string} vimeo_id - The vimeo id, found in the <document>.video.external_id field for lessons
|
|
92
|
-
* @returns {Promise<Object|null>} - Returns the
|
|
93
|
-
* @example
|
|
94
|
-
* fetchVimeoData('642900215')
|
|
95
|
-
* .then(vimeoData => console.log(vimeoData))
|
|
96
|
-
* .catch(error => console.error(error));
|
|
97
|
-
*/
|
|
98
|
-
export async function fetchVimeoData(vimeo_id) {
|
|
99
|
-
const url = `/content/vimeo-data/${vimeo_id}`;
|
|
100
|
-
|
|
101
|
-
const headers = {
|
|
102
|
-
'Content-Type': 'application/json',
|
|
103
|
-
'X-CSRF-TOKEN': globalConfig.railcontentConfig.token
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const response = await fetchAbsolute(url, {headers});
|
|
108
|
-
const result = await response.json();
|
|
109
|
-
|
|
110
|
-
if (result) {
|
|
111
|
-
return result; // Return the correct object
|
|
112
|
-
} else {
|
|
113
|
-
console.log('Invalid result structure', result);
|
|
114
|
-
return null; // Handle unexpected structure
|
|
115
|
-
}
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error('Fetch error:', error);
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
95
|
|
|
123
96
|
/**
|
|
124
97
|
* Fetches the completion status for multiple songs for the current user.
|
|
@@ -303,13 +276,7 @@ export async function fetchContentPageUserData(contentId) {
|
|
|
303
276
|
}
|
|
304
277
|
|
|
305
278
|
export async function fetchUserPermissions() {
|
|
306
|
-
//TODO: Should be investigate why throw 500 errors on MA
|
|
307
|
-
return [];
|
|
308
279
|
let url = `/content/user_data_permissions`;
|
|
309
|
-
const headers = {
|
|
310
|
-
'Content-Type': 'application/json',
|
|
311
|
-
'X-CSRF-TOKEN': globalConfig.railcontentConfig.token
|
|
312
|
-
};
|
|
313
280
|
// in the case of an unauthorized user, we return empty permissions
|
|
314
281
|
return fetchHandler(url, 'get') ?? [];
|
|
315
282
|
}
|
|
@@ -353,6 +320,41 @@ export async function postContentUnliked(contentId) {
|
|
|
353
320
|
return await fetchHandler(url, "post");
|
|
354
321
|
}
|
|
355
322
|
|
|
323
|
+
export async function fetchChallengeMetadata(contentId) {
|
|
324
|
+
let url = `/challenges/${contentId}`;
|
|
325
|
+
return await fetchHandler(url, 'get');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export async function fetchUserChallengeProgress(contentId) {
|
|
329
|
+
let url = `/challenges/user_data/${contentId}`;
|
|
330
|
+
return await fetchHandler(url, 'get');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export async function fetchUserAward(contentId) {
|
|
334
|
+
let url = `/challenges/download_award/${contentId}`;
|
|
335
|
+
return await fetchHandler(url, 'get');
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export async function postChallengesSetStartDate(contentId, startDate) {
|
|
339
|
+
let url = `/challenges/set_start_date/${contentId}?start_date=${startDate}`;
|
|
340
|
+
return await fetchHandler(url, 'post');
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export async function postChallengesUnlock(contentId) {
|
|
344
|
+
let url = `/challenges/unlock/${contentId}`;
|
|
345
|
+
return await fetchHandler(url, 'post');
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export async function postChallengesEnroll(contentId) {
|
|
349
|
+
let url = `/challenges/enroll/${contentId}`;
|
|
350
|
+
return await fetchHandler(url, 'post');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export async function postChallengesLeave(contentId) {
|
|
354
|
+
let url = `/challenges/leave/${contentId}`;
|
|
355
|
+
return await fetchHandler(url, 'post');
|
|
356
|
+
}
|
|
357
|
+
|
|
356
358
|
function fetchAbsolute(url, params) {
|
|
357
359
|
if (globalConfig.railcontentConfig.baseUrl) {
|
|
358
360
|
if (url.startsWith('/')) {
|
|
@@ -374,7 +376,7 @@ function fetchAbsolute(url, params) {
|
|
|
374
376
|
<br class="clear">
|
|
375
377
|
|
|
376
378
|
<footer>
|
|
377
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
379
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Oct 15 2024 11:28:17 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
378
380
|
</footer>
|
|
379
381
|
|
|
380
382
|
<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#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</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#.fetchContentPageUserData">fetchContentPageUserData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li
|
|
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#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</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#.fetchContentPageUserData">fetchContentPageUserData</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#.fetchAllPacks">fetchAllPacks</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#.fetchArtistLessons">fetchArtistLessons</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#.fetchByReference">fetchByReference</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCatalogMetadata">fetchCatalogMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChallengeOverview">fetchChallengeOverview</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#.fetchCoachLessons">fetchCoachLessons</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#.fetchFoundation">fetchFoundation</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchGenreLessons">fetchGenreLessons</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#.fetchMetadata">fetchMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethod">fetchMethod</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#.fetchMethodChildrenIds">fetchMethodChildrenIds</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#.fetchMethodPreviousNextLesson">fetchMethodPreviousNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethods">fetchMethods</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#.fetchPackData">fetchPackData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchParentByRailContentId">fetchParentByRailContentId</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#.fetchRelatedMethodLessons">fetchRelatedMethodLessons</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#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</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
|
|
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
|
|
66
66
|
import {
|
|
67
67
|
processMetadata,
|
|
68
|
+
typeWithSortOrder
|
|
68
69
|
} from "../contentMetaData";
|
|
69
70
|
|
|
70
71
|
import {globalConfig} from "./config";
|
|
@@ -72,6 +73,12 @@ import {globalConfig} from "./config";
|
|
|
72
73
|
import { fetchUserPermissions, fetchAllCompletedStates, fetchCurrentSongComplete } from './railcontent.js';
|
|
73
74
|
import {arrayToStringRepresentation, FilterBuilder} from "../filterBuilder";
|
|
74
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Exported functions that are excluded from index generation.
|
|
78
|
+
*
|
|
79
|
+
* @type {string[]}
|
|
80
|
+
*/
|
|
81
|
+
const excludeFromGeneratedIndex = [];
|
|
75
82
|
/**
|
|
76
83
|
* Fetch a song by its document ID from Sanity.
|
|
77
84
|
*
|
|
@@ -114,7 +121,7 @@ export async function fetchArtists(brand) {
|
|
|
114
121
|
name,
|
|
115
122
|
"lessonsCount": count(*[${filter}])
|
|
116
123
|
}[lessonsCount > 0]`;
|
|
117
|
-
return fetchSanity(query, true);
|
|
124
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
/**
|
|
@@ -124,7 +131,7 @@ export async function fetchArtists(brand) {
|
|
|
124
131
|
*/
|
|
125
132
|
export async function fetchSongArtistCount(brand) {
|
|
126
133
|
const query = `count(*[_type == 'artist']{'lessonsCount': count(*[_type == 'song' && brand == '${brand}' && references(^._id)]._id)}[lessonsCount > 0])`;
|
|
127
|
-
return fetchSanity(query, true);
|
|
134
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
128
135
|
}
|
|
129
136
|
|
|
130
137
|
/**
|
|
@@ -281,7 +288,7 @@ export async function fetchSongFilterOptions(brand) {
|
|
|
281
288
|
*/
|
|
282
289
|
export async function fetchSongCount(brand) {
|
|
283
290
|
const query = `count(*[_type == 'song' && brand == "${brand}"])`;
|
|
284
|
-
return fetchSanity(query, true);
|
|
291
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
285
292
|
}
|
|
286
293
|
|
|
287
294
|
/**
|
|
@@ -290,7 +297,8 @@ export async function fetchSongCount(brand) {
|
|
|
290
297
|
* It also includes completion status and progress percentage for each workout by fetching additional data about user progress.
|
|
291
298
|
*
|
|
292
299
|
* @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
|
|
293
|
-
* @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,
|
|
300
|
+
* @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,
|
|
301
|
+
* or null if no workouts are found.
|
|
294
302
|
*
|
|
295
303
|
* @example
|
|
296
304
|
* fetchWorkouts('drumeo')
|
|
@@ -328,7 +336,9 @@ export async function fetchNewReleases(brand, { page = 1, limit = 20, sort="-pub
|
|
|
328
336
|
length_in_seconds,
|
|
329
337
|
published_on,
|
|
330
338
|
"type": _type,
|
|
331
|
-
web_url_path
|
|
339
|
+
web_url_path,
|
|
340
|
+
"permission_id": permission[]->railcontent_id,
|
|
341
|
+
`;
|
|
332
342
|
const filterParams = {};
|
|
333
343
|
const query = buildQuery(
|
|
334
344
|
filter,
|
|
@@ -336,6 +346,7 @@ export async function fetchNewReleases(brand, { page = 1, limit = 20, sort="-pub
|
|
|
336
346
|
fields,
|
|
337
347
|
{
|
|
338
348
|
sortOrder: sortOrder,
|
|
349
|
+
start,
|
|
339
350
|
end: end,
|
|
340
351
|
});
|
|
341
352
|
return fetchSanity(query, true);
|
|
@@ -373,7 +384,8 @@ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {})
|
|
|
373
384
|
length_in_seconds,
|
|
374
385
|
published_on,
|
|
375
386
|
"type": _type,
|
|
376
|
-
web_url_path
|
|
387
|
+
web_url_path,
|
|
388
|
+
"permission_id": permission[]->railcontent_id,`;
|
|
377
389
|
const query = buildRawQuery(
|
|
378
390
|
`_type in ${typesString} && brand == '${brand}' && published_on > '${now}' && status == 'scheduled'`,
|
|
379
391
|
fields,
|
|
@@ -421,6 +433,7 @@ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
|
|
|
421
433
|
published_on,
|
|
422
434
|
"type": _type,
|
|
423
435
|
web_url_path,
|
|
436
|
+
"permission_id": permission[]->railcontent_id,
|
|
424
437
|
} | order(published_on asc)[${start}...${end}]`;
|
|
425
438
|
return fetchSanity(query, true);
|
|
426
439
|
}
|
|
@@ -553,7 +566,7 @@ export async function fetchAll(brand, type, {
|
|
|
553
566
|
const webUrlPath = 'artists';
|
|
554
567
|
const lessonsFilter = `_type == '${type}' && brand == '${brand}' && ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
555
568
|
entityFieldsString = `
|
|
556
|
-
'id':
|
|
569
|
+
'id': railcontent_id,
|
|
557
570
|
'type': _type,
|
|
558
571
|
name,
|
|
559
572
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
@@ -569,7 +582,7 @@ export async function fetchAll(brand, type, {
|
|
|
569
582
|
const webUrlPath = (groupBy == 'genre')?'/genres':'';
|
|
570
583
|
const lessonsFilter = `brand == '${brand}' && ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
571
584
|
entityFieldsString = `
|
|
572
|
-
'id':
|
|
585
|
+
'id': railcontent_id,
|
|
573
586
|
'type': _type,
|
|
574
587
|
name,
|
|
575
588
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
@@ -660,6 +673,7 @@ export async function fetchAllFilterOptions(
|
|
|
660
673
|
progressIds = undefined,
|
|
661
674
|
coachId = undefined, // New parameter for coach ID
|
|
662
675
|
) {
|
|
676
|
+
console.log('brand', brand)
|
|
663
677
|
if (coachId && contentType !== 'coach-lessons') {
|
|
664
678
|
throw new Error(`Invalid contentType: '${contentType}' for coachId. It must be 'coach-lessons'.`);
|
|
665
679
|
}
|
|
@@ -711,7 +725,7 @@ export async function fetchAllFilterOptions(
|
|
|
711
725
|
}
|
|
712
726
|
}
|
|
713
727
|
}`;
|
|
714
|
-
return fetchSanity(query, true);
|
|
728
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
715
729
|
}
|
|
716
730
|
|
|
717
731
|
/**
|
|
@@ -799,6 +813,7 @@ export async function fetchMethod(brand, slug) {
|
|
|
799
813
|
video,
|
|
800
814
|
length_in_seconds,
|
|
801
815
|
"type": _type,
|
|
816
|
+
"permission_id": permission[]->railcontent_id,
|
|
802
817
|
"levels": child[]->
|
|
803
818
|
{
|
|
804
819
|
"id": railcontent_id,
|
|
@@ -960,19 +975,15 @@ export async function fetchLessonContent(railContentId) {
|
|
|
960
975
|
chapter_timecode,
|
|
961
976
|
"chapter_thumbnail_url": chapter_thumbnail_url.asset->url
|
|
962
977
|
},
|
|
963
|
-
"coaches": instructor[]-> {
|
|
964
|
-
name,
|
|
965
|
-
"id":_id,
|
|
966
|
-
"coach_profile_image":thumbnail_url.asset->url
|
|
967
|
-
},
|
|
968
978
|
"instructors":instructor[]->name,
|
|
969
979
|
"instructor": instructor[]->{
|
|
970
|
-
"id":
|
|
980
|
+
"id":railcontent_id,
|
|
971
981
|
name,
|
|
972
982
|
short_bio,
|
|
973
983
|
"biography": short_bio[0].children[0].text,
|
|
974
984
|
web_url_path,
|
|
975
985
|
"coach_card_image": coach_card_image.asset->url,
|
|
986
|
+
"coach_profile_image":thumbnail_url.asset->url
|
|
976
987
|
},
|
|
977
988
|
${assignmentsField}
|
|
978
989
|
video,
|
|
@@ -980,7 +991,8 @@ export async function fetchLessonContent(railContentId) {
|
|
|
980
991
|
mp3_no_drums_no_click_url,
|
|
981
992
|
mp3_no_drums_yes_click_url,
|
|
982
993
|
mp3_yes_drums_no_click_url,
|
|
983
|
-
mp3_yes_drums_yes_click_url
|
|
994
|
+
mp3_yes_drums_yes_click_url,
|
|
995
|
+
"permission_id": permission[]->railcontent_id,`;
|
|
984
996
|
const query = buildQuery(
|
|
985
997
|
`railcontent_id == ${railContentId}`,
|
|
986
998
|
filterParams,
|
|
@@ -999,19 +1011,16 @@ export async function fetchLessonContent(railContentId) {
|
|
|
999
1011
|
* @returns {Promise<Array<Object>|null>} - The fetched related lessons data or null if not found.
|
|
1000
1012
|
*/
|
|
1001
1013
|
export async function fetchRelatedLessons(railContentId, brand) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
...(*[_type=="song" && brand == "${brand}" && references(^.genre[]->_id)]{_id, "id":railcontent_id, published_on, title, "thumbnail_url":thumbnail.asset->url, difficulty_string, railcontent_id, artist->}[0...11])
|
|
1013
|
-
])|order(published_on, railcontent_id)[0...11]}`;
|
|
1014
|
-
return fetchSanity(query, false);
|
|
1014
|
+
const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && references(*[_type=='permission']._id)]{
|
|
1015
|
+
_type, parent_type, railcontent_id,
|
|
1016
|
+
"related_lessons" : array::unique([
|
|
1017
|
+
...(*[references(^._id)][0].child[]->{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}),
|
|
1018
|
+
...(*[_type=="song" && _type==^._type && brand == "${brand}" && references(^.artist->_id) && railcontent_id !=${railContentId}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10]),
|
|
1019
|
+
...(*[_type=="song" && _type==^._type && brand == "${brand}" && references(^.genre[]->_id) && railcontent_id !=${railContentId}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10]),
|
|
1020
|
+
...(*[_type==^._type && _type in ${JSON.stringify(typeWithSortOrder)} && brand == "${brand}" && railcontent_id !=${railContentId}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, sort}|order(sort asc, title asc)[0...10]),
|
|
1021
|
+
...(*[_type==^._type && !(_type in ${JSON.stringify(typeWithSortOrder)}) && !(defined(parent_type)) && brand == "${brand}" && railcontent_id !=${railContentId}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10]),
|
|
1022
|
+
])[0...10]}`;
|
|
1023
|
+
return fetchSanity(query, false);
|
|
1015
1024
|
}
|
|
1016
1025
|
|
|
1017
1026
|
/**
|
|
@@ -1043,13 +1052,18 @@ export async function fetchRelatedMethodLessons(railContentId, brand) {
|
|
|
1043
1052
|
* @param {string} brand - The brand for which to fetch packs.
|
|
1044
1053
|
* @param {string} [searchTerm=""] - The search term to filter packs.
|
|
1045
1054
|
* @param {string} [sort="-published_on"] - The field to sort the packs by.
|
|
1055
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1056
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1046
1057
|
* @returns {Promise<Array<Object>|null>} - The fetched pack content data or null if not found.
|
|
1047
1058
|
*/
|
|
1048
|
-
export async function fetchAllPacks(brand, sort = "-published_on", searchTerm = "") {
|
|
1059
|
+
export async function fetchAllPacks(brand, sort = "-published_on", searchTerm = "", page = 1, limit = 10) {
|
|
1049
1060
|
const sortOrder = getSortOrder(sort);
|
|
1050
1061
|
const filter = `_type == 'pack' && brand == '${brand}' && title match "${searchTerm}*"`
|
|
1051
1062
|
const filterParams = {};
|
|
1052
1063
|
const fields = getFieldsForContentType('pack');
|
|
1064
|
+
const start = (page - 1) * limit;
|
|
1065
|
+
const end = start + limit;
|
|
1066
|
+
|
|
1053
1067
|
const query = buildQuery(
|
|
1054
1068
|
filter,
|
|
1055
1069
|
filterParams,
|
|
@@ -1057,6 +1071,8 @@ export async function fetchAllPacks(brand, sort = "-published_on", searchTerm =
|
|
|
1057
1071
|
{
|
|
1058
1072
|
logo_image_url: 'logo_image_url.asset->url',
|
|
1059
1073
|
sortOrder: sortOrder,
|
|
1074
|
+
start,
|
|
1075
|
+
end
|
|
1060
1076
|
}
|
|
1061
1077
|
);
|
|
1062
1078
|
return fetchSanity(query, true);
|
|
@@ -1131,6 +1147,23 @@ export async function fetchPackChildren(railcontentId) {
|
|
|
1131
1147
|
return fetchChildren(railcontentId, 'pack-children');
|
|
1132
1148
|
}
|
|
1133
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* Fetch the data needed for the Pack Overview screen.
|
|
1152
|
+
* @param {number} id - The Railcontent ID of the pack
|
|
1153
|
+
* @returns {Promise<Object|null>} - The pack information and lessons or null if not found.
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* fetchPackData(404048)
|
|
1157
|
+
* .then(challenge => console.log(challenge))
|
|
1158
|
+
* .catch(error => console.error(error));
|
|
1159
|
+
*/
|
|
1160
|
+
export async function fetchPackData(id) {
|
|
1161
|
+
const query = `*[railcontent_id == ${id}]{
|
|
1162
|
+
${getFieldsForContentType("pack")}
|
|
1163
|
+
} [0...1]`;
|
|
1164
|
+
return fetchSanity(query, false);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1134
1167
|
/**
|
|
1135
1168
|
* Fetch the data needed for the Challenge Overview screen.
|
|
1136
1169
|
* @param {string} id - The Railcontent ID of the course
|
|
@@ -1145,18 +1178,6 @@ export async function fetchChallengeOverview(id) {
|
|
|
1145
1178
|
// WIP
|
|
1146
1179
|
const query = `*[railcontent_id == ${id}]{
|
|
1147
1180
|
${getFieldsForContentType("challenge")}
|
|
1148
|
-
"lessons": child[]->{
|
|
1149
|
-
"id": railcontent_id,
|
|
1150
|
-
title,
|
|
1151
|
-
"image": thumbnail.asset->url,
|
|
1152
|
-
"instructors": instructor[]->name,
|
|
1153
|
-
length_in_seconds,
|
|
1154
|
-
difficulty_string,
|
|
1155
|
-
difficulty,
|
|
1156
|
-
"type": _type,
|
|
1157
|
-
is_always_unlocked,
|
|
1158
|
-
is_bonus_content,
|
|
1159
|
-
}
|
|
1160
1181
|
} [0...1]`;
|
|
1161
1182
|
return fetchSanity(query, false);
|
|
1162
1183
|
}
|
|
@@ -1264,10 +1285,17 @@ export async function fetchByReference(brand, {
|
|
|
1264
1285
|
* @param {string} brand - The brand for which to fetch lessons.
|
|
1265
1286
|
* @param {string} name - The name of the artist
|
|
1266
1287
|
* @param {string} contentType - The type of the lessons we need to get from the artist. If not defined, groq will get lessons from all content types
|
|
1288
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1289
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1290
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1291
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1292
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1293
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1294
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1267
1295
|
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1268
1296
|
*
|
|
1269
1297
|
* @example
|
|
1270
|
-
* fetchArtistLessons('10 Years', 'song')
|
|
1298
|
+
* fetchArtistLessons('drumeo', '10 Years', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1271
1299
|
* .then(lessons => console.log(lessons))
|
|
1272
1300
|
* .catch(error => console.error(error));
|
|
1273
1301
|
*/
|
|
@@ -1277,7 +1305,9 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1277
1305
|
page = 1,
|
|
1278
1306
|
limit = 10,
|
|
1279
1307
|
includedFields = [],
|
|
1308
|
+
progressIds = undefined,
|
|
1280
1309
|
} = {}) {
|
|
1310
|
+
|
|
1281
1311
|
const fieldsString = DEFAULT_FIELDS.join(',');
|
|
1282
1312
|
const start = (page - 1) * limit;
|
|
1283
1313
|
const end = start + limit;
|
|
@@ -1288,12 +1318,15 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1288
1318
|
? filtersToGroq(includedFields)
|
|
1289
1319
|
: "";
|
|
1290
1320
|
|
|
1321
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1322
|
+
const progressFilter = progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : "";
|
|
1323
|
+
|
|
1291
1324
|
const query = `{
|
|
1292
1325
|
"entity":
|
|
1293
1326
|
*[_type == 'artist' && name == '${name}']
|
|
1294
1327
|
{'type': _type, name, 'thumbnail_url':thumbnail_url.asset->url,
|
|
1295
1328
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1296
|
-
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter}]{${fieldsString}}
|
|
1329
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1297
1330
|
[${start}...${end}]}
|
|
1298
1331
|
|order(${sortOrder})
|
|
1299
1332
|
}`;
|
|
@@ -1304,11 +1337,17 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1304
1337
|
* Fetch the genre's lessons.
|
|
1305
1338
|
* @param {string} brand - The brand for which to fetch lessons.
|
|
1306
1339
|
* @param {string} name - The name of the genre
|
|
1307
|
-
* @param {
|
|
1308
|
-
* @
|
|
1340
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1341
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1342
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1343
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1344
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1345
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1346
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1347
|
+
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1309
1348
|
*
|
|
1310
1349
|
* @example
|
|
1311
|
-
* fetchGenreLessons('Blues', 'song')
|
|
1350
|
+
* fetchGenreLessons('drumeo', 'Blues', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1312
1351
|
* .then(lessons => console.log(lessons))
|
|
1313
1352
|
* .catch(error => console.error(error));
|
|
1314
1353
|
*/
|
|
@@ -1318,6 +1357,7 @@ export async function fetchGenreLessons(brand, name, contentType, {
|
|
|
1318
1357
|
page = 1,
|
|
1319
1358
|
limit = 10,
|
|
1320
1359
|
includedFields = [],
|
|
1360
|
+
progressIds = undefined,
|
|
1321
1361
|
} = {}) {
|
|
1322
1362
|
const fieldsString = DEFAULT_FIELDS.join(',');
|
|
1323
1363
|
const start = (page - 1) * limit;
|
|
@@ -1328,13 +1368,15 @@ export async function fetchGenreLessons(brand, name, contentType, {
|
|
|
1328
1368
|
const includedFieldsFilter = includedFields.length > 0
|
|
1329
1369
|
? filtersToGroq(includedFields)
|
|
1330
1370
|
: "";
|
|
1371
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1372
|
+
const progressFilter = progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : "";
|
|
1331
1373
|
|
|
1332
1374
|
const query = `{
|
|
1333
1375
|
"entity":
|
|
1334
1376
|
*[_type == 'genre' && name == '${name}']
|
|
1335
1377
|
{'type': _type, name, 'thumbnail_url':thumbnail_url.asset->url,
|
|
1336
1378
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1337
|
-
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter}]{${fieldsString}}
|
|
1379
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1338
1380
|
[${start}...${end}]}
|
|
1339
1381
|
|order(${sortOrder})
|
|
1340
1382
|
}`;
|
|
@@ -1362,7 +1404,6 @@ export async function fetchSanity(query,
|
|
|
1362
1404
|
{ customPostProcess = null,
|
|
1363
1405
|
processNeedAccess = true,} = {}
|
|
1364
1406
|
) {
|
|
1365
|
-
|
|
1366
1407
|
// Check the config object before proceeding
|
|
1367
1408
|
if (!checkSanityConfig(globalConfig)) {
|
|
1368
1409
|
return null;
|
|
@@ -1411,6 +1452,10 @@ async function needsAccessDecorator(results)
|
|
|
1411
1452
|
results.forEach((result) => {
|
|
1412
1453
|
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1413
1454
|
});
|
|
1455
|
+
}else if (results.entity && Array.isArray(results.entity)) {
|
|
1456
|
+
results.entity.forEach((result) => {
|
|
1457
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1458
|
+
});
|
|
1414
1459
|
} else {
|
|
1415
1460
|
results['need_access'] = doesUserNeedAccessToContent(results, userPermissions);
|
|
1416
1461
|
}
|
|
@@ -1419,8 +1464,8 @@ async function needsAccessDecorator(results)
|
|
|
1419
1464
|
|
|
1420
1465
|
function doesUserNeedAccessToContent(result, userPermissions)
|
|
1421
1466
|
{
|
|
1422
|
-
const permissions = new Set(result
|
|
1423
|
-
if (permissions.
|
|
1467
|
+
const permissions = new Set(result?.permission_id ?? []);
|
|
1468
|
+
if (permissions.size === 0) {
|
|
1424
1469
|
return false;
|
|
1425
1470
|
}
|
|
1426
1471
|
for (let permission of permissions) {
|
|
@@ -1460,7 +1505,7 @@ export async function fetchCatalogMetadata(contentType)
|
|
|
1460
1505
|
modal_text,
|
|
1461
1506
|
sort_by,
|
|
1462
1507
|
}`
|
|
1463
|
-
return fetchSanity(query, false);
|
|
1508
|
+
return fetchSanity(query, false, {processNeedAccess:false});
|
|
1464
1509
|
}
|
|
1465
1510
|
|
|
1466
1511
|
/**
|
|
@@ -1709,7 +1754,7 @@ function cleanUpGroq(query) {
|
|
|
1709
1754
|
<br class="clear">
|
|
1710
1755
|
|
|
1711
1756
|
<footer>
|
|
1712
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
1757
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Oct 15 2024 11:28:17 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1713
1758
|
</footer>
|
|
1714
1759
|
|
|
1715
1760
|
<script>prettyPrint();</script>
|
package/link_mcs.sh
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -213,7 +213,17 @@ let contentTypeConfig = {
|
|
|
213
213
|
`"description": ${descriptionField}`,
|
|
214
214
|
'"instructors": instructor[]->name',
|
|
215
215
|
'"logo_image_url": logo_image_url.asset->url',
|
|
216
|
-
'total_xp'
|
|
216
|
+
'total_xp',
|
|
217
|
+
`"children": child[]->{
|
|
218
|
+
"description": ${descriptionField},
|
|
219
|
+
"lesson_count": child_count,
|
|
220
|
+
${getFieldsForContentType()}
|
|
221
|
+
}`,
|
|
222
|
+
'"resources": resource',
|
|
223
|
+
'"thumbnail": thumbnail.asset->url',
|
|
224
|
+
'"light_logo": light_mode_logo_url.asset->url',
|
|
225
|
+
'"dark_logo": dark_mode_logo_url.asset->url',
|
|
226
|
+
`"description": ${descriptionField}`,
|
|
217
227
|
],
|
|
218
228
|
},
|
|
219
229
|
'rudiment': {
|