musora-content-services 1.0.89 → 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 CHANGED
@@ -2,6 +2,8 @@
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
+
5
7
  ### [1.0.89](https://github.com/railroadmedia/musora-content-services/compare/v1.0.88...v1.0.89) (2024-09-11)
6
8
 
7
9
  ### [1.0.88](https://github.com/railroadmedia/musora-content-services/compare/v1.0.87...v1.0.88) (2024-09-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.89",
3
+ "version": "1.0.90",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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',
@@ -1000,29 +1000,8 @@ export async function fetchCoachLessons(brand, id, {
1000
1000
  * .catch(error => console.error(error));
1001
1001
  */
1002
1002
  export async function fetchCourseOverview(id) {
1003
- // WIP
1004
1003
  const query = `*[railcontent_id == ${id}]{
1005
- "id": railcontent_id,
1006
- railcontent_id,
1007
- title,
1008
- "image": thumbnail.asset->url,
1009
- "instructors": instructor[]->name,
1010
- difficulty,
1011
- difficulty_string,
1012
- web_url_path,
1013
- published_on,
1014
- "type": _type,
1015
- total_xp,
1016
- xp,
1017
- description,
1018
- resource,
1019
- "lessons": child[]->{
1020
- "id": railcontent_id,
1021
- title,
1022
- "image": thumbnail.asset->url,
1023
- "instructors": instructor[]->name,
1024
- length_in_seconds,
1025
- }
1004
+ ${getFieldsForContentType("course", true)}
1026
1005
  }`
1027
1006
  return fetchSanity(query, false);
1028
1007
  }