feat: GetChapters endpoint + tests
This commit is contained in:
parent
2f615a4936
commit
6667cc224b
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Application\Response;
|
||||
|
||||
readonly class ChapterListResponse
|
||||
{
|
||||
public function __construct(
|
||||
public array $chapters,
|
||||
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;
|
||||
}
|
||||
}
|
||||
15
src/Domain/Manga/Application/Response/ChapterResponse.php
Normal file
15
src/Domain/Manga/Application/Response/ChapterResponse.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Application\Response;
|
||||
|
||||
readonly class ChapterResponse
|
||||
{
|
||||
public function __construct(
|
||||
public string $id,
|
||||
public float $number,
|
||||
public ?string $title,
|
||||
public ?int $volume,
|
||||
public bool $isVisible,
|
||||
public \DateTimeImmutable $createdAt
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user