Merge branch 'master' into feature/scout-typesense

# Conflicts:
#	composer.json
#	composer.lock
This commit is contained in:
pushrbx 2022-05-30 18:47:45 +01:00
commit 84b540f44b
31 changed files with 4164 additions and 3254 deletions

View File

@ -50,6 +50,93 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class AnimeController extends Controller
{
/**
* @OA\Get(
* path="/anime/{id}/full",
* operationId="getAnimeFullById",
* tags={"anime"},
*
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* @OA\Schema(type="integer")
* ),
*
* @OA\Response(
* response="200",
* description="Returns complete anime resource data",
* @OA\JsonContent(
* @OA\Property(
* property="data",
* ref="#/components/schemas/anime_full"
* )
* )
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function full(Request $request, int $id)
{
$results = Anime::query()
->where('mal_id', $id)
->get();
if (
$results->isEmpty()
|| $this->isExpired($request, $results)
) {
$response = Anime::scrape($id);
if (HttpHelper::hasError($response)) {
return HttpResponse::notFound($request);
}
if ($results->isEmpty()) {
$meta = [
'createdAt' => new UTCDateTime(),
'modifiedAt' => new UTCDateTime(),
'request_hash' => $this->fingerprint
];
}
$meta['modifiedAt'] = new UTCDateTime();
$response = $meta + $response;
if ($results->isEmpty()) {
Anime::query()
->insert($response);
}
if ($this->isExpired($request, $results)) {
Anime::query()
->where('mal_id', $id)
->update($response);
}
$results = Anime::query()
->where('mal_id', $id)
->get();
}
if ($results->isEmpty()) {
return HttpResponse::notFound($request);
}
$response = (new \App\Http\Resources\V4\AnimeFullResource(
$results->first()
))->response();
return $this->prepareResponse(
$response,
$results,
$request
);
}
/**
* @OA\Get(
* path="/anime/{id}",

View File

@ -22,6 +22,89 @@ use MongoDB\BSON\UTCDateTime;
class CharacterController extends Controller
{
/**
* @OA\Get(
* path="/characters/{id}/full",
* operationId="getCharacterFullById",
* tags={"characters"},
*
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* @OA\Schema(type="integer")
* ),
*
* @OA\Response(
* response="200",
* description="Returns complete character resource data",
* @OA\JsonContent(
* ref="#/components/schemas/character_full"
* )
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function full(Request $request, int $id)
{
$results = Character::query()
->where('mal_id', $id)
->get();
if (
$results->isEmpty()
|| $this->isExpired($request, $results)
) {
$response = Character::scrape($id);
if (HttpHelper::hasError($response)) {
return HttpResponse::notFound($request);
}
if ($results->isEmpty()) {
$meta = [
'createdAt' => new UTCDateTime(),
'modifiedAt' => new UTCDateTime(),
'request_hash' => $this->fingerprint
];
}
$meta['modifiedAt'] = new UTCDateTime();
$response = $meta + $response;
if ($results->isEmpty()) {
Character::query()
->insert($response);
}
if ($this->isExpired($request, $results)) {
Character::query()
->where('mal_id', $id)
->update($response);
}
$results = Character::query()
->where('mal_id', $id)
->get();
}
if ($results->isEmpty()) {
return HttpResponse::notFound($request);
}
$response = (new \App\Http\Resources\V4\CharacterFullResource(
$results->first()
))->response();
return $this->prepareResponse(
$response,
$results,
$request
);
}
/**
* @OA\Get(

View File

@ -160,7 +160,7 @@ class ClubController extends Controller
|| $this->isExpired($request, $results)
) {
$page = $request->get('page') ?? 1;
$anime = ['results' => $this->jikan->getClubUsers(new UserListRequest($id, $page))];
$anime = $this->jikan->getClubUsers(new UserListRequest($id, $page));
$response = \json_decode($this->serializer->serialize($anime, 'json'), true);
$results = $this->updateCache($request, $results, $response);

View File

@ -23,9 +23,6 @@ class GenreController extends Controller
* operationId="getAnimeGenres",
* tags={"genres"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Parameter(
* name="filter",
* in="query",
@ -87,9 +84,6 @@ class GenreController extends Controller
* operationId="getMangaGenres",
* tags={"genres"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Parameter(
* name="filter",
* in="query",

View File

@ -49,6 +49,92 @@ use mysql_xdevapi\Result;
class MangaController extends Controller
{
/**
* @OA\Get(
* path="/manga/{id}/full",
* operationId="getMangaFullById",
* tags={"manga"},
*
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* @OA\Schema(type="integer")
* ),
*
* @OA\Response(
* response="200",
* description="Returns complete anime resource data",
* @OA\JsonContent(
* ref="#/components/schemas/manga_full"
* )
* ),
*
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function full(Request $request, int $id)
{
$results = Manga::query()
->where('mal_id', $id)
->get();
if (
$results->isEmpty()
|| $this->isExpired($request, $results)
) {
$response = Manga::scrape($id);
if (HttpHelper::hasError($response)) {
return HttpResponse::notFound($request);
}
if ($results->isEmpty()) {
$meta = [
'createdAt' => new UTCDateTime(),
'modifiedAt' => new UTCDateTime(),
'request_hash' => $this->fingerprint
];
}
$meta['modifiedAt'] = new UTCDateTime();
$response = $meta + $response;
if ($results->isEmpty()) {
Manga::query()
->insert($response);
}
if ($this->isExpired($request, $results)) {
Manga::query()
->where('mal_id', $id)
->update($response);
}
$results = Manga::query()
->where('mal_id', $id)
->get();
}
if ($results->isEmpty()) {
return HttpResponse::notFound($request);
}
$response = (new \App\Http\Resources\V4\MangaFullResource(
$results->first()
))->response();
return $this->prepareResponse(
$response,
$results,
$request
);
}
/**
* @OA\Get(
* path="/manga/{id}",

View File

@ -21,6 +21,91 @@ use MongoDB\BSON\UTCDateTime;
class PersonController extends Controller
{
/**
* @OA\Get(
* path="/people/{id}/full",
* operationId="getPersonFullById",
* tags={"people"},
*
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* @OA\Schema(type="integer")
* ),
*
* @OA\Response(
* response="200",
* description="Returns complete character resource data",
* @OA\JsonContent(
* ref="#/components/schemas/person_full"
* )
* ),
*
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function full(Request $request, int $id)
{
$results = Person::query()
->where('mal_id', $id)
->get();
if (
$results->isEmpty()
|| $this->isExpired($request, $results)
) {
$response = Person::scrape($id);
if (HttpHelper::hasError($response)) {
return HttpResponse::notFound($request);
}
if ($results->isEmpty()) {
$meta = [
'createdAt' => new UTCDateTime(),
'modifiedAt' => new UTCDateTime(),
'request_hash' => $this->fingerprint
];
}
$meta['modifiedAt'] = new UTCDateTime();
$response = $meta + $response;
if ($results->isEmpty()) {
Person::query()
->insert($response);
}
if ($this->isExpired($request, $results)) {
Person::query()
->where('mal_id', $id)
->update($response);
}
$results = Person::query()
->where('mal_id', $id)
->get();
}
if ($results->isEmpty()) {
return HttpResponse::notFound($request);
}
$response = (new \App\Http\Resources\V4\PersonFullResource(
$results->first()
))->response();
return $this->prepareResponse(
$response,
$results,
$request
);
}
/**
* @OA\Get(
* path="/people/{id}",

View File

@ -21,6 +21,8 @@ class RecommendationsController extends Controller
* operationId="getRecentAnimeRecommendations",
* tags={"recommendations"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns recent anime recommendations",
@ -70,6 +72,8 @@ class RecommendationsController extends Controller
* operationId="getRecentMangaRecommendations",
* tags={"recommendations"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns recent manga recommendations",

View File

@ -19,42 +19,40 @@ class ReviewsController extends Controller
* operationId="getRecentAnimeReviews",
* tags={"reviews"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
*
* @OA\Response(
* response="200",
* description="Returns recent anime reviews",
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/anime_review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime_meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user_meta",
* ),
* ),
* }
* )
* ),
* )
* }
* )
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/anime_review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime_meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user_meta",
* ),
* ),
* }
* )
* ),
* ),
* )
* ),
* @OA\Response(
@ -98,43 +96,41 @@ class ReviewsController extends Controller
* operationId="getRecentMangaReviews",
* tags={"reviews"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns recent manga reviews",
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/manga_review"),
* @OA\Schema(
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga_meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user_meta",
* ),
* ),
* }
* )
* ),
* )
* }
* )
* )
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/manga_review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/manga_meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user_meta",
* ),
* ),
* }
* )
* ),
* ),
* ),
* ),
* @OA\Response(
* response="400",

View File

@ -46,6 +46,8 @@ class ScheduleController extends Controller
* operationId="getSchedules",
* tags={"schedules"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Parameter(
* name="filter",
* in="query",
@ -70,6 +72,8 @@ class ScheduleController extends Controller
* @OA\Schema(type="string",enum={"true", "false"})
* ),
*
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
* description="Returns weekly schedule",

View File

@ -158,7 +158,7 @@ class SearchController extends Controller
* description="Return entries starting with the given letter",
* @OA\Schema(type="string")
* ),
*
*
* @OA\Parameter(
* name="producers",
* in="query",
@ -166,6 +166,20 @@ class SearchController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(
* name="start_date",
* in="query",
* description="Filter by starting date. Format: YYYY-MM-DD. e.g `2022`, `2005-05`, `2005-01-01`",
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(
* name="start_date",
* in="query",
* description="Filter by ending date. Format: YYYY-MM-DD. e.g `2022`, `2005-05`, `2005-01-01`",
* @OA\Schema(type="string")
* ),
*
* @OA\Response(
* response="200",
* description="Returns search results for anime",
@ -306,6 +320,20 @@ class SearchController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(
* name="start_date",
* in="query",
* description="Filter by starting date. Format: YYYY-MM-DD. e.g `2022`, `2005-05`, `2005-01-01`",
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(
* name="start_date",
* in="query",
* description="Filter by ending date. Format: YYYY-MM-DD. e.g `2022`, `2005-05`, `2005-01-01`",
* @OA\Schema(type="string")
* ),
*
* @OA\Response(
* response="200",
* description="Returns search results for manga",

View File

@ -44,6 +44,8 @@ class SeasonController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns seasonal anime",
@ -62,6 +64,8 @@ class SeasonController extends Controller
* operationId="getSeasonNow",
* tags={"seasons"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns current seasonal anime",
@ -212,6 +216,8 @@ class SeasonController extends Controller
* operationId="getSeasonUpcoming",
* tags={"seasons"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns upcoming season's anime",

View File

@ -48,6 +48,7 @@ class TopController extends Controller
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
@ -118,6 +119,7 @@ class TopController extends Controller
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
@ -174,6 +176,7 @@ class TopController extends Controller
* tags={"top"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
@ -230,6 +233,7 @@ class TopController extends Controller
* tags={"top"},
*
* @OA\Parameter(ref="#/components/parameters/page"),
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",

View File

@ -34,6 +34,89 @@ use MongoDB\BSON\UTCDateTime;
class UserController extends Controller
{
/**
* @OA\Get(
* path="/users/{username}/full",
* operationId="getUserFullProfile",
* tags={"users"},
*
* @OA\Parameter(
* name="username",
* in="path",
* required=true,
* @OA\Schema(type="string")
* ),
*
* @OA\Response(
* response="200",
* description="Returns complete user resource data",
* @OA\JsonContent(
* ref="#/components/schemas/user_profile_full"
* )
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* ),
*/
public function full(Request $request, string $username)
{
$username = strtolower($username);
$results = Profile::query()
->where('internal_username', $username)
->get();
if (
$results->isEmpty()
|| $this->isExpired($request, $results)
) {
$response = Profile::scrape($username);
if ($results->isEmpty()) {
$meta = [
'createdAt' => new UTCDateTime(),
'modifiedAt' => new UTCDateTime(),
'request_hash' => $this->fingerprint,
'internal_username' => $username
];
}
$meta['modifiedAt'] = new UTCDateTime();
$response = $meta + $response;
if ($results->isEmpty()) {
Profile::query()
->insert($response);
}
if ($this->isExpired($request, $results)) {
Profile::query()
->where('internal_username', $username)
->update($response);
}
$results = Profile::query()
->where('internal_username', $username)
->get();
}
if ($results->isEmpty()) {
return HttpResponse::notFound($request);
}
$response = (new \App\Http\Resources\V4\ProfileFullResource(
$results->first()
))->response();
return $this->prepareResponse(
$response,
$results,
$request
);
}
/**
* @OA\Get(
* path="/users/{username}",
@ -541,6 +624,8 @@ class UserController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns user friends",
@ -631,7 +716,7 @@ class UserController extends Controller
* operationId="getUserAnimelist",
* tags={"users"},
* deprecated=true,
* description="Anime lists will be discontinued from May 1st, 2022. <a href='https://docs.google.com/document/d/1-6H-agSnqa8Mfmw802UYfGQrceIEnAaEh4uCXAPiX5A'>Read more</a>",
* description="User Anime lists have been discontinued since May 1st, 2022. <a href='https://docs.google.com/document/d/1-6H-agSnqa8Mfmw802UYfGQrceIEnAaEh4uCXAPiX5A'>Read more</a>",
*
* @OA\Parameter(
* name="username",
@ -708,7 +793,7 @@ class UserController extends Controller
* operationId="getUserMangaList",
* tags={"users"},
* deprecated=true,
* description="Manga lists will be discontinued from May 1st, 2022. <a href='https://docs.google.com/document/d/1-6H-agSnqa8Mfmw802UYfGQrceIEnAaEh4uCXAPiX5A'>Read more</a>",
* description="User Manga lists have been discontinued since May 1st, 2022. <a href='https://docs.google.com/document/d/1-6H-agSnqa8Mfmw802UYfGQrceIEnAaEh4uCXAPiX5A'>Read more</a>",
*
* @OA\Parameter(
* name="username",
@ -793,6 +878,8 @@ class UserController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns user reviews",
@ -901,6 +988,8 @@ class UserController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns Recent Anime Recommendations",
@ -954,6 +1043,8 @@ class UserController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(ref="#/components/parameters/page"),
*
* @OA\Response(
* response="200",
* description="Returns user clubs",

View File

@ -24,6 +24,8 @@ class WatchController extends Controller
* operationId="getWatchRecentEpisodes",
* tags={"watch"},
*
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
* description="Returns Recently Added Episodes",
@ -128,6 +130,8 @@ class WatchController extends Controller
* operationId="getWatchPopularEpisodes",
* tags={"watch"},
*
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
* description="Returns Popular Episodes",
@ -265,6 +269,8 @@ class WatchController extends Controller
* operationId="getWatchPopularPromos",
* tags={"watch"},
*
* @OA\Parameter(ref="#/components/parameters/limit"),
*
* @OA\Response(
* response="200",
* description="Returns Popular Promotional Videos",

View File

@ -112,27 +112,6 @@ class SearchQueryBuilderAnime implements SearchQueryBuilderInterface
$startDate = $request->get('start_date');
$endDate = $request->get('end_date');
if (!empty($query) && is_null($letter)) {
// $results = $results
// ->where('title', 'like', "%{$query}%")
// ->orWhere('title_english', 'like', "%{$query}%")
// ->orWhere('title_japanese', 'like', "%{$query}%")
// ->orWhere('title_synonyms', 'like', "%{$query}%");
// @todo replace with elasticsearch or meilisearch
$results = $results
->whereRaw([
'$text' => [
'$search' => $query
],
], [
'score' => [
'$meta' => 'textScore'
]
])
->orderBy('score', ['$meta' => 'textScore']);
}
if (!is_null($letter)) {
$results = $results
@ -285,6 +264,28 @@ class SearchQueryBuilderAnime implements SearchQueryBuilderInterface
->orderBy($orderBy, $sort ?? 'asc');
}
if (!empty($query) && is_null($letter)) {
// $results = $results
// ->where('title', 'like', "%{$query}%")
// ->orWhere('title_english', 'like', "%{$query}%")
// ->orWhere('title_japanese', 'like', "%{$query}%")
// ->orWhere('title_synonyms', 'like', "%{$query}%");
// @todo replace with elasticsearch or meilisearch
$results = $results
->whereRaw([
'$text' => [
'$search' => $query
],
], [
'score' => [
'$meta' => 'textScore'
]
])
->orderBy('score', ['$meta' => 'textScore']);
}
return $results;
}

View File

@ -40,6 +40,22 @@ class SearchQueryBuilderCharacter implements SearchQueryBuilderInterface
$sort = self::mapSort($request->get('sort'));
$letter = $request->get('letter');
if (!is_null($letter)) {
$results = $results
->where('name', 'like', "{$letter}%");
}
if (empty($query) && is_null($orderBy)) {
$results = $results
->orderBy('mal_id');
}
if (!is_null($orderBy)) {
$results = $results
->orderBy($orderBy, $sort ?? 'asc');
}
if (!empty($query) && is_null($letter)) {
// $results = $results
@ -59,22 +75,6 @@ class SearchQueryBuilderCharacter implements SearchQueryBuilderInterface
->orderBy('score', ['$meta' => 'textScore']);
}
if (!is_null($letter)) {
$results = $results
->where('name', 'like', "{$letter}%");
}
if (empty($query) && is_null($orderBy)) {
$results = $results
->orderBy('mal_id');
}
if (!is_null($orderBy)) {
$results = $results
->orderBy($orderBy, $sort ?? 'asc');
}
return $results;
}

View File

@ -88,26 +88,6 @@ class SearchQueryBuilderManga implements SearchQueryBuilderInterface
$startDate = $request->get('start_date');
$endDate = $request->get('end_date');
if (!empty($query) && is_null($letter)) {
// $results = $results
// ->where('title', 'like', "%{$query}%")
// ->orWhere('title_english', 'like', "%{$query}%")
// ->orWhere('title_japanese', 'like', "%{$query}%")
// ->orWhere('title_synonyms', 'like', "%{$query}%");
$results = $results
->whereRaw([
'$text' => [
'$search' => $query
],
], [
'score' => [
'$meta' => 'textScore'
]
])
->orderBy('score', ['$meta' => 'textScore']);
}
if (!is_null($letter)) {
$results = $results
->where('title', 'like', "{$letter}%");
@ -249,6 +229,26 @@ class SearchQueryBuilderManga implements SearchQueryBuilderInterface
->orderBy($orderBy, $sort ?? 'asc');
}
if (!empty($query) && is_null($letter)) {
// $results = $results
// ->where('title', 'like', "%{$query}%")
// ->orWhere('title_english', 'like', "%{$query}%")
// ->orWhere('title_japanese', 'like', "%{$query}%")
// ->orWhere('title_synonyms', 'like', "%{$query}%");
$results = $results
->whereRaw([
'$text' => [
'$search' => $query
],
], [
'score' => [
'$meta' => 'textScore'
]
])
->orderBy('score', ['$meta' => 'textScore']);
}
return $results;
}

View File

@ -41,6 +41,21 @@ class SearchQueryBuilderPeople implements SearchQueryBuilderInterface
$sort = self::mapSort($request->get('sort'));
$letter = $request->get('letter');
if (!is_null($letter)) {
$results = $results
->where('name', 'like', "{$letter}%");
}
if (empty($query) && is_null($orderBy)) {
$results = $results
->orderBy('mal_id');
}
if (!is_null($orderBy)) {
$results = $results
->orderBy($orderBy, $sort ?? 'asc');
}
if (!empty($query) && is_null($letter)) {
// $results = $results
@ -62,21 +77,6 @@ class SearchQueryBuilderPeople implements SearchQueryBuilderInterface
->orderBy('score', ['$meta' => 'textScore']);
}
if (!is_null($letter)) {
$results = $results
->where('name', 'like', "{$letter}%");
}
if (empty($query) && is_null($orderBy)) {
$results = $results
->orderBy('mal_id');
}
if (!is_null($orderBy)) {
$results = $results
->orderBy($orderBy, $sort ?? 'asc');
}
return $results;
}

View File

@ -0,0 +1,340 @@
<?php
namespace App\Http\Resources\V4;
use Illuminate\Http\Resources\Json\JsonResource;
class AnimeFullResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime_full",
* description="Full anime Resource",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="images",
* ref="#/components/schemas/anime_images"
* ),
* @OA\Property(
* property="trailer",
* ref="#/components/schemas/trailer_base"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="title_english",
* type="string",
* description="English Title",
* nullable=true
* ),
* @OA\Property(
* property="title_japanese",
* type="string",
* description="Japanese Title",
* nullable=true
* ),
* @OA\Property(
* property="title_synonyms",
* type="array",
* description="Other Titles",
* @OA\Items(
* type="string"
* )
* ),
* @OA\Property(
* property="type",
* type="string",
* enum={"TV","OVA","Movie","Special","ONA","Music"},
* description="Anime Type",
* nullable=true
* ),
* @OA\Property(
* property="source",
* type="string",
* description="Original Material/Source adapted from",
* nullable=true
* ),
* @OA\Property(
* property="episodes",
* type="integer",
* description="Episode count",
* nullable=true
* ),
* @OA\Property(
* property="status",
* type="string",
* enum={"Finished Airing", "Currently Airing", "Not yet aired"},
* description="Airing status",
* nullable=true
* ),
* @OA\Property(
* property="airing",
* type="boolean",
* description="Airing boolean"
* ),
* @OA\Property(
* property="aired",
* ref="#/components/schemas/daterange"
* ),
* @OA\Property(
* property="duration",
* type="string",
* description="Parsed raw duration",
* nullable=true
* ),
* @OA\Property(
* property="rating",
* type="string",
* enum={"G - All Ages", "PG - Children", "PG-13 - Teens 13 or older", "R - 17+ (violence & profanity)", "R+ - Mild Nudity", "Rx - Hentai" },
* description="Anime audience rating",
* nullable=true
* ),
* @OA\Property(
* property="score",
* type="number",
* format="float",
* description="Score",
* nullable=true
* ),
* @OA\Property(
* property="scored_by",
* type="integer",
* description="Number of users",
* nullable=true
* ),
* @OA\Property(
* property="rank",
* type="integer",
* description="Ranking",
* nullable=true
* ),
* @OA\Property(
* property="popularity",
* type="integer",
* description="Popularity",
* nullable=true
* ),
* @OA\Property(
* property="members",
* type="integer",
* description="Number of users who have added this entry to their list",
* nullable=true
* ),
* @OA\Property(
* property="favorites",
* type="integer",
* description="Number of users who have favorited this entry",
* nullable=true
* ),
* @OA\Property(
* property="synopsis",
* type="string",
* description="Synopsis",
* nullable=true
* ),
* @OA\Property(
* property="background",
* type="string",
* description="Background",
* nullable=true
* ),
* @OA\Property(
* property="season",
* type="string",
* enum={"Summer", "Winter", "Spring", "Fall"},
* description="Season",
* nullable=true
* ),
* @OA\Property(
* property="year",
* type="integer",
* description="Year",
* nullable=true
* ),
* @OA\Property(
* property="broadcast",
* ref="#/components/schemas/broadcast"
* ),
* @OA\Property(
* property="producers",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="licensors",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="studios",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="genres",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="explicit_genres",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="themes",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="demographics",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
*
* @OA\Property(
* property="relations",
* type="array",
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="relation",
* type="string",
* description="Relation type"
* ),
* @OA\Property(
* property="entry",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* )
* )
* ),
*
* @OA\Property(
* property="theme",
* type="object",
* @OA\Property(
* property="openings",
* type="array",
* @OA\Items(
* type="string",
* ),
* ),
* @OA\Property(
* property="endings",
* type="array",
* @OA\Items(
* type="string",
* ),
* ),
* ),
*
* @OA\Property(
* property="external",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="name",
* type="string",
* ),
* @OA\Property(
* property="url",
* type="string",
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'mal_id' => $this->mal_id,
'url' => $this->url,
'images' => $this->images,
'trailer' => $this->trailer,
'title' => $this->title,
'title_english' => $this->title_english,
'title_japanese' => $this->title_japanese,
'title_synonyms' => $this->title_synonyms,
'type' => $this->type,
'source' => $this->source,
'episodes' => $this->episodes,
'status' => $this->status,
'airing' => $this->airing,
'aired' => $this->aired,
'duration' => $this->duration,
'rating' => $this->rating,
'score' => $this->score,
'scored_by' => $this->scored_by,
'rank' => $this->rank,
'popularity' => $this->popularity,
'members' => $this->members,
'favorites' => $this->favorites,
'synopsis' => $this->synopsis,
'background' => $this->background,
'season' => $this->season,
'year' => $this->year,
'broadcast' => $this->broadcast,
'producers' => $this->producers,
'licensors' => $this->licensors,
'studios' => $this->studios,
'genres' => $this->genres,
'explicit_genres' => $this->explicit_genres,
'themes' => $this->themes,
'demographics' => $this->demographics,
'relations' => $this->related,
'theme' => [
'openings' => $this->opening_themes,
'endings' => $this->ending_themes
],
'external' => $this->external_links,
];
}
}

View File

@ -0,0 +1,144 @@
<?php
namespace App\Http\Resources\V4;
use Illuminate\Http\Resources\Json\JsonResource;
class CharacterFullResource extends JsonResource
{
/**
* @OA\Schema(
* schema="character_full",
* description="Character Resource",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="images",
* ref="#/components/schemas/character_images"
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Name"
* ),
* @OA\Property(
* property="name_kanji",
* type="string",
* description="Name",
* nullable=true
* ),
* @OA\Property(
* property="nicknames",
* type="array",
* description="Other Names",
* @OA\Items(
* type="string"
* )
* ),
* @OA\Property(
* property="favorites",
* type="integer",
* description="Number of users who have favorited this entry"
* ),
* @OA\Property(
* property="about",
* type="string",
* description="Biography",
* nullable=true
* ),
*
* @OA\Property(
* property="anime",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="role",
* type="string",
* description="Character's Role"
* ),
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime_meta"
* ),
* ),
* ),
*
* @OA\Property(
* property="manga",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="role",
* type="string",
* description="Character's Role"
* ),
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga_meta"
* ),
* ),
* ),
*
* @OA\Property(
* property="voices",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="language",
* type="string",
* description="Character's Role"
* ),
* @OA\Property(
* property="person",
* type="object",
* ref="#/components/schemas/person_meta"
* ),
* ),
* ),
*
* )
*/
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'mal_id' => $this->mal_id,
'url' => $this->url,
'images' => $this->images,
'name' => $this->name,
'name_kanji' => $this->name_kanji,
'nicknames' => $this->nicknames,
'favorites' => $this->favorites,
'about' => $this->about,
'anime' => $this->animeography,
'manga' => $this->mangaography,
'voices' => $this->voice_actors,
];
}
}

View File

@ -0,0 +1,266 @@
<?php
namespace App\Http\Resources\V4;
use Illuminate\Http\Resources\Json\JsonResource;
class MangaFullResource extends JsonResource
{
/**
* @OA\Schema(
* schema="manga_full",
* description="Manga Resource",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="images",
* ref="#/components/schemas/manga_images"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="title_english",
* type="string",
* description="English Title",
* nullable=true
* ),
* @OA\Property(
* property="title_japanese",
* type="string",
* description="Japanese Title",
* nullable=true
* ),
* @OA\Property(
* property="title_synonyms",
* type="array",
* description="Other Titles",
* @OA\Items(
* type="string"
* )
* ),
* @OA\Property(
* property="type",
* type="string",
* enum={"Manga", "Novel", "One-shot", "Doujinshi", "Manhua", "Manhwa", "OEL"},
* description="Manga Type",
* nullable=true
* ),
* @OA\Property(
* property="chapters",
* type="integer",
* description="Chapter count",
* nullable=true
* ),
* @OA\Property(
* property="volumes",
* type="integer",
* description="Volume count",
* nullable=true
* ),
* @OA\Property(
* property="status",
* type="string",
* enum={"Finished", "Publishing", "On Hiatus", "Discontinued", "Not yet published"},
* description="Publishing status"
* ),
* @OA\Property(
* property="publishing",
* type="boolean",
* description="Publishing boolean"
* ),
* @OA\Property(
* property="published",
* ref="#/components/schemas/daterange"
* ),
* @OA\Property(
* property="score",
* type="number",
* format="float",
* description="Score"
* ),
* @OA\Property(
* property="scored_by",
* type="integer",
* description="Number of users"
* ),
* @OA\Property(
* property="rank",
* type="integer",
* description="Ranking",
* nullable=true
* ),
* @OA\Property(
* property="popularity",
* type="integer",
* description="Popularity",
* nullable=true
* ),
* @OA\Property(
* property="members",
* type="integer",
* description="Number of users who have added this entry to their list",
* nullable=true
* ),
* @OA\Property(
* property="favorites",
* type="integer",
* description="Number of users who have favorited this entry",
* nullable=true
* ),
* @OA\Property(
* property="synopsis",
* type="string",
* description="Synopsis",
* nullable=true
* ),
* @OA\Property(
* property="background",
* type="string",
* description="Background",
* nullable=true
* ),
* @OA\Property(
* property="authors",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="serializations",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="genres",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="explicit_genres",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="themes",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
* @OA\Property(
* property="demographics",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* ),
*
* @OA\Property(
* property="relations",
* type="array",
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="relation",
* type="string",
* description="Relation type"
* ),
* @OA\Property(
* property="entry",
* type="array",
* @OA\Items(
* type="object",
* ref="#/components/schemas/mal_url"
* ),
* )
* )
* ),
*
* @OA\Property(
* property="external",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="name",
* type="string",
* ),
* @OA\Property(
* property="url",
* type="string",
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'mal_id' => $this->mal_id,
'url' => $this->url,
'images' => $this->images,
'title' => $this->title,
'title_english' => $this->title_english,
'title_japanese' => $this->title_japanese,
'title_synonyms' => $this->title_synonyms,
'type' => $this->type,
'chapters' => $this->chapters,
'volumes' => $this->volumes,
'status' => $this->status,
'publishing' => $this->publishing,
'published' => $this->published,
'score' => $this->score,
'scored' => $this->score, // @todo remove in 4.1
'scored_by' => $this->scored_by,
'rank' => $this->rank,
'popularity' => $this->popularity,
'members' => $this->members,
'favorites' => $this->favorites,
'synopsis' => $this->synopsis,
'background' => $this->background,
'authors' => $this->authors,
'serializations' => $this->serializations,
'genres' => $this->genres,
'explicit_genres' => $this->explicit_genres,
'themes' => $this->themes,
'demographics' => $this->demographics,
'relations' => $this->related,
'external' => $this->external_links,
];
}
}

View File

@ -0,0 +1,173 @@
<?php
namespace App\Http\Resources\V4;
use Illuminate\Http\Resources\Json\JsonResource;
class PersonFullResource extends JsonResource
{
/**
* @OA\Schema(
* schema="person_full",
* description="Person Resource",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="website_url",
* type="string",
* description="Person's website URL",
* nullable=true
* ),
* @OA\Property(
* property="images",
* type="object",
* ref="#/components/schemas/people_images",
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Name"
* ),
* @OA\Property(
* property="given_name",
* type="string",
* description="Given Name",
* nullable=true
* ),
* @OA\Property(
* property="family_name",
* type="string",
* description="Family Name",
* nullable=true
* ),
* @OA\Property(
* property="alternate_names",
* type="array",
* description="Other Names",
* @OA\Items(
* type="string"
* )
* ),
* @OA\Property(
* property="birthday",
* type="string",
* description="Birthday Date ISO8601",
* nullable=true
* ),
* @OA\Property(
* property="favorites",
* type="integer",
* description="Number of users who have favorited this entry"
* ),
* @OA\Property(
* property="about",
* type="string",
* description="Biography",
* nullable=true
* ),
*
* @OA\Property(
* property="anime",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="position",
* type="string",
* description="Person's position"
* ),
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime_meta"
* ),
* ),
* ),
*
* @OA\Property(
* property="manga",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="position",
* type="string",
* description="Person's position"
* ),
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga_meta"
* ),
* ),
* ),
*
* @OA\Property(
* property="voices",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="role",
* type="string",
* description="Person's Character's role in the anime"
* ),
* @OA\Property(
* property="anime",
* type="object",
* description="The anime in which the person is voice acting in",
* ref="#/components/schemas/anime_meta"
* ),
* @OA\Property(
* property="character",
* type="object",
* description="The character the person is voice acting for",
* ref="#/components/schemas/character_meta"
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'mal_id' => $this->mal_id,
'url' => $this->url,
'website_url' => $this->website_url,
'images' => $this->images,
'name' => $this->name,
'given_name' => $this->given_name,
'family_name' => $this->family_name,
'alternate_names' => $this->alternate_names,
'birthday' => $this->birthday,
'favorites' => $this->favorites,
'about' => $this->about,
'anime' => $this->anime_staff_positions,
'manga' => $this->published_manga,
'voices' => $this->voice_acting_roles,
];
}
}

View File

@ -0,0 +1,220 @@
<?php
namespace App\Http\Resources\V4;
use Illuminate\Http\Resources\Json\JsonResource;
class ProfileFullResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*
*
* @OA\Schema(
* schema="user_profile_full",
* type="object",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID",
* nullable=true
* ),
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="images",
* type="object",
* ref="#/components/schemas/user_images"
* ),
* @OA\Property(
* property="last_online",
* type="string",
* description="Last Online Date ISO8601",
* nullable=true
* ),
* @OA\Property(
* property="gender",
* type="string",
* description="User Gender",
* nullable=true
* ),
* @OA\Property(
* property="birthday",
* type="string",
* description="Birthday Date ISO8601",
* nullable=true
* ),
* @OA\Property(
* property="location",
* type="string",
* description="Location",
* nullable=true
* ),
* @OA\Property(
* property="joined",
* type="string",
* description="Joined Date ISO8601",
* nullable=true
* ),
*
* @OA\Property(
* property="statistics",
* type="object",
* @OA\Property(
* property="anime",
* type="object",
* description="Anime Statistics",
* @OA\Property(
* property="days_watched",
* type="number",
* format="float",
* description="Number of days spent watching Anime"
* ),
* @OA\Property(
* property="mean_score",
* type="number",
* format="float",
* description="Mean Score"
* ),
* @OA\Property(
* property="watching",
* type="integer",
* description="Anime Watching"
* ),
* @OA\Property(
* property="completed",
* type="integer",
* description="Anime Completed"
* ),
* @OA\Property(
* property="on_hold",
* type="integer",
* description="Anime On-Hold"
* ),
* @OA\Property(
* property="dropped",
* type="integer",
* description="Anime Dropped"
* ),
* @OA\Property(
* property="plan_to_watch",
* type="integer",
* description="Anime Planned to Watch"
* ),
* @OA\Property(
* property="total_entries",
* type="integer",
* description="Total Anime entries on User list"
* ),
* @OA\Property(
* property="rewatched",
* type="integer",
* description="Anime re-watched"
* ),
* @OA\Property(
* property="episodes_watched",
* type="integer",
* description="Number of Anime Episodes Watched"
* ),
* ),
* @OA\Property(
* property="manga",
* type="object",
* description="Manga Statistics",
* @OA\Property(
* property="days_read",
* type="number",
* format="float",
* description="Number of days spent reading Manga"
* ),
* @OA\Property(
* property="mean_score",
* type="number",
* format="float",
* description="Mean Score"
* ),
* @OA\Property(
* property="reading",
* type="integer",
* description="Manga Reading"
* ),
* @OA\Property(
* property="completed",
* type="integer",
* description="Manga Completed"
* ),
* @OA\Property(
* property="on_hold",
* type="integer",
* description="Manga On-Hold"
* ),
* @OA\Property(
* property="dropped",
* type="integer",
* description="Manga Dropped"
* ),
* @OA\Property(
* property="plan_to_read",
* type="integer",
* description="Manga Planned to Read"
* ),
* @OA\Property(
* property="total_entries",
* type="integer",
* description="Total Manga entries on User list"
* ),
* @OA\Property(
* property="reread",
* type="integer",
* description="Manga re-read"
* ),
* @OA\Property(
* property="chapters_read",
* type="integer",
* description="Number of Manga Chapters Read"
* ),
* @OA\Property(
* property="volumes_read",
* type="integer",
* description="Number of Manga Volumes Read"
* ),
* ),
* ),
* ),
*
* ),
*/
public function toArray($request)
{
return [
'mal_id' => $this->mal_id,
'username' => $this->username,
'url' => $this->url,
'images' => $this->images,
'last_online' => $this->last_online,
'gender' => $this->gender,
'birthday' => $this->birthday,
'location' => $this->location,
'joined' => $this->joined,
'statistics' => [
'anime'=> $this->anime_stats,
'manga'=> $this->manga_stats,
],
'favorites' => $this->favorites,
'updates' => $this->last_updates,
'about' => $this->about,
];
}
}

View File

@ -55,7 +55,7 @@ class UserProfileAnimeListResource extends JsonResource
'watching_status' => $this['watching_status'],
'score' => $this['score'],
'episodes_watched' => $this['watched_episodes'],
'tags' => $this['tags'],
'tags' => (string) $this['tags'],
'is_rewatching' => $this['is_rewatching'],
'watch_start_date' => $this['watch_start_date'],
'watch_end_date' => $this['watch_end_date'],

View File

@ -57,7 +57,7 @@ class UserProfileMangaListResource extends JsonResource
'score' => $this['score'],
'chapters_read' => $this['read_chapters'],
'volumes_read' => $this['read_volumes'],
'tags' => $this['tags'],
'tags' => (string) $this['tags'],
'is_rereading' => $this['is_rereading'],
'read_start_date' => $this['read_start_date'],
'read_end_date' => $this['read_end_date'],

View File

@ -5,23 +5,22 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"ext-json": "*",
"ext-mongodb": "*",
"amphp/http-client": "^4.6",
"danielmewes/php-rql": "dev-master",
"darkaonline/swagger-lume": "8.*",
"divineomega/cachetphp": "^0.2.0",
"darkaonline/swagger-lume": "^9.0",
"fabpot/goutte": "^4.0",
"flipbox/lumen-generator": "^8",
"illuminate/redis": "^8",
"flipbox/lumen-generator": "^9.0",
"illuminate/redis": "^9.0",
"jenssegers/mongodb": "^3.8",
"jikan-me/jikan": "3.0.0.x-dev",
"jikan-me/jikan": "^3",
"jms/serializer": "^3.0",
"laravel/legacy-factories": "^1.1",
"laravel/lumen-framework": "^8.0",
"laravel/lumen-framework": "^9.0",
"league/flysystem": "^3.0",
"laravel/scout": "^9.4",
"league/flysystem": "^1.0",
"ocramius/package-versions": "^2.5",
"php-http/guzzle6-adapter": "^2.0",
"predis/predis": "^1.1",

4280
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -211,23 +211,23 @@ return [
*/
'UserController@recentlyOnline' => [
'table_name' => 'users_recently_online',
'ttl' => env('CACHE_USERS_RECENTLY_ONLINE')
'ttl' => env('CACHE_DEFAULT_EXPIRE')
],
'UserController@profile' => [
'table_name' => 'users',
'ttl' => env('CACHE_DEFAULT_EXPIRE')
'ttl' => env('CACHE_USER_EXPIRE')
],
'UserController@statistics' => [
'table_name' => 'users',
'ttl' => env('CACHE_DEFAULT_EXPIRE')
'ttl' => env('CACHE_USER_EXPIRE')
],
'UserController@favorites' => [
'table_name' => 'users',
'ttl' => env('CACHE_DEFAULT_EXPIRE')
'ttl' => env('CACHE_USER_EXPIRE')
],
'UserController@about' => [
'table_name' => 'users',
'ttl' => env('CACHE_DEFAULT_EXPIRE')
'ttl' => env('CACHE_USER_EXPIRE')
],
'UserController@history' => [
'table_name' => 'users_history',

View File

@ -226,20 +226,24 @@ return [
## Caching
By **CACHING**, we refer to the data parsed from MyAnimeList which is stored temporarily on our servers to provide better API performance.
All requests, by default are cached for **24 hours** except the following endpoints which have their own unique cache **Time To Live**.
All requests, by default are cached for **24 hours** except the following endpoints which have their own unique cache **Time To Live**.
| Request | TTL |
| ---- | ---- |
| All (Default) | 24 hours |
| User Anime/Manga List | 5 minutes |
The following response headers will detail cache information.
| Header | Remarks |
| ---- | ---- |
| `Expires` | Expiry unix timestamp |
| `Expires` | Cache expiry date |
| `Last-Modified` | Cache set date |
| `X-Request-Fingerprint` | Unique request fingerprint |
Note: Caching headers will only be available on single resource requests and their child endpoints. e.g `/anime/1`, `/anime/1/relations`.
They won't be available on pages which perform queries, like /anime, or /top/anime, etc.
## Allowed HTTP(s) requests

View File

@ -35,6 +35,10 @@ $router->group(
'uses' => 'AnimeController@main'
]);
$router->get('/full', [
'uses' => 'AnimeController@full'
]);
$router->get('/characters', [
'uses' => 'AnimeController@characters'
]);
@ -114,6 +118,10 @@ $router->group(
'uses' => 'MangaController@main'
]);
$router->get('/full', [
'uses' => 'MangaController@full'
]);
$router->get('/characters', [
'uses' => 'MangaController@characters'
]);
@ -173,6 +181,10 @@ $router->group(
'uses' => 'CharacterController@main'
]);
$router->get('/full', [
'uses' => 'CharacterController@full'
]);
$router->get('/anime', [
'uses' => 'CharacterController@anime'
]);
@ -203,6 +215,10 @@ $router->group(
'uses' => 'PersonController@main'
]);
$router->get('/full', [
'uses' => 'PersonController@full'
]);
$router->get('/anime', [
'uses' => 'PersonController@anime'
]);
@ -298,6 +314,10 @@ $router->group(
'uses' => 'UserController@profile'
]);
$router->get('/full', [
'uses' => 'UserController@full'
]);
$router->get('/statistics', [
'uses' => 'UserController@statistics'
]);
@ -318,7 +338,7 @@ $router->group(
'uses' => 'UserController@history'
]);
$router->get('/friends[/{page:[0-9]+}]', [
$router->get('/friends', [
'uses' => 'UserController@friends'
]);

File diff suppressed because it is too large Load Diff