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

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Database\Factories;
use App\Enums\ShiftAssignmentStatus;
use App\Models\Person;
use App\Models\Shift;
use App\Models\ShiftAssignment;
@@ -20,15 +21,16 @@ final class ShiftAssignmentFactory extends Factory
'shift_id' => Shift::factory(),
'person_id' => Person::factory(),
'time_slot_id' => TimeSlot::factory(),
'status' => 'pending_approval',
'status' => ShiftAssignmentStatus::PENDING_APPROVAL,
'auto_approved' => false,
'assigned_at' => now(),
];
}
public function approved(): static
{
return $this->state(fn () => [
'status' => 'approved',
'status' => ShiftAssignmentStatus::APPROVED,
'approved_at' => now(),
]);
}
@@ -36,7 +38,7 @@ final class ShiftAssignmentFactory extends Factory
public function autoApproved(): static
{
return $this->state(fn () => [
'status' => 'approved',
'status' => ShiftAssignmentStatus::APPROVED,
'auto_approved' => true,
'approved_at' => now(),
]);