1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Queries: Extracted PageRepo queries to own class

Started new class for PageRevisions too as part of these changes
This commit is contained in:
Dan Brown
2024-02-05 17:35:49 +00:00
parent 8e78b4c43e
commit 222c665018
21 changed files with 219 additions and 196 deletions

View File

@ -23,7 +23,7 @@ class BookExportController extends Controller
*/
public function pdf(string $bookSlug)
{
$book = $this->queries->findVisibleBySlug($bookSlug);
$book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$pdfContent = $this->exportFormatter->bookToPdf($book);
return $this->download()->directly($pdfContent, $bookSlug . '.pdf');
@ -36,7 +36,7 @@ class BookExportController extends Controller
*/
public function html(string $bookSlug)
{
$book = $this->queries->findVisibleBySlug($bookSlug);
$book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$htmlContent = $this->exportFormatter->bookToContainedHtml($book);
return $this->download()->directly($htmlContent, $bookSlug . '.html');
@ -47,7 +47,7 @@ class BookExportController extends Controller
*/
public function plainText(string $bookSlug)
{
$book = $this->queries->findVisibleBySlug($bookSlug);
$book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$textContent = $this->exportFormatter->bookToPlainText($book);
return $this->download()->directly($textContent, $bookSlug . '.txt');
@ -58,7 +58,7 @@ class BookExportController extends Controller
*/
public function markdown(string $bookSlug)
{
$book = $this->queries->findVisibleBySlug($bookSlug);
$book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$textContent = $this->exportFormatter->bookToMarkdown($book);
return $this->download()->directly($textContent, $bookSlug . '.md');