musora-content-services 1.0.231 → 1.0.233

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.233](https://github.com/railroadmedia/musora-content-services/compare/v1.0.218...v1.0.233) (2024-12-12)
6
+
7
+ ### [1.0.232](https://github.com/railroadmedia/musora-content-services/compare/v1.0.231...v1.0.232) (2024-12-11)
8
+
5
9
  ### [1.0.231](https://github.com/railroadmedia/musora-content-services/compare/v1.0.230...v1.0.231) (2024-12-10)
6
10
 
7
11
  ### [1.0.230](https://github.com/railroadmedia/musora-content-services/compare/v1.0.229...v1.0.230) (2024-12-10)
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.231",
3
+ "version": "1.0.233",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
File without changes
@@ -391,6 +391,8 @@ let contentTypeConfig = {
391
391
  'sonor': contentWithSortField,
392
392
  }
393
393
 
394
+ const songAccessMembership = 94;
395
+
394
396
  function getNewReleasesTypes(brand) {
395
397
  const baseNewTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "workout", "challenge", "challenge-part", "podcasts", "pack", "song", "learning-path-level", "play-along", "course", "unit"];
396
398
  switch (brand) {
@@ -474,7 +476,7 @@ function filtersToGroq(filters, selectedFilters = []) {
474
476
  return `bpm == ${value}`;
475
477
  }
476
478
  } else if (['creativity', 'essential', 'focus', 'genre', 'lifestyle', 'theory', 'topic'].includes(key) && !selectedFilters.includes(key)) {
477
- return `${key}[]->name match "${value}"`;
479
+ return `"${value}" in ${key}[]->name`;
478
480
  } else if (key === 'gear' && !selectedFilters.includes('gear')) {
479
481
  return `gear match "${value}"`;
480
482
  } else if (key === 'instrumentless' && !selectedFilters.includes(key)) {
@@ -535,5 +537,6 @@ module.exports = {
535
537
  getNewReleasesTypes,
536
538
  getUpcomingEventsTypes,
537
539
  showsTypes,
538
- coachLessonsTypes
540
+ coachLessonsTypes,
541
+ songAccessMembership
539
542
  }
@@ -1,5 +1,7 @@
1
1
  import {fetchUserPermissions} from "./services/userPermissions";
2
-
2
+ import {
3
+ songAccessMembership
4
+ } from "./contentTypeConfig";
3
5
 
4
6
  export class FilterBuilder {
5
7
 
@@ -19,7 +21,8 @@ export class FilterBuilder {
19
21
  getFutureScheduledContentsOnly = false,
20
22
  bypassStatuses = false,
21
23
  bypassPublishedDateRestriction = false,
22
- isSingle = false
24
+ isSingle = false,
25
+ allowsPullSongsContent = true
23
26
  } = {}) {
24
27
  this.availableContentStatuses = availableContentStatuses;
25
28
  this.bypassPermissions = bypassPermissions;
@@ -29,6 +32,7 @@ export class FilterBuilder {
29
32
  this.getFutureContentOnly = getFutureContentOnly;
30
33
  this.getFutureScheduledContentsOnly = getFutureScheduledContentsOnly;
31
34
  this.isSingle = isSingle;
35
+ this.allowsPullSongsContent = allowsPullSongsContent;
32
36
  this.filter = filter;
33
37
  // this.debug = process.env.DEBUG === 'true' || false;
34
38
  this.debug = false;
@@ -87,7 +91,10 @@ export class FilterBuilder {
87
91
 
88
92
  _applyPermissions() {
89
93
  if (this.bypassPermissions || this.userData.isAdmin) return this;
90
- const requiredPermissions = this._getUserPermissions();
94
+ let requiredPermissions = this._getUserPermissions();
95
+ if(this.userData.isABasicMember && this.allowsPullSongsContent){
96
+ requiredPermissions = [...requiredPermissions, songAccessMembership];
97
+ }
91
98
  this._andWhere(`(!defined(permission) || references(*[_type == 'permission' && railcontent_id in ${arrayToRawRepresentation(requiredPermissions)}]._id))`);
92
99
  return this;
93
100
  }
package/src/index.d.ts CHANGED
File without changes
package/src/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -291,7 +291,7 @@ export async function fetchNewReleases(brand, {page = 1, limit = 20, sort = "-pu
291
291
  const start = (page - 1) * limit;
292
292
  const end = start + limit;
293
293
  const sortOrder = getSortOrder(sort, brand);
294
- const filter = `_type in ${typesString} && brand == '${brand}'`;
294
+ const filter = `_type in ${typesString} && brand == '${brand}' && show_in_new_feed == true`;
295
295
  const fields = `
296
296
  "id": railcontent_id,
297
297
  title,
@@ -306,7 +306,7 @@ export async function fetchNewReleases(brand, {page = 1, limit = 20, sort = "-pu
306
306
  web_url_path,
307
307
  "permission_id": permission[]->railcontent_id,
308
308
  `;
309
- const filterParams = {};
309
+ const filterParams = {allowsPullSongsContent: false};
310
310
  const query = await buildQuery(
311
311
  filter,
312
312
  filterParams,
File without changes
File without changes
File without changes
@@ -509,7 +509,7 @@ describe('Sanity Queries', function () {
509
509
  });
510
510
 
511
511
  test('fetchAll-IncludedFields-coaches-multiple-focus', async () => {
512
- let response = await fetchAll('drumeo', 'instructor', {includedFields: ['focus,drumline', 'focus,recording']});
512
+ let response = await fetchAll('drumeo', 'instructor', {includedFields: ['focus,Drumline', 'focus,Recording']});
513
513
  log(response);
514
514
  expect(response.entity.length).toBeGreaterThan(0);
515
515
  });