Update some api calls based on api changes

This commit is contained in:
Timothy Warren 2017-09-12 12:18:31 -04:00
parent d93d22f7df
commit 372b616101
2 changed files with 6 additions and 4 deletions

View File

@ -220,7 +220,7 @@ class Model {
// 'anime' => 'slug,name,canonicalTitle',
'characters' => 'slug,name,image'
],
'include' => 'waifu,pinnedPost,blocks,linkedAccounts,profileLinks,profileLinks.profileLinkSite,mediaFollows,userRoles,favorites.item'
'include' => 'waifu,pinnedPost,blocks,linkedAccounts,profileLinks,profileLinks.profileLinkSite,userRoles,favorites.item'
]
]);
@ -878,8 +878,8 @@ class Model {
'characters' => 'slug,name,image'
],
'include' => ($type === 'anime')
? 'genres,mappings,streamingLinks,animeCharacters.character'
: 'genres,mappings,mangaCharacters.character,castings.character',
? 'categories,mappings,streamingLinks,animeCharacters.character'
: 'categories,mappings,mangaCharacters.character,castings.character',
]
];

View File

@ -33,8 +33,10 @@ class AnimeTransformer extends AbstractTransformer {
*/
public function transform($item)
{
$item['included'] = JsonAPI::organizeIncludes($item['included']);
$item['genres'] = array_column($item['included']['genres'], 'name') ?? [];
$genres = $item['included']['categories'] ?? [];
$item['genres'] = array_column($genres, 'title') ?? [];
sort($item['genres']);
$titles = Kitsu::filterTitles($item);