Discovery AniList client: drop removed recommendations (BL-0051)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e7b1ca49f
commit
60a25bacac
2 files changed
+10
-1
No files matched your search
@@ -136,7 +136,9 @@ function createClient({ endpoint = process.env.DISCOVERY_ANILIST_URL || 'https:/
|
||||
},
|
||||
async recs(id) {
|
||||
const nodes = mediaOf(await post(QUERIES.recs, { id })).recommendations?.nodes;
|
||||
return entries(nodes, node => node.mediaRecommendation).filter(({ item }) => item.rating > 0)
|
||||
// AniList returns a null mediaRecommendation when the recommended media was removed: valid, just drop it.
|
||||
const present = need(nodes).filter(node => !isObject(node) || node.mediaRecommendation !== null);
|
||||
return entries(present, node => node.mediaRecommendation).filter(({ item }) => item.rating > 0)
|
||||
.map(({ item, record }) => ({ anilistId: record.anilistId, rating: item.rating, record }));
|
||||
},
|
||||
async creator(staffId) {
|
||||
|
||||
Reference in new issue
Block a user