musora-content-services 1.0.186 → 1.0.188
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.188](https://github.com/railroadmedia/musora-content-services/compare/v1.0.187...v1.0.188) (2024-11-28)
|
|
6
|
+
|
|
7
|
+
### [1.0.187](https://github.com/railroadmedia/musora-content-services/compare/v1.0.186...v1.0.187) (2024-11-28)
|
|
8
|
+
|
|
5
9
|
### [1.0.186](https://github.com/railroadmedia/musora-content-services/compare/v1.0.185...v1.0.186) (2024-11-28)
|
|
6
10
|
|
|
7
11
|
### [1.0.185](https://github.com/railroadmedia/musora-content-services/compare/v1.0.176...v1.0.185) (2024-11-27)
|
package/package.json
CHANGED
package/src/services/sanity.js
CHANGED
|
@@ -532,18 +532,22 @@ export async function fetchAll(brand, type, {
|
|
|
532
532
|
const progressFilter = await getProgressFilter(progress, progressIds);
|
|
533
533
|
|
|
534
534
|
// Determine the sort order
|
|
535
|
-
const sortOrder = getSortOrder(sort);
|
|
535
|
+
const sortOrder = getSortOrder(sort, groupBy);
|
|
536
536
|
|
|
537
537
|
let fields = useDefaultFields ? customFields.concat(DEFAULT_FIELDS, additionalFields) : customFields;
|
|
538
538
|
let fieldsString = fields.join(',');
|
|
539
539
|
|
|
540
|
+
let customFilter = '';
|
|
541
|
+
if (type == 'instructor') {
|
|
542
|
+
customFilter = '&& coach_card_image != null'
|
|
543
|
+
}
|
|
540
544
|
// Determine the group by clause
|
|
541
545
|
let query = "";
|
|
542
546
|
let entityFieldsString = "";
|
|
543
547
|
let filter = "";
|
|
544
548
|
if (groupBy !== "" && isGroupByOneToOne) {
|
|
545
549
|
const webUrlPath = 'artists';
|
|
546
|
-
const lessonsFilter = `_type == '${type}' && brand == '${brand}' && ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
550
|
+
const lessonsFilter = `_type == '${type}' && brand == '${brand}' && ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter} ${customFilter}`;
|
|
547
551
|
const lessonsFilterWithRestrictions = await new FilterBuilder(lessonsFilter).buildFilter();
|
|
548
552
|
entityFieldsString = `
|
|
549
553
|
'id': railcontent_id,
|
|
@@ -560,7 +564,7 @@ export async function fetchAll(brand, type, {
|
|
|
560
564
|
filter = `_type == '${groupBy}' && count(*[brand == '${brand}' && ^._id == ${groupBy}._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0`;
|
|
561
565
|
} else if (groupBy !== "") {
|
|
562
566
|
const webUrlPath = (groupBy == 'genre') ? '/genres' : '';
|
|
563
|
-
const lessonsFilter = `brand == '${brand}' && ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}`;
|
|
567
|
+
const lessonsFilter = `brand == '${brand}' && ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter} ${customFilter}`;
|
|
564
568
|
const lessonsFilterWithRestrictions = await new FilterBuilder(lessonsFilter).buildFilter();
|
|
565
569
|
|
|
566
570
|
entityFieldsString = `
|
|
@@ -576,7 +580,7 @@ export async function fetchAll(brand, type, {
|
|
|
576
580
|
}[0...20]`;
|
|
577
581
|
filter = `_type == '${groupBy}' && count(*[brand == '${brand}' && ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0`;
|
|
578
582
|
} else {
|
|
579
|
-
filter = `brand == "${brand}" ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}`
|
|
583
|
+
filter = `brand == "${brand}" ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter} ${customFilter}`
|
|
580
584
|
entityFieldsString = fieldsString;
|
|
581
585
|
}
|
|
582
586
|
|
|
@@ -227,6 +227,13 @@ describe('Sanity Queries', function () {
|
|
|
227
227
|
expect(response.entity[0].instructors).toBeTruthy();
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
+
test('fetchAllInstructors', async () => {
|
|
231
|
+
const response = await fetchAll('drumeo', 'instructor');
|
|
232
|
+
log(response);
|
|
233
|
+
expect(response.entity[0].name).toBeDefined();
|
|
234
|
+
expect(response.entity[0].coach_card_image).toBeTruthy();
|
|
235
|
+
});
|
|
236
|
+
|
|
230
237
|
test('fetchAllSortField', async () => {
|
|
231
238
|
const response = await fetchAll('drumeo', 'rhythmic-adventures-of-captain-carson', {});
|
|
232
239
|
log(response);
|