1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Organised activity types and moved most to repos

Repos are generally better since otherwise we end up duplicating
things between front-end and API.

Types moved to by CONST values within a class for better visibilty
of usage and listing of types.
This commit is contained in:
Dan Brown
2020-11-07 22:37:27 +00:00
parent 4824ef2760
commit c157dc3490
19 changed files with 76 additions and 73 deletions

View File

@@ -1,10 +1,12 @@
<?php namespace BookStack\Entities\Repos;
use BookStack\Actions\ActivityType;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Managers\TrashCan;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Exceptions\NotFoundException;
use BookStack\Facades\Activity;
use Exception;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Http\UploadedFile;
@@ -87,11 +89,12 @@ class BookshelfRepo
$shelf = new Bookshelf();
$this->baseRepo->create($shelf, $input);
$this->updateBooks($shelf, $bookIds);
Activity::add($shelf, ActivityType::BOOKSHELF_CREATE);
return $shelf;
}
/**
* Create a new shelf in the system.
* Update an existing shelf in the system using the given input.
*/
public function update(Bookshelf $shelf, array $input, ?array $bookIds): Bookshelf
{
@@ -101,6 +104,7 @@ class BookshelfRepo
$this->updateBooks($shelf, $bookIds);
}
Activity::add($shelf, ActivityType::BOOKSHELF_UPDATE);
return $shelf;
}
@@ -175,6 +179,7 @@ class BookshelfRepo
{
$trashCan = new TrashCan();
$trashCan->softDestroyShelf($shelf);
Activity::add($shelf, ActivityType::BOOKSHELF_DELETE);
$trashCan->autoClearOld();
}
}