Add some previously missing GraphQL fields

This commit is contained in:
Timothy Warren 2020-08-03 14:36:14 -04:00
parent a35bce8a4b
commit 78b195f966
8 changed files with 24 additions and 21 deletions

View File

@ -15,6 +15,11 @@ use function Aviat\AnimeClient\getLocalImg;
<td><?= $data['status'] ?></td> <td><?= $data['status'] ?></td>
</tr> </tr>
<tr>
<td>Show Type</td>
<td><?= (strlen($data['show_type']) > 3) ? ucfirst(strtolower($data['show_type'])) : $data['show_type'] ?></td>
</tr>
<?php if ($data['episode_count'] !== 1): ?> <?php if ($data['episode_count'] !== 1): ?>
<tr> <tr>
<td>Episode Count</td> <td>Episode Count</td>

View File

@ -10,18 +10,22 @@
<td class="align-right">Publishing Status</td> <td class="align-right">Publishing Status</td>
<td><?= $data['status'] ?></td> <td><?= $data['status'] ?></td>
</tr> </tr>
<?php /* <tr> <tr>
<td>Manga Type</td> <td>Manga Type</td>
<td><?= ucfirst($data['manga_type']) ?></td> <td><?= ucfirst(strtolower($data['manga_type'])) ?></td>
</tr> </tr>
<?php if ( ! empty($data['volume_count'])): ?>
<tr> <tr>
<td>Volume Count</td> <td>Volume Count</td>
<td><?= $data['volume_count'] ?></td> <td><?= $data['volume_count'] ?></td>
</tr> </tr>
<?php endif ?>
<?php if ( ! empty($data['chapter_count'])): ?>
<tr> <tr>
<td>Chapter Count</td> <td>Chapter Count</td>
<td><?= $data['chapter_count'] ?></td> <td><?= $data['chapter_count'] ?></td>
</tr> */ ?> </tr>
<?php endif ?>
<?php if ( ! empty($data['age_rating'])): ?> <?php if ( ! empty($data['age_rating'])): ?>
<tr> <tr>

View File

@ -107,7 +107,7 @@ query ($slug: String!) {
} }
} }
status status
# subType subtype
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -107,7 +107,7 @@ query ($id: ID!) {
} }
} }
status status
#subType subtype
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -22,8 +22,8 @@ query ($slug: String!) {
title title
} }
} }
# chapterCount chapterCount
# volumeCount volumeCount
characters { characters {
nodes { nodes {
character { character {
@ -105,7 +105,7 @@ query ($slug: String!) {
} }
} }
status status
#subType subtype
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -22,8 +22,8 @@ query ($id: ID!) {
title title
} }
} }
# chapterCount chapterCount
# volumeCount volumeCount
characters { characters {
nodes { nodes {
character { character {
@ -105,7 +105,7 @@ query ($id: ID!) {
} }
} }
status status
#subType subtype
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -36,7 +36,6 @@ final class AnimeTransformer extends AbstractTransformer {
{ {
// TODO: missing GraphQL data: // TODO: missing GraphQL data:
// * streaming links // * streaming links
// * show type
$base = array_key_exists('findAnimeBySlug', $item['data']) $base = array_key_exists('findAnimeBySlug', $item['data'])
? $item['data']['findAnimeBySlug'] ? $item['data']['findAnimeBySlug']
@ -114,7 +113,7 @@ final class AnimeTransformer extends AbstractTransformer {
'id' => $base['id'], 'id' => $base['id'],
'slug' => $base['slug'], 'slug' => $base['slug'],
'staff' => $staff, 'staff' => $staff,
'show_type' => 'TV', // $base['showType'] 'show_type' => $base['subtype'],
'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']), 'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']),
'streaming_links' => [], // Kitsu::parseStreamingLinks($item['included']), 'streaming_links' => [], // Kitsu::parseStreamingLinks($item['included']),
'synopsis' => $base['synopsis']['en'], 'synopsis' => $base['synopsis']['en'],

View File

@ -34,11 +34,6 @@ final class MangaTransformer extends AbstractTransformer {
*/ */
public function transform($item): MangaPage public function transform($item): MangaPage
{ {
// TODO: missing GraphQL data:
// * chapter count
// * volume count
// * manga type
$base = array_key_exists('findMangaBySlug', $item['data']) $base = array_key_exists('findMangaBySlug', $item['data'])
? $item['data']['findMangaBySlug'] ? $item['data']['findMangaBySlug']
: $item['data']['findMangaById']; : $item['data']['findMangaById'];
@ -108,11 +103,11 @@ final class MangaTransformer extends AbstractTransformer {
'age_rating' => $base['ageRating'], 'age_rating' => $base['ageRating'],
'age_rating_guide' => $base['ageRatingGuide'], 'age_rating_guide' => $base['ageRatingGuide'],
'characters' => $characters, 'characters' => $characters,
// 'chapter_count' => $base['chapterCount'], 'chapter_count' => $base['chapterCount'],
// 'volume_count' => $base['volumeCount'], 'volume_count' => $base['volumeCount'],
'cover_image' => $base['posterImage']['views'][1]['url'], 'cover_image' => $base['posterImage']['views'][1]['url'],
'genres' => $genres, 'genres' => $genres,
// 'manga_type' => $base['subType'], 'manga_type' => $base['subtype'],
'id' => $base['id'], 'id' => $base['id'],
'staff' => $staff, 'staff' => $staff,
'status' => Kitsu::getPublishingStatus($base['status'], $base['startDate'], $base['endDate']), 'status' => Kitsu::getPublishingStatus($base['status'], $base['startDate'], $base['endDate']),