@saooti/octopus-sdk 41.1.5 → 41.1.6
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 +7 -0
- package/package.json +1 -1
- package/src/api/playlistApi.ts +8 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/api/playlistApi.ts
CHANGED
|
@@ -29,6 +29,10 @@ async function getContent(playlistId: number): Promise<Array<SimplifiedPodcast>>
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function unique<T>(value: T, index: number, array: Array<T>): boolean {
|
|
33
|
+
return array.indexOf(value) === index;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
/**
|
|
33
37
|
* Retrieve the podcasts defined in the playlist, with all their data
|
|
34
38
|
* This query is longer, because it also needs to retrieve organisations &
|
|
@@ -40,10 +44,10 @@ async function getContentFull(playlistId: number): Promise<Array<Podcast>> {
|
|
|
40
44
|
const simplified = await this.getContent(playlistId);
|
|
41
45
|
const full: Array<Podcast> = [];
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const organisationIds = simplified.map((p: SimplifiedPodcast) => p.organisationId)
|
|
48
|
+
.filter(unique);
|
|
49
|
+
const emissionIds = simplified.map((p: SimplifiedPodcast) => p.emissionId)
|
|
50
|
+
.filter(unique);
|
|
47
51
|
|
|
48
52
|
const organisations = await organisationApi.getAllById(organisationIds);
|
|
49
53
|
const emissions = await emissionApi.getAllById(emissionIds);
|