musora-content-services 1.0.185 → 1.0.187
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 +4 -0
- package/docs/config.js.html +0 -0
- package/docs/index.html +0 -0
- package/docs/module-Config.html +0 -0
- package/docs/module-Railcontent-Services.html +0 -0
- package/docs/module-Sanity-Services.html +0 -0
- package/docs/railcontent.js.html +0 -0
- package/docs/sanity.js.html +0 -0
- package/package.json +1 -1
- package/src/filterBuilder.js +0 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +10 -4
- package/test/contentProgress.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/sanityQueryService.test.js +7 -0
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.187](https://github.com/railroadmedia/musora-content-services/compare/v1.0.186...v1.0.187) (2024-11-28)
|
|
6
|
+
|
|
7
|
+
### [1.0.186](https://github.com/railroadmedia/musora-content-services/compare/v1.0.185...v1.0.186) (2024-11-28)
|
|
8
|
+
|
|
5
9
|
### [1.0.185](https://github.com/railroadmedia/musora-content-services/compare/v1.0.176...v1.0.185) (2024-11-27)
|
|
6
10
|
|
|
7
11
|
### [1.0.184](https://github.com/railroadmedia/musora-content-services/compare/v1.0.183...v1.0.184) (2024-11-25)
|
package/docs/config.js.html
CHANGED
|
File without changes
|
package/docs/index.html
CHANGED
|
File without changes
|
package/docs/module-Config.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/railcontent.js.html
CHANGED
|
File without changes
|
package/docs/sanity.js.html
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/filterBuilder.js
CHANGED
|
File without changes
|
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
|
package/src/services/sanity.js
CHANGED
|
@@ -537,13 +537,17 @@ export async function fetchAll(brand, type, {
|
|
|
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
|
|
|
@@ -1347,9 +1351,11 @@ export async function fetchByReference(brand, {
|
|
|
1347
1351
|
const includedFieldsFilter = includedFields.length > 0
|
|
1348
1352
|
? includedFields.join(' && ')
|
|
1349
1353
|
: "";
|
|
1354
|
+
|
|
1350
1355
|
const filter = `brand == '${brand}' ${searchFilter} && references(*[${includedFieldsFilter}]._id)`;
|
|
1356
|
+
const filterWithRestrictions = await new FilterBuilder(filter).buildFilter();
|
|
1351
1357
|
const query = buildEntityAndTotalQuery(
|
|
1352
|
-
|
|
1358
|
+
filterWithRestrictions,
|
|
1353
1359
|
fieldsString,
|
|
1354
1360
|
{
|
|
1355
1361
|
sortOrder: getSortOrder(sortOrder),
|
|
File without changes
|
|
File without changes
|
|
@@ -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);
|