feat: Phase 3.2 - Rate limiting all API routes

- Add throttle:120,1 to PULL endpoints (projects, bundle, templates)
- Add throttle:60,1 to PUSH endpoint (sync)
- Add throttle:120,1 to media upload

Tests: 101 passing (319 assertions), 24/24 API tests pass
This commit is contained in:
Javier Braña
2026-08-31 12:28:28 +02:00
parent 2c7b36b050
commit ff1d1ed3a4
+15 -7
View File
@@ -16,13 +16,21 @@ Route::prefix('v1')->group(function () {
Route::get('me', [AuthController::class, 'me']);
Route::post('logout', [AuthController::class, 'logout']);
// PULL
Route::get('projects', [ProjectApiController::class, 'index']);
Route::get('projects/{project}/bundle', [ProjectApiController::class, 'bundle']);
Route::get('templates', [ProjectApiController::class, 'templates']);
// PULL - rate limit: 120 req/min
Route::middleware('throttle:120,1')->group(function () {
Route::get('projects', [ProjectApiController::class, 'index']);
Route::get('projects/{project}/bundle', [ProjectApiController::class, 'bundle']);
Route::get('templates', [ProjectApiController::class, 'templates']);
});
// PUSH
Route::post('sync', [SyncController::class, 'sync'])->middleware('throttle:60,1');
Route::post('media', [MediaController::class, 'upload'])->middleware('throttle:120,1');
// PUSH - rate limit: 60 req/min
Route::middleware('throttle:60,1')->group(function () {
Route::post('sync', [SyncController::class, 'sync']);
});
// Media - rate limit: 120 req/min
Route::middleware('throttle:120,1')->group(function () {
Route::post('media', [MediaController::class, 'upload']);
});
});
});