musora-content-services 1.0.88 → 1.0.90
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 +4 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +10 -2
- package/src/services/railcontent.js +6 -4
- package/src/services/sanity.js +2 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.90](https://github.com/railroadmedia/musora-content-services/compare/v1.0.89...v1.0.90) (2024-09-11)
|
|
6
|
+
|
|
7
|
+
### [1.0.89](https://github.com/railroadmedia/musora-content-services/compare/v1.0.88...v1.0.89) (2024-09-11)
|
|
8
|
+
|
|
5
9
|
### [1.0.88](https://github.com/railroadmedia/musora-content-services/compare/v1.0.87...v1.0.88) (2024-09-11)
|
|
6
10
|
|
|
7
11
|
### [1.0.87](https://github.com/railroadmedia/musora-content-services/compare/v1.0.86...v1.0.87) (2024-09-09)
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -75,10 +75,18 @@ let contentTypeConfig = {
|
|
|
75
75
|
'course': {
|
|
76
76
|
'fields': [
|
|
77
77
|
'"lesson_count": child_count',
|
|
78
|
-
'"instructors": instructor[]->name'
|
|
78
|
+
'"instructors": instructor[]->name',
|
|
79
|
+
`"description": ${descriptionField}`,
|
|
80
|
+
'resource',
|
|
81
|
+
`"lessons": child[]->{
|
|
82
|
+
"id": railcontent_id,
|
|
83
|
+
title,
|
|
84
|
+
"image": thumbnail.asset->url,
|
|
85
|
+
"instructors": instructor[]->name,
|
|
86
|
+
length_in_seconds,
|
|
87
|
+
}`,
|
|
79
88
|
]
|
|
80
89
|
},
|
|
81
|
-
|
|
82
90
|
'method': {
|
|
83
91
|
'fields': [
|
|
84
92
|
`"description": ${descriptionField}`,
|
|
@@ -142,18 +142,20 @@ export async function fetchSongsInProgress(brand) {
|
|
|
142
142
|
*
|
|
143
143
|
* @param {string} type - The content type associated with the content.
|
|
144
144
|
* @param {string} brand - The brand associated with the content.
|
|
145
|
+
* @param {number} [limit=20] - The limit of results per page.
|
|
146
|
+
* @param {number} [page=1] - The page number for pagination.
|
|
145
147
|
* @returns {Promise<Object|null>} - Returns an object containing in-progress content if found, otherwise null.
|
|
146
148
|
* @example
|
|
147
149
|
* fetchContentInProgress('song', 'drumeo')
|
|
148
150
|
* .then(songs => console.log(songs))
|
|
149
151
|
* .catch(error => console.error(error));
|
|
150
152
|
*/
|
|
151
|
-
export async function fetchContentInProgress(type="all", brand) {
|
|
153
|
+
export async function fetchContentInProgress(type="all", brand, limit=20, page=1) {
|
|
152
154
|
let url;
|
|
153
|
-
if(type!=="all") {
|
|
154
|
-
url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}`;
|
|
155
|
+
if(type !== "all") {
|
|
156
|
+
url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}&limit=${limit}&page=${page}`;
|
|
155
157
|
} else {
|
|
156
|
-
url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&brand=${brand}`;
|
|
158
|
+
url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&brand=${brand}&limit=${limit}&page=${page}`;
|
|
157
159
|
}
|
|
158
160
|
const headers = {
|
|
159
161
|
'Content-Type': 'application/json',
|
package/src/services/sanity.js
CHANGED
|
@@ -672,6 +672,7 @@ export async function fetchMethodChildren(railcontentId) {
|
|
|
672
672
|
"description": ${descriptionField},
|
|
673
673
|
title,
|
|
674
674
|
xp,
|
|
675
|
+
total_xp,
|
|
675
676
|
'children': child[]->{
|
|
676
677
|
${getFieldsForContentType('method')}
|
|
677
678
|
},
|
|
@@ -999,29 +1000,8 @@ export async function fetchCoachLessons(brand, id, {
|
|
|
999
1000
|
* .catch(error => console.error(error));
|
|
1000
1001
|
*/
|
|
1001
1002
|
export async function fetchCourseOverview(id) {
|
|
1002
|
-
// WIP
|
|
1003
1003
|
const query = `*[railcontent_id == ${id}]{
|
|
1004
|
-
"
|
|
1005
|
-
railcontent_id,
|
|
1006
|
-
title,
|
|
1007
|
-
"image": thumbnail.asset->url,
|
|
1008
|
-
"instructors": instructor[]->name,
|
|
1009
|
-
difficulty,
|
|
1010
|
-
difficulty_string,
|
|
1011
|
-
web_url_path,
|
|
1012
|
-
published_on,
|
|
1013
|
-
"type": _type,
|
|
1014
|
-
total_xp,
|
|
1015
|
-
xp,
|
|
1016
|
-
description,
|
|
1017
|
-
resource,
|
|
1018
|
-
"lessons": child[]->{
|
|
1019
|
-
"id": railcontent_id,
|
|
1020
|
-
title,
|
|
1021
|
-
"image": thumbnail.asset->url,
|
|
1022
|
-
"instructors": instructor[]->name,
|
|
1023
|
-
length_in_seconds,
|
|
1024
|
-
}
|
|
1004
|
+
${getFieldsForContentType("course", true)}
|
|
1025
1005
|
}`
|
|
1026
1006
|
return fetchSanity(query, false);
|
|
1027
1007
|
}
|