feat(timetable): six artist-domain controllers + RFC §6 routes

Six thin controllers under app/Http/Controllers/Api/V1/Artist/. Zero
business logic: every mutation routes through a service from
app/Services/Artist/. Authorization via Gate::authorize matching
PersonController convention (request authorize() returns true; gates
fire in the controller).

  ArtistController          — org-scoped CRUD + restore. Catches
                              DuplicateArtistException → 409 with
                              duplicate_artist_id so the dialog can
                              offer "use existing".
  GenreController           — org-scoped CRUD; catches GenreInUseException
                              → 409 with referencing_artists_count.
  ArtistEngagementController — event-scoped CRUD; catches
                              InvalidStatusTransitionException → 422
                              with a Dutch-readable message.
  StageController           — event-scoped CRUD + reorder + replaceDays;
                              catches StageDaysOrphanedPerformancesException
                              → 409 with the orphaned performance ids
                              and the removed event ids per RFC §10.5.
                              destroy returns the parked performance
                              count (cascade-park).
  PerformanceController     — event-scoped CRUD with index filters
                              `?day={subevent}` and `?stage_id=null`
                              (wachtrij). update is non-placement only.
  TimetableMoveController   — single __invoke for POST /timetable/move.
                              Catches VersionMismatchException → 409
                              with current_version + server_data per
                              RFC D14.

Routes wired into api/routes/api.php nested under the existing
organisations/{organisation}/events/{event} prefix group, matching
PersonController and ShiftController structure. The move endpoint
gets the new `idempotency.60s` middleware alias for R1. `stages/order`
and `stages/{stage}/days` registered before the apiResource so the
literal path wins over the wildcard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 20:56:43 +02:00
parent 546f121ee8
commit 32da6b656d
7 changed files with 635 additions and 0 deletions

View File

@@ -337,8 +337,31 @@ Route::middleware(['auth:sanctum', 'impersonation'])->group(function () {
Route::get('crowd-lists/{crowdList}/persons', [CrowdListController::class, 'persons']);
Route::post('crowd-lists/{crowdList}/persons', [CrowdListController::class, 'addPerson']);
Route::delete('crowd-lists/{crowdList}/persons/{person}', [CrowdListController::class, 'removePerson']);
// RFC-TIMETABLE v0.2 — artist domain (Session 2)
// Engagements
Route::apiResource('engagements', \App\Http\Controllers\Api\V1\Artist\ArtistEngagementController::class);
// Stages — specific routes before {stage} wildcard
Route::post('stages/order', [\App\Http\Controllers\Api\V1\Artist\StageController::class, 'reorder']);
Route::put('stages/{stage}/days', [\App\Http\Controllers\Api\V1\Artist\StageController::class, 'replaceDays']);
Route::apiResource('stages', \App\Http\Controllers\Api\V1\Artist\StageController::class);
// Performances
Route::apiResource('performances', \App\Http\Controllers\Api\V1\Artist\PerformanceController::class);
// Timetable move (D18 — guarded by 60s Redis idempotency window per R1)
Route::post('timetable/move', \App\Http\Controllers\Api\V1\Artist\TimetableMoveController::class)
->middleware('idempotency.60s');
});
// RFC-TIMETABLE v0.2 — org-level artist resources (Session 2)
Route::apiResource('artists', \App\Http\Controllers\Api\V1\Artist\ArtistController::class);
Route::post('artists/{artist}/restore', [\App\Http\Controllers\Api\V1\Artist\ArtistController::class, 'restore'])
->withTrashed();
Route::apiResource('genres', \App\Http\Controllers\Api\V1\Artist\GenreController::class)
->except(['show']);
// Form Builder (ARCH-FORM-BUILDER.md)
Route::prefix('forms')->group(function (): void {
// Filter registry