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:
42
api/app/Http/Controllers/Api/V1/PortalMeController.php
Normal file
42
api/app/Http/Controllers/Api/V1/PortalMeController.php
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user