From 2848620a32fa9f59af67cca79a6703cd2e37fc8d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Feb 2022 00:32:25 -0700 Subject: [PATCH] Update ApiV1Controller, improve favourites endpoint --- app/Http/Controllers/Api/ApiV1Controller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 6b393549..d7699943 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1040,6 +1040,13 @@ class ApiV1Controller extends Controller } } + abort_if( + Like::whereProfileId($user->profile_id) + ->where('created_at', '>', now()->subDay()) + ->count() >= 100, + 429 + ); + $like = Like::firstOrCreate([ 'profile_id' => $user->profile_id, 'status_id' => $status['id']