feat: add user preferences and saved stations API endpoints

Adds authenticated endpoints for reading/updating fuel type preferences and managing saved stations, backed by new migrations and a SavedStation model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-10 18:06:31 +01:00
parent 0bae0945c0
commit 580f9c6929
7 changed files with 215 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\PredictionController;
use App\Http\Controllers\Api\StationController;
use App\Http\Controllers\Api\StatsController;
use App\Http\Controllers\Api\UserController;
use App\Http\Middleware\VerifyApiKey;
use Illuminate\Support\Facades\Route;
@@ -22,4 +23,11 @@ Route::middleware(['throttle:60,1', VerifyApiKey::class])->group(function (): vo
Route::middleware('auth:sanctum')->group(function (): void {
Route::get('/auth/me', [AuthController::class, 'me']);
Route::post('/auth/logout', [AuthController::class, 'logout']);
// User dashboard endpoints
Route::get('/user/preferences', [UserController::class, 'preferences']);
Route::put('/user/preferences', [UserController::class, 'updatePreferences']);
Route::get('/user/saved-stations', [UserController::class, 'savedStations']);
Route::post('/user/saved-stations', [UserController::class, 'saveStation']);
Route::delete('/user/saved-stations/{stationId}', [UserController::class, 'removeStation']);
});