musora-content-services 1.0.221 → 1.0.222
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.222](https://github.com/railroadmedia/musora-content-services/compare/v1.0.221...v1.0.222) (2024-12-06)
|
|
6
|
+
|
|
5
7
|
### [1.0.221](https://github.com/railroadmedia/musora-content-services/compare/v1.0.220...v1.0.221) (2024-12-06)
|
|
6
8
|
|
|
7
9
|
### [1.0.220](https://github.com/railroadmedia/musora-content-services/compare/v1.0.219...v1.0.220) (2024-12-06)
|
package/package.json
CHANGED
package/src/services/sanity.js
CHANGED
|
@@ -831,9 +831,12 @@ export async function fetchAllFilterOptions(
|
|
|
831
831
|
|
|
832
832
|
const constructCommonFilter = (excludeFilter) => {
|
|
833
833
|
const filterWithoutOption = excludeFilter ? filtersToGroq(filters, excludeFilter) : includedFieldsFilter;
|
|
834
|
+
const statusFilter = ' && status == "published"';
|
|
835
|
+
const includeStatusFilter = !['instructor','artist','genre'].includes(contentType);
|
|
836
|
+
|
|
834
837
|
return coachId
|
|
835
|
-
? `brand == '${brand}' && references(*[_type=='instructor' && railcontent_id == ${coachId}]._id) ${filterWithoutOption || ''}`
|
|
836
|
-
: `_type == '${contentType}' && brand == "${brand}"${style && excludeFilter !== "style" ? ` && '${style}' in genre[]->name` : ''}${artist && excludeFilter !== "artist" ? ` && artist->name == '${artist}'` : ''} ${progressFilter} ${filterWithoutOption || ''}`;
|
|
838
|
+
? `brand == '${brand}' && status == "published" && references(*[_type=='instructor' && railcontent_id == ${coachId}]._id) ${filterWithoutOption || ''}`
|
|
839
|
+
: `_type == '${contentType}' && brand == "${brand}"${includeStatusFilter ? statusFilter : ''}${style && excludeFilter !== "style" ? ` && '${style}' in genre[]->name` : ''}${artist && excludeFilter !== "artist" ? ` && artist->name == '${artist}'` : ''} ${progressFilter} ${filterWithoutOption || ''}`;
|
|
837
840
|
};
|
|
838
841
|
|
|
839
842
|
const metaData = processMetadata(brand, contentType, true);
|
|
@@ -2018,10 +2021,8 @@ function getFilterOptions(option, commonFilter, contentType, brand) {
|
|
|
2018
2021
|
][count > 0],`;
|
|
2019
2022
|
break;
|
|
2020
2023
|
case "type":
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
}).join(', ');
|
|
2024
|
-
filterGroq = `"type": [${dynamicTypeOptions}][count > 0],`;
|
|
2024
|
+
const typesString = types.map(t => {return `{"type": "${t}"}`}).join(', ');
|
|
2025
|
+
filterGroq = `"type": [${typesString}]{type, 'count': count(*[_type == ^.type && ${commonFilter}])}[count > 0],`;
|
|
2025
2026
|
break;
|
|
2026
2027
|
case "genre":
|
|
2027
2028
|
case "essential":
|
|
@@ -420,7 +420,7 @@ describe('Sanity Queries', function () {
|
|
|
420
420
|
});
|
|
421
421
|
|
|
422
422
|
test('fetchAllFilterOptions-WithProgress', async () => {
|
|
423
|
-
const ids = [410213,
|
|
423
|
+
const ids = [410213, 413851];
|
|
424
424
|
let response = await fetchAllFilterOptions('drumeo', '', '', '', 'song', '', ids);
|
|
425
425
|
expect(response.meta.totalResults).toBe(2);
|
|
426
426
|
// change the brand and we expect no results
|