mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-22 23:59:42 +00: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:
parent
4824ef2760
commit
c157dc3490
19 changed files with 76 additions and 73 deletions
app/Http/Controllers/Api
|
@ -1,5 +1,6 @@
|
|||
<?php namespace BookStack\Http\Controllers\Api;
|
||||
|
||||
use BookStack\Actions\ActivityType;
|
||||
use BookStack\Entities\Book;
|
||||
use BookStack\Entities\Repos\BookRepo;
|
||||
use BookStack\Exceptions\NotifyException;
|
||||
|
@ -55,8 +56,6 @@ class BookApiController extends ApiController
|
|||
$requestData = $this->validate($request, $this->rules['create']);
|
||||
|
||||
$book = $this->bookRepo->create($requestData);
|
||||
Activity::add($book, 'book_create', $book->id);
|
||||
|
||||
return response()->json($book);
|
||||
}
|
||||
|
||||
|
@ -80,7 +79,6 @@ class BookApiController extends ApiController
|
|||
|
||||
$requestData = $this->validate($request, $this->rules['update']);
|
||||
$book = $this->bookRepo->update($book, $requestData);
|
||||
Activity::add($book, 'book_update', $book->id);
|
||||
|
||||
return response()->json($book);
|
||||
}
|
||||
|
@ -96,8 +94,6 @@ class BookApiController extends ApiController
|
|||
$this->checkOwnablePermission('book-delete', $book);
|
||||
|
||||
$this->bookRepo->destroy($book);
|
||||
Activity::addMessage('book_delete', $book->name);
|
||||
|
||||
return response('', 204);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue