pp-planer/routes/api.php
Thorsten Bus 35d3298251 feat(ccli): add CcliPasteController endpoints
- POST /api/ccli/preview: parse-only endpoint (no DB writes)
- POST /api/songs/import-from-ccli-paste: 3 modes (create / pair-with-song / assign-to-service-song)
- GET /songs/import-from-ccli-paste: Inertia page with base64 bookmarklet prefill
- Routes guarded by auth:sanctum + throttle:30,1 (API); auth + web stack (web)
- Maps DuplicateCcliSongException to 409 with existing_song_id and edit_url
- Pest tests (10 cases, 63 assertions): preview, all 3 import modes, 409 dup, 422 errors, unauth, prefill happy/error, login redirect
2026-05-11 09:23:11 +02:00

60 lines
2.4 KiB
PHP

<?php
use App\Http\Controllers\CcliPasteController;
use App\Http\Controllers\ProFileController;
use App\Http\Controllers\ServiceSongController;
use App\Http\Controllers\SongController;
use App\Http\Controllers\TranslationController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routen
|--------------------------------------------------------------------------
|
| Alle API-Routen sind authentifizierungspflichtig und verwenden
| das Prefix /api automatisch durch die Laravel API-Routing-Konvention.
|
*/
Route::middleware('auth:sanctum')->group(function () {
Route::apiResource('songs', SongController::class)->names('api.songs');
Route::post('/service-songs/{serviceSongId}/assign', [ServiceSongController::class, 'assignSong'])
->name('api.service-songs.assign');
Route::post('/service-songs/{serviceSongId}/request', [ServiceSongController::class, 'requestSong'])
->name('api.service-songs.request');
Route::post('/service-songs/{serviceSongId}/unassign', [ServiceSongController::class, 'unassign'])
->name('api.service-songs.unassign');
Route::patch('/service-songs/{serviceSongId}', [ServiceSongController::class, 'update'])
->name('api.service-songs.update');
// Übersetzung
Route::post('/translation/fetch-url', [TranslationController::class, 'fetchUrl'])
->name('api.translation.fetch-url');
Route::post('/songs/{song}/translation/import', [TranslationController::class, 'import'])
->name('api.songs.translation.import');
Route::delete('/songs/{song}/translation', [TranslationController::class, 'destroy'])
->name('api.songs.translation.destroy');
// .pro Datei Upload und Download (Placeholder)
Route::post('/songs/import-pro', [ProFileController::class, 'importPro'])
->name('api.songs.import-pro');
Route::get('/songs/{song}/download-pro', [ProFileController::class, 'downloadPro'])
->name('api.songs.download-pro');
// CCLI Paste Import (manuelles Einfügen oder Bookmarklet)
Route::middleware('throttle:30,1')->group(function () {
Route::post('/ccli/preview', [CcliPasteController::class, 'preview'])
->name('api.ccli.preview');
Route::post('/songs/import-from-ccli-paste', [CcliPasteController::class, 'importPaste'])
->name('api.ccli.import');
});
});