소스 검색

Update ApiV1Controller, improve favourites endpoint

Daniel Supernault 3 년 전
부모
커밋
2848620a32
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      app/Http/Controllers/Api/ApiV1Controller.php

+ 7 - 0
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']