musora-content-services 1.0.181 → 1.0.182
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.182](https://github.com/railroadmedia/musora-content-services/compare/v1.0.181...v1.0.182) (2024-11-25)
|
|
6
|
+
|
|
5
7
|
### [1.0.181](https://github.com/railroadmedia/musora-content-services/compare/v1.0.180...v1.0.181) (2024-11-25)
|
|
6
8
|
|
|
7
9
|
### [1.0.180](https://github.com/railroadmedia/musora-content-services/compare/v1.0.179...v1.0.180) (2024-11-23)
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -347,7 +347,7 @@ let contentTypeConfig = {
|
|
|
347
347
|
'"focus": focus[]->name',
|
|
348
348
|
'focus_text',
|
|
349
349
|
'forum_thread_id',
|
|
350
|
-
'"long_bio": long_bio[0].children[0].text
|
|
350
|
+
'"long_bio": long_bio[0].children[0].text',
|
|
351
351
|
'name',
|
|
352
352
|
'"short_bio" : short_bio[0].children[0].text',
|
|
353
353
|
'bands',
|
package/src/services/sanity.js
CHANGED
|
@@ -510,7 +510,7 @@ export async function fetchAll(brand, type, {
|
|
|
510
510
|
let webUrlPathType = config?.slug ?? type;
|
|
511
511
|
const start = (page - 1) * limit;
|
|
512
512
|
const end = start + limit;
|
|
513
|
-
let bypassStatusAndPublishedValidation = (type == 'instructor');
|
|
513
|
+
let bypassStatusAndPublishedValidation = (type == 'instructor' || groupBy == 'artist' || groupBy == 'genre' || groupBy == 'instructor');
|
|
514
514
|
|
|
515
515
|
// Construct the type filter
|
|
516
516
|
const typeFilter = type ? `&& _type == '${type}'` : "";
|
|
@@ -543,14 +543,15 @@ export async function fetchAll(brand, type, {
|
|
|
543
543
|
if (groupBy !== "" && isGroupByOneToOne) {
|
|
544
544
|
const webUrlPath = 'artists';
|
|
545
545
|
const lessonsFilter = `_type == '${type}' && brand == '${brand}' && ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
546
|
+
const lessonsFilterWithRestrictions = await new FilterBuilder(lessonsFilter).buildFilter();
|
|
546
547
|
entityFieldsString = `
|
|
547
548
|
'id': railcontent_id,
|
|
548
549
|
'type': _type,
|
|
549
550
|
name,
|
|
550
551
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
551
552
|
'web_url_path': '/${brand}/${webUrlPath}/'+name+'?included_fieds[]=type,${type}',
|
|
552
|
-
'all_lessons_count': count(*[${
|
|
553
|
-
'lessons': *[${
|
|
553
|
+
'all_lessons_count': count(*[${lessonsFilterWithRestrictions}]._id),
|
|
554
|
+
'lessons': *[${lessonsFilterWithRestrictions}]{
|
|
554
555
|
${fieldsString},
|
|
555
556
|
${groupBy}
|
|
556
557
|
}[0...20]
|
|
@@ -559,14 +560,16 @@ export async function fetchAll(brand, type, {
|
|
|
559
560
|
} else if (groupBy !== "") {
|
|
560
561
|
const webUrlPath = (groupBy == 'genre') ? '/genres' : '';
|
|
561
562
|
const lessonsFilter = `brand == '${brand}' && ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
563
|
+
const lessonsFilterWithRestrictions = await new FilterBuilder(lessonsFilter).buildFilter();
|
|
564
|
+
|
|
562
565
|
entityFieldsString = `
|
|
563
566
|
'id': railcontent_id,
|
|
564
567
|
'type': _type,
|
|
565
568
|
name,
|
|
566
569
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
567
570
|
'web_url_path': select(defined(web_url_path)=> web_url_path +'?included_fieds[]=type,${type}',!defined(web_url_path)=> '/${brand}${webUrlPath}/'+name+'/${webUrlPathType}'),
|
|
568
|
-
'all_lessons_count': count(*[${
|
|
569
|
-
'lessons': *[${
|
|
571
|
+
'all_lessons_count': count(*[${lessonsFilterWithRestrictions}]._id),
|
|
572
|
+
'lessons': *[${lessonsFilterWithRestrictions}]{
|
|
570
573
|
${fieldsString},
|
|
571
574
|
${groupBy}
|
|
572
575
|
}[0...20]`;
|
|
@@ -361,13 +361,13 @@ describe('Sanity Queries', function () {
|
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
test('fetchAll-WithProgress', async () => {
|
|
364
|
-
const ids = [410213,
|
|
364
|
+
const ids = [410213, 410215];
|
|
365
365
|
let response = await fetchAll('drumeo', 'song', {
|
|
366
366
|
sort: 'slug',
|
|
367
367
|
progressIds: ids,
|
|
368
368
|
});
|
|
369
369
|
expect(response.entity.length).toBe(2);
|
|
370
|
-
expect(response.entity[0].id =
|
|
370
|
+
expect(response.entity[0].id = 410215);
|
|
371
371
|
expect(response.entity[1].id = 410213);
|
|
372
372
|
// change the type and we expect no results
|
|
373
373
|
response = await fetchAll('drumeo', 'quick-tip', {
|