feat(api): extend registration endpoints with dynamic fields and section preferences

- PublicRegistrationData now returns registration_fields (portal-visible only),
  form toggles, and available_tags for tag_picker fields
- Volunteer registration accepts field_values and section_preferences with
  festival_section_id, processed via existing services
- PortalMe eager-loads fieldValues and sectionPreferences
- Section preferences now use the proper relational table instead of custom_fields JSON

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 23:44:26 +02:00
parent a9dcee0fc7
commit 73c8e6c466
6 changed files with 395 additions and 9 deletions

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Http\Requests\Api\V1\PortalMeRequest;
use App\Http\Resources\Api\V1\PersonResource;
use App\Models\Event;
use App\Models\Person;
use Illuminate\Http\JsonResponse;
final class PortalMeController extends Controller
{
public function index(PortalMeRequest $request): JsonResponse
{
$event = Event::findOrFail($request->validated('event_id'));
if ($event->isSubEvent()) {
$event = $event->parent;
}
$person = Person::where('user_id', $request->user()->id)
->where('event_id', $event->id)
->with([
'crowdType',
'shiftAssignments.shift.festivalSection',
'shiftAssignments.shift.timeSlot',
'volunteerAvailabilities.timeSlot',
'fieldValues.registrationFormField',
'sectionPreferences.festivalSection',
])
->first();
if (! $person) {
return $this->notFound('No registration found for this event');
}
return $this->success(new PersonResource($person));
}
}