1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Added contents to book-show endpoint

Created a generic list formatting helper class for this, to align with
logic used on the search results endpoint and for easier future re-use
in a standardised way.
Also updated some class property types.
Added test to cover new books-contents results.
Related to #3734
This commit is contained in:
Dan Brown
2022-09-29 15:05:57 +01:00
parent ccbc68b560
commit 0e94fd44a8
7 changed files with 212 additions and 33 deletions

View File

@@ -11,22 +11,15 @@ use Illuminate\Support\Collection;
class BookContents
{
/**
* @var Book
*/
protected $book;
protected Book $book;
/**
* BookContents constructor.
*/
public function __construct(Book $book)
{
$this->book = $book;
}
/**
* Get the current priority of the last item
* at the top-level of the book.
* Get the current priority of the last item at the top-level of the book.
*/
public function getLastPriority(): int
{