Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
2 changed files with 6 additions and 4 deletions
Showing only changes of commit da2fa371e5 - Show all commits

View File

@ -220,7 +220,7 @@ class Model {
// 'anime' => 'slug,name,canonicalTitle', // 'anime' => 'slug,name,canonicalTitle',
'characters' => 'slug,name,image' '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' 'characters' => 'slug,name,image'
], ],
'include' => ($type === 'anime') 'include' => ($type === 'anime')
? 'genres,mappings,streamingLinks,animeCharacters.character' ? 'categories,mappings,streamingLinks,animeCharacters.character'
: 'genres,mappings,mangaCharacters.character,castings.character', : 'categories,mappings,mangaCharacters.character,castings.character',
] ]
]; ];

View File

@ -33,8 +33,10 @@ class AnimeTransformer extends AbstractTransformer {
*/ */
public function transform($item) public function transform($item)
{ {
$item['included'] = JsonAPI::organizeIncludes($item['included']); $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']); sort($item['genres']);
$titles = Kitsu::filterTitles($item); $titles = Kitsu::filterTitles($item);