feat: split name into first_name + last_name across users, persons, and companies
Cross-cutting migration affecting the entire stack: - Database: 3 migrations splitting name columns with data migration - Models: first_name/last_name on User, Person; contact_first_name/contact_last_name on Company; backward-compatible name accessors - API: all resources return first_name, last_name, full_name; assignablePersons endpoint updated - Requests: validation rules updated for all person/user/company forms - Services: VolunteerRegistrationService, ShiftAssignmentService, InvitationService updated - Frontend: TypeScript types, Zod schemas, all forms split into Voornaam/Achternaam fields - Display: all person/user name references use full_name; initials use first_name[0]+last_name[0] - Tests: all 371 tests passing - Docs: SCHEMA.md and API.md updated Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,8 @@ final class InvitationService
|
||||
}
|
||||
|
||||
$user = User::create([
|
||||
'name' => Str::before($invitation->email, '@'),
|
||||
'first_name' => Str::before($invitation->email, '@'),
|
||||
'last_name' => '',
|
||||
'email' => $invitation->email,
|
||||
'password' => $password,
|
||||
'email_verified_at' => now(),
|
||||
|
||||
@@ -102,7 +102,7 @@ final class ShiftAssignmentService
|
||||
->performedOn($existing)
|
||||
->withProperties([
|
||||
'previous_status' => $previousStatus,
|
||||
'person_name' => $person->name,
|
||||
'person_name' => $person->full_name,
|
||||
])
|
||||
->log('shift_assignment.reactivated');
|
||||
|
||||
@@ -124,7 +124,7 @@ final class ShiftAssignmentService
|
||||
'filled_slots' => $filledSlots,
|
||||
'slots_total' => $shift->slots_total,
|
||||
'person_id' => $person->id,
|
||||
'person_name' => $person->name,
|
||||
'person_name' => $person->full_name,
|
||||
])
|
||||
->log('shift.overbooked_assignment');
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ final class VolunteerRegistrationService
|
||||
[
|
||||
'user_id' => $user?->id,
|
||||
'crowd_type_id' => $volunteerCrowdType->id,
|
||||
'name' => $user?->name ?? $validated['name'],
|
||||
'first_name' => $user?->first_name ?? $validated['first_name'],
|
||||
'last_name' => $user?->last_name ?? $validated['last_name'],
|
||||
'phone' => $validated['phone'] ?? null,
|
||||
'status' => PersonStatus::PENDING,
|
||||
'custom_fields' => [
|
||||
@@ -119,7 +120,7 @@ final class VolunteerRegistrationService
|
||||
return;
|
||||
}
|
||||
|
||||
if ($existing->status !== PersonStatus::REJECTED) {
|
||||
if ($existing->status !== PersonStatus::REJECTED->value) {
|
||||
throw ValidationException::withMessages([
|
||||
'email' => ['Already registered for this event.'],
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user