fix user history bugs

This commit is contained in:
Irfan 2022-01-02 01:43:52 +05:00
parent 0618b92b24
commit 3c5e55277f
2 changed files with 12 additions and 2 deletions

View File

@ -467,6 +467,13 @@ class UserController extends Controller
* @OA\Schema(type="string")
* ),
*
* @OA\Parameter(
* name="type",
* in="path",
* required=false,
* @OA\Schema(type="string",enum={"anime", "manga"})
* ),
*
* @OA\Response(
* response="200",
* description="Returns user history (past 30 days)",
@ -482,7 +489,10 @@ class UserController extends Controller
*/
public function history(Request $request, string $username, ?string $type = null)
{
$type = strtolower($type);
if (!is_null($type)) {
$type = strtolower($type);
}
if (!is_null($type) && !\in_array($type, ['anime', 'manga'])) {
return HttpResponse::badRequest($request);
}

View File

@ -2,4 +2,4 @@ Jikan\Model\User\History:
exclusion_policy: NONE
properties:
malUrl:
serialized_name: anime
serialized_name: entry