musora-content-services 1.0.167 → 1.0.169
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.169](https://github.com/railroadmedia/musora-content-services/compare/v1.0.168...v1.0.169) (2024-11-11)
|
|
6
|
+
|
|
7
|
+
### [1.0.168](https://github.com/railroadmedia/musora-content-services/compare/v1.0.167...v1.0.168) (2024-11-11)
|
|
8
|
+
|
|
5
9
|
### [1.0.167](https://github.com/railroadmedia/musora-content-services/compare/v1.0.166...v1.0.167) (2024-11-11)
|
|
6
10
|
|
|
7
11
|
### [1.0.166](https://github.com/railroadmedia/musora-content-services/compare/v1.0.165...v1.0.166) (2024-11-11)
|
package/package.json
CHANGED
package/src/services/sanity.js
CHANGED
|
@@ -1444,7 +1444,7 @@ function populateHierarchyLookups(currentLevel, data, parentId) {
|
|
|
1444
1444
|
*/
|
|
1445
1445
|
export async function fetchCommentModContentData(ids) {
|
|
1446
1446
|
const idsString = ids.join(',');
|
|
1447
|
-
const fields = `"id": railcontent_id, "type": _type, title, "parent": *[^._id in child[]._ref]{"id": railcontent_id, title}`;
|
|
1447
|
+
const fields = `"id": railcontent_id, "type": _type, title, "url": web_url_path, "parent": *[^._id in child[]._ref]{"id": railcontent_id, title}`;
|
|
1448
1448
|
const query = await buildQuery(`railcontent_id in [${idsString}]`,
|
|
1449
1449
|
{bypassPermissions: true},
|
|
1450
1450
|
fields,
|
|
@@ -1452,7 +1452,13 @@ export async function fetchCommentModContentData(ids) {
|
|
|
1452
1452
|
let data = await fetchSanity(query, true);
|
|
1453
1453
|
let mapped = {};
|
|
1454
1454
|
data.forEach(function (content) {
|
|
1455
|
-
mapped[content.id] = {
|
|
1455
|
+
mapped[content.id] = {
|
|
1456
|
+
"id": content.id,
|
|
1457
|
+
"type": content.type,
|
|
1458
|
+
"title": content.title,
|
|
1459
|
+
"url": content.url,
|
|
1460
|
+
"parentTitle": content.parent[0]?.title ?? null
|
|
1461
|
+
};
|
|
1456
1462
|
});
|
|
1457
1463
|
return mapped;
|
|
1458
1464
|
}
|
|
@@ -573,9 +573,10 @@ describe('Sanity Queries', function () {
|
|
|
573
573
|
});
|
|
574
574
|
|
|
575
575
|
test('fetchCommentData', async()=>{
|
|
576
|
-
let data = await fetchCommentModContentData([241251,241252]);
|
|
576
|
+
let data = await fetchCommentModContentData([241251,241252, 211153]);
|
|
577
577
|
expect(data[241251].title).toBe("Setting Up Your Space");
|
|
578
578
|
expect(data[241251].type).toBe("learning-path-lesson");
|
|
579
|
+
expect(data[241251].url).toBe( "/drumeo/method/drumeo-method/241247/getting-started-on-the-drums/241248/gear/241249/setting-up-your-space/241251");
|
|
579
580
|
expect(data[241251].parentTitle).toBe("Gear");
|
|
580
581
|
expect(data[241252].title).toBe("Setting Up Your Pedals & Throne");
|
|
581
582
|
});
|