musora-content-services 1.0.100 → 1.0.102

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,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.102](https://github.com/railroadmedia/musora-content-services/compare/v1.0.101...v1.0.102) (2024-09-17)
6
+
7
+ ### [1.0.101](https://github.com/railroadmedia/musora-content-services/compare/v1.0.100...v1.0.101) (2024-09-17)
8
+
5
9
  ### [1.0.100](https://github.com/railroadmedia/musora-content-services/compare/v1.0.99...v1.0.100) (2024-09-16)
6
10
 
7
11
  ### [1.0.99](https://github.com/railroadmedia/musora-content-services/compare/v1.0.98...v1.0.99) (2024-09-12)
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -46,6 +46,7 @@ const contentWithSortField = {
46
46
  let contentTypeConfig = {
47
47
  'song': {
48
48
  'fields': [
49
+ 'album',
49
50
  'soundslice',
50
51
  'instrumentless',
51
52
  ],
package/src/index.d.ts CHANGED
@@ -33,13 +33,14 @@ import {
33
33
  fetchGenreLessons,
34
34
  } from './services/sanity.js';
35
35
 
36
- import {
36
+ import {
37
37
  fetchCompletedState,
38
38
  fetchAllCompletedStates,
39
39
  fetchContentInProgress,
40
+ fetchCompletedContent,
40
41
  fetchVimeoData,
41
42
  fetchContentPageUserData,
42
- } from "./services/railcontent";
43
+ } from './services/railcontent.js';
43
44
 
44
45
  import { initializeService } from './services/config.js';
45
46
 
@@ -80,6 +81,7 @@ declare module 'musora-content-services' {
80
81
  fetchCompletedState,
81
82
  fetchAllCompletedStates,
82
83
  fetchContentInProgress,
84
+ fetchCompletedContent,
83
85
  fetchContentPageUserData,
84
86
  fetchScheduledReleases,
85
87
  fetchArtistLessons,
package/src/index.js CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  fetchAllSongs,
9
9
  fetchSongFilterOptions,
10
10
  fetchSongCount,
11
- fetchWorkouts,
12
11
  fetchNewReleases,
13
12
  fetchUpcomingEvents,
14
13
  fetchByRailContentId,
@@ -59,7 +58,6 @@ export {
59
58
  fetchAllSongs,
60
59
  fetchSongFilterOptions,
61
60
  fetchSongCount,
62
- fetchWorkouts,
63
61
  fetchNewReleases,
64
62
  fetchUpcomingEvents,
65
63
  fetchByRailContentId,
@@ -229,27 +229,6 @@ export async function fetchSongCount(brand) {
229
229
  return fetchSanity(query, true);
230
230
  }
231
231
 
232
- /**
233
- * Fetch the latest workouts for a specific brand, including completion status and progress.
234
- * This function retrieves up to five of the latest workout content for a given brand, sorted in descending order by their publication date.
235
- * It also includes completion status and progress percentage for each workout by fetching additional data about user progress.
236
- *
237
- * @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
238
- * @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.
239
- *
240
- * @example
241
- * fetchWorkouts('drumeo')
242
- * .then(workouts => console.log(workouts))
243
- * .catch(error => console.error(error));
244
- */
245
- export async function fetchWorkouts(brand) {
246
- const fields = getFieldsForContentType('workout');
247
- const query = `*[_type == 'workout' && brand == '${brand}'] [0...5] {
248
- ${fields.toString()}
249
- } | order(published_on desc)[0...5]`
250
- return fetchSanity(query, true);
251
- }
252
-
253
232
  /**
254
233
  * Fetch the latest new releases for a specific brand.
255
234
  * @param {string} brand - The brand for which to fetch new releases.
@@ -887,6 +866,30 @@ export async function fetchRelatedLessons(railContentId, brand) {
887
866
  return fetchSanity(query, false);
888
867
  }
889
868
 
869
+ /**
870
+ * Fetch related method lessons for a specific lesson by RailContent ID and type.
871
+ * @param {string} railContentId - The RailContent ID of the current lesson.
872
+ * @param {string} brand - The current brand.
873
+ * @returns {Promise<Object>|null>} - The fetched related lessons
874
+ */
875
+ export async function fetchRelatedMethodLessons(railContentId, brand) {
876
+ const query = `*[railcontent_id == ${railContentId} && brand == "${brand}"]{
877
+ "id":_id,
878
+ "related_lessons": *[references(^._id)][0].child[]->{
879
+ "id": railcontent_id,
880
+ "type": _type,
881
+ title,
882
+ "description": description[0].children[0].text, // Extraer texto plano
883
+ "thumbnail_url": thumbnail.asset->url,
884
+ "url": web_url_path,
885
+ difficulty,
886
+ difficulty_string,
887
+ }
888
+ }
889
+ }`
890
+ return fetchSanity(query, false);
891
+ }
892
+
890
893
  /**
891
894
  * Fetch all packs.
892
895
  * @param {string} brand - The brand for which to fetch packs.