Update BaseApiController, improve favourites endpoint

This commit is contained in:
Daniel Supernault 2022-01-26 23:48:32 -07:00
parent f063cb0185
commit 3d86d21be6
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -261,7 +261,7 @@ class BaseApiController extends Controller
{
abort_if(!$request->user(), 403);
$this->validate($request, [
'page' => 'sometimes|int|min:1|max:40',
'page' => 'sometimes|int|min:1|max:20',
'limit' => 'sometimes|int|min:1|max:10'
]);
@ -273,7 +273,9 @@ class BaseApiController extends Controller
->latest()
->simplePaginate($limit)
->map(function($id) {
return StatusService::get($id->status_id, false);
$status = StatusService::get($id->status_id, false);
$status['favourited'] = true;
return $status;
})
->filter(function($post) {
return $post && isset($post['account']);