feat: shift assignment workflow with claim, approve, reject, cancel, and bulk approve

Implements the complete ShiftAssignment lifecycle:
- ShiftAssignmentStatus enum with allowed transitions
- ShiftAssignmentService with claim/assign/approve/reject/cancel/bulkApprove
- ShiftAssignmentController with event-scoped endpoints
- ShiftAssignmentPolicy (organizer + volunteer self-cancel)
- VolunteerAvailability model, controller, and sync endpoint
- Refactored ShiftController to delegate to service layer
- 31 workflow tests covering all paths and multi-tenancy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 17:00:56 +02:00
parent 303280286f
commit 0cdc192239
21 changed files with 1830 additions and 77 deletions

View File

@@ -17,8 +17,10 @@ use App\Http\Controllers\Api\V1\OrganisationController;
use App\Http\Controllers\Api\V1\PersonController;
use App\Http\Controllers\Api\V1\PersonIdentityMatchController;
use App\Http\Controllers\Api\V1\PersonTagController;
use App\Http\Controllers\Api\V1\ShiftAssignmentController;
use App\Http\Controllers\Api\V1\ShiftController;
use App\Http\Controllers\Api\V1\TimeSlotController;
use App\Http\Controllers\Api\V1\VolunteerAvailabilityController;
use App\Http\Controllers\Api\V1\UserOrganisationTagController;
use App\Models\FestivalSection;
use App\Models\Organisation;
@@ -129,8 +131,19 @@ Route::middleware('auth:sanctum')->group(function () {
Route::post('shifts/{shift}/claim', [ShiftController::class, 'claim']);
});
// Shift assignments (event-level)
Route::get('shift-assignments', [ShiftAssignmentController::class, 'index']);
Route::post('shift-assignments/{shiftAssignment}/approve', [ShiftAssignmentController::class, 'approve']);
Route::post('shift-assignments/{shiftAssignment}/reject', [ShiftAssignmentController::class, 'reject']);
Route::post('shift-assignments/{shiftAssignment}/cancel', [ShiftAssignmentController::class, 'cancel']);
Route::post('shift-assignments/bulk-approve', [ShiftAssignmentController::class, 'bulkApprove']);
Route::apiResource('persons', PersonController::class);
Route::post('persons/{person}/approve', [PersonController::class, 'approve']);
// Volunteer availabilities
Route::get('persons/{person}/availabilities', [VolunteerAvailabilityController::class, 'index']);
Route::post('persons/{person}/availabilities/sync', [VolunteerAvailabilityController::class, 'sync']);
Route::apiResource('crowd-lists', CrowdListController::class)
->except(['show']);
Route::get('crowd-lists/{crowdList}/persons', [CrowdListController::class, 'persons']);