musora-content-services 1.0.95 → 1.0.97

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.97](https://github.com/railroadmedia/musora-content-services/compare/v1.0.96...v1.0.97) (2024-09-12)
6
+
7
+ ### [1.0.96](https://github.com/railroadmedia/musora-content-services/compare/v1.0.95...v1.0.96) (2024-09-12)
8
+
5
9
  ### [1.0.95](https://github.com/railroadmedia/musora-content-services/compare/v1.0.94...v1.0.95) (2024-09-12)
6
10
 
7
11
  ### [1.0.94](https://github.com/railroadmedia/musora-content-services/compare/v1.0.93...v1.0.94) (2024-09-12)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -253,7 +253,7 @@ export async function fetchWorkouts(brand) {
253
253
  * @param {string} brand - The brand for which to fetch new releases.
254
254
  * @returns {Promise<Object|null>} - The fetched new releases data or null if not found.
255
255
  */
256
- export async function fetchNewReleases(brand) {
256
+ export async function fetchNewReleases(brand, { page = 1, limit = 10, sort="-published_on" } = {}) {
257
257
  const newTypes = {
258
258
  'drumeo': ["drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "quick-tips", "question-and-answer", "student-collaborations", "live-streams", "live", "podcasts", "solos", "boot-camps", "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", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
259
259
  'pianote': ["student-review", "student-reviews", "question-and-answer", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
@@ -262,7 +262,10 @@ export async function fetchNewReleases(brand) {
262
262
  'default': ["student-review", "student-reviews", "question-and-answer", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"]
263
263
  };
264
264
  const typesString = arrayJoinWithQuotes(newTypes[brand] ?? newTypes['default']);
265
- const query = `*[_type in [${typesString}] && brand == '${brand}'] | order(releaseDate desc) [0...5] {
265
+ const start = (page - 1) * limit;
266
+ const end = start + limit;
267
+ const sortOrder = getSortOrder(sort);
268
+ const query = `*[_type in [${typesString}] && brand == '${brand}']{
266
269
  "id": railcontent_id,
267
270
  title,
268
271
  "image": thumbnail.asset->url,
@@ -274,7 +277,7 @@ export async function fetchNewReleases(brand) {
274
277
  published_on,
275
278
  "type": _type,
276
279
  web_url_path,
277
- } | order(published_on desc)[0...5]`
280
+ } | order(${sortOrder})[${start}..${end}]`
278
281
  return fetchSanity(query, true);
279
282
  }
280
283
 
@@ -293,7 +296,7 @@ export async function fetchNewReleases(brand) {
293
296
  * .then(events => console.log(events))
294
297
  * .catch(error => console.error(error));
295
298
  */
296
- export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 }) {
299
+ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {}) {
297
300
  const baseLiveTypes = ["student-review", "student-reviews", "student-focus", "coach-stream", "live", "question-and-answer", "student-review", "boot-camps", "recording", "pack-bundle-lesson"];
298
301
  const liveTypes = {
299
302
  '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"],
@@ -934,7 +937,7 @@ export async function fetchLiveEvent(brand) {
934
937
  * .catch(error => console.error(error));
935
938
  */
936
939
  export async function fetchPackChildren(railcontentId) {
937
- return fetchChildren(railcontentId, 'pack');
940
+ return fetchChildren(railcontentId, 'pack-children');
938
941
  }
939
942
 
940
943
  /**