From 034213fccc6e6db69f7053bc9ac137a8b2372bc3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 20 Sep 2018 10:41:28 -0400 Subject: [PATCH] Progress with simultaneous updates to Anilist for Anime --- app/appConf/routes.php | 8 +++ app/bootstrap.php | 2 +- app/views/anime/edit.php | 8 ++- app/views/collection/cover.php | 3 +- app/views/collection/list.php | 3 +- app/views/main-menu.php | 36 +++++----- public/js/scripts-authed.min.js | 35 +++++----- public/js/scripts-authed.min.js.map | 2 +- public/js/scripts.min.js | 19 +++--- public/js/scripts.min.js.map | 2 +- public/js/src/anime.js | 2 +- public/tools/build-js.js | 2 +- src/API/Anilist/AnilistTrait.php | 54 +++++++++++++++ .../Mutations/CreateMediaListEntry.graphql | 9 +++ .../Mutations/DeleteMediaListEntry.graphql | 7 ++ .../Mutations/IncrementMediaListEntry.graphql | 12 ++++ .../Mutations/UpdateAnimeListEntry.graphql | 15 ----- .../Mutations/UpdateMediaListEntry.graphql | 27 ++++++++ .../GraphQL/Queries/AnimeIdByMalId.graphql | 5 -- .../GraphQL/Queries/ListItemIdByMalId.graphql | 9 +++ .../GraphQL/Queries/MediaIdByMalId.graphql | 7 ++ .../GraphQL/Queries/MediaListItem.graphql | 14 ++++ src/API/Anilist/ListItem.php | 55 ++++++++++++---- src/API/Anilist/Model.php | 66 +++++++++++++++---- .../Transformer/AnimeListTransformer.php | 8 ++- src/API/Kitsu/ListItem.php | 5 ++ src/API/Kitsu/Model.php | 11 ++++ .../Transformer/AnimeListTransformer.php | 2 +- src/API/ListItemInterface.php | 9 +++ src/Controller.php | 4 +- src/Controller/Anime.php | 30 +++++++-- src/MenuGenerator.php | 6 +- src/Model/Anime.php | 58 +++++++++++++++- src/Types/AnimeListItem.php | 5 +- src/Types/Config.php | 2 + src/Types/FormItem.php | 1 + 36 files changed, 428 insertions(+), 115 deletions(-) create mode 100644 src/API/Anilist/GraphQL/Mutations/CreateMediaListEntry.graphql create mode 100644 src/API/Anilist/GraphQL/Mutations/DeleteMediaListEntry.graphql create mode 100644 src/API/Anilist/GraphQL/Mutations/IncrementMediaListEntry.graphql delete mode 100644 src/API/Anilist/GraphQL/Mutations/UpdateAnimeListEntry.graphql create mode 100644 src/API/Anilist/GraphQL/Mutations/UpdateMediaListEntry.graphql delete mode 100644 src/API/Anilist/GraphQL/Queries/AnimeIdByMalId.graphql create mode 100644 src/API/Anilist/GraphQL/Queries/ListItemIdByMalId.graphql create mode 100644 src/API/Anilist/GraphQL/Queries/MediaIdByMalId.graphql create mode 100644 src/API/Anilist/GraphQL/Queries/MediaListItem.graphql diff --git a/app/appConf/routes.php b/app/appConf/routes.php index db05b416..067bbce7 100644 --- a/app/appConf/routes.php +++ b/app/appConf/routes.php @@ -238,6 +238,14 @@ return [ 'action' => 'logout', 'controller' => DEFAULT_CONTROLLER, ], + 'increment' => [ + 'path' => '/{controller}/increment', + 'action' => 'increment', + 'verb' => 'post', + 'tokens' => [ + 'controller' => '[a-z_]+', + ], + ], 'update' => [ 'path' => '/{controller}/update', 'action' => 'update', diff --git a/app/bootstrap.php b/app/bootstrap.php index 1c1c224b..d949fc3d 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -35,7 +35,7 @@ use Zend\Diactoros\{Response, ServerRequestFactory}; // ----------------------------------------------------------------------------- // Setup DI container // ----------------------------------------------------------------------------- -return function (array $configArray = []) { +return function ($configArray = []) { $container = new Container(); // ------------------------------------------------------------------------- diff --git a/app/views/anime/edit.php b/app/views/anime/edit.php index 8dcd62b2..12f367e5 100644 --- a/app/views/anime/edit.php +++ b/app/views/anime/edit.php @@ -79,7 +79,9 @@   - + + + @@ -100,7 +102,9 @@ - + + + diff --git a/app/views/collection/cover.php b/app/views/collection/cover.php index 7441f79b..429754ab 100644 --- a/app/views/collection/cover.php +++ b/app/views/collection/cover.php @@ -9,9 +9,8 @@ $items): ?> type="radio" id="collection-tab-" name="collection-tabs" /> - +
-

diff --git a/app/views/collection/list.php b/app/views/collection/list.php index e0a1ab9a..3f87b152 100644 --- a/app/views/collection/list.php +++ b/app/views/collection/list.php @@ -10,9 +10,8 @@ $items): ?> type="radio" id="collection-tab-" name="collection-tabs"/> - +
-

diff --git a/app/views/main-menu.php b/app/views/main-menu.php index 647076f0..efc03916 100644 --- a/app/views/main-menu.php +++ b/app/views/main-menu.php @@ -43,6 +43,11 @@ $hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE; [a($urlGenerator->defaultUrl('anime') . $extraSegment, 'Anime List') ?>] [a($urlGenerator->defaultUrl('manga') . $extraSegment, 'Manga List') ?>] + isAuthenticated()): ?> + + + + [a( @@ -51,24 +56,25 @@ $hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE; ) ?>]isAuthenticated()): ?> -   - + a( + $url->generate('settings'), + 'Settings', + ['class' => 'bracketed'] + ) ?> + + + a( + $url->generate('logout'), + 'Logout', + ['class' => 'bracketed'] + ) ?> + + + + [a($url->generate('login'), "{$whose} Login") ?>] -   - - - isAuthenticated()): ?> - a( - $url->generate('logout'), - 'Logout', - ['class' => 'bracketed'] - ) ?> - - [a($url->generate('login'), "{$whose} Login") ?>] - -