feat: GetMangaList endpoint + tests + test db
This commit is contained in:
parent
073439163b
commit
e3d380eadd
28
src/Domain/Manga/Application/Response/MangaListResponse.php
Normal file
28
src/Domain/Manga/Application/Response/MangaListResponse.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Application\Response;
|
||||
|
||||
readonly class MangaListResponse
|
||||
{
|
||||
public function __construct(
|
||||
public array $mangas,
|
||||
public int $total,
|
||||
public int $page,
|
||||
public int $limit
|
||||
) {}
|
||||
|
||||
public function getTotalPages(): int
|
||||
{
|
||||
return (int) ceil($this->total / $this->limit);
|
||||
}
|
||||
|
||||
public function hasNextPage(): bool
|
||||
{
|
||||
return $this->page < $this->getTotalPages();
|
||||
}
|
||||
|
||||
public function hasPreviousPage(): bool
|
||||
{
|
||||
return $this->page > 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user