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:
@@ -199,8 +199,8 @@ class AssignablePersonsTest extends TestCase
|
||||
$shift1 = $this->createOpenShift();
|
||||
$shift2 = $this->createOpenShift(['festival_section_id' => $this->otherSection->id]);
|
||||
|
||||
$available = $this->createPerson(['name' => 'Anna Bakker']);
|
||||
$conflicted = $this->createPerson(['name' => 'Bob Jansen']);
|
||||
$available = $this->createPerson(['first_name' => 'Anna', 'last_name' => 'Bakker']);
|
||||
$conflicted = $this->createPerson(['first_name' => 'Bob', 'last_name' => 'Jansen']);
|
||||
|
||||
ShiftAssignment::factory()->create([
|
||||
'shift_id' => $shift1->id,
|
||||
|
||||
@@ -214,7 +214,8 @@ class RegistrationSettingsTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$event->id}/volunteer-register", [
|
||||
'name' => 'Test Vrijwilliger',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'Vrijwilliger',
|
||||
'email' => 'test-section-pref@example.nl',
|
||||
'section_preferences' => [
|
||||
['section_name' => 'Backstage', 'priority' => 1],
|
||||
|
||||
@@ -54,7 +54,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_volunteer_can_register_with_all_fields(): void
|
||||
{
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Jan de Vries',
|
||||
'first_name' => 'Jan',
|
||||
'last_name' => 'de Vries',
|
||||
'email' => 'jan@voorbeeld.nl',
|
||||
'phone' => '+31612345678',
|
||||
'tshirt_size' => 'L',
|
||||
@@ -76,7 +77,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_volunteer_can_register_with_minimal_fields(): void
|
||||
{
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Sophie Bakker',
|
||||
'first_name' => 'Sophie',
|
||||
'last_name' => 'Bakker',
|
||||
'email' => 'sophie@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
@@ -84,7 +86,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
|
||||
$this->assertDatabaseHas('persons', [
|
||||
'email' => 'sophie@voorbeeld.nl',
|
||||
'name' => 'Sophie Bakker',
|
||||
'first_name' => 'Sophie',
|
||||
'last_name' => 'Bakker',
|
||||
'event_id' => $this->event->id,
|
||||
]);
|
||||
}
|
||||
@@ -101,7 +104,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
TimeSlot::factory()->create(['event_id' => $festival->id]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$subEvent->id}/volunteer-register", [
|
||||
'name' => 'Pieter Jansen',
|
||||
'first_name' => 'Pieter',
|
||||
'last_name' => 'Jansen',
|
||||
'email' => 'pieter@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
@@ -118,7 +122,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
$timeSlot2 = TimeSlot::factory()->create(['event_id' => $this->event->id]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Fleur Vermeer',
|
||||
'first_name' => 'Fleur',
|
||||
'last_name' => 'Vermeer',
|
||||
'email' => 'fleur@voorbeeld.nl',
|
||||
'availabilities' => [
|
||||
['time_slot_id' => $this->timeSlot->id, 'preference_level' => 4],
|
||||
@@ -145,7 +150,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_registration_stores_custom_fields(): void
|
||||
{
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Daan Mulder',
|
||||
'first_name' => 'Daan',
|
||||
'last_name' => 'Mulder',
|
||||
'email' => 'daan@voorbeeld.nl',
|
||||
'tshirt_size' => 'XL',
|
||||
'motivation' => 'Ik vind festivals geweldig.',
|
||||
@@ -167,12 +173,14 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_duplicate_email_rejected(): void
|
||||
{
|
||||
$this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Anna Smit',
|
||||
'first_name' => 'Anna',
|
||||
'last_name' => 'Smit',
|
||||
'email' => 'anna@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Anna Smit',
|
||||
'first_name' => 'Anna',
|
||||
'last_name' => 'Smit',
|
||||
'email' => 'anna@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
@@ -189,7 +197,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Herkan Poging',
|
||||
'first_name' => 'Herkan',
|
||||
'last_name' => 'Poging',
|
||||
'email' => 'herkan@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
@@ -209,7 +218,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$draftEvent->id}/volunteer-register", [
|
||||
'name' => 'Test Persoon',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'Persoon',
|
||||
'email' => 'test@voorbeeld.nl',
|
||||
]);
|
||||
|
||||
@@ -219,7 +229,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_invalid_time_slot_rejected(): void
|
||||
{
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/volunteer-register", [
|
||||
'name' => 'Bas van Dijk',
|
||||
'first_name' => 'Bas',
|
||||
'last_name' => 'van Dijk',
|
||||
'email' => 'bas@voorbeeld.nl',
|
||||
'availabilities' => [
|
||||
['time_slot_id' => '01JNONEXISTENT00000000000', 'preference_level' => 3],
|
||||
@@ -235,7 +246,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_authenticated_user_registration(): void
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'name' => 'Lisa de Groot',
|
||||
'first_name' => 'Lisa',
|
||||
'last_name' => 'de Groot',
|
||||
'email' => 'lisa@voorbeeld.nl',
|
||||
]);
|
||||
$this->organisation->users()->attach($user, ['role' => 'org_member']);
|
||||
@@ -255,7 +267,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_authenticated_ignores_request_email(): void
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'name' => 'Mark Visser',
|
||||
'first_name' => 'Mark',
|
||||
'last_name' => 'Visser',
|
||||
'email' => 'mark@voorbeeld.nl',
|
||||
]);
|
||||
$this->organisation->users()->attach($user, ['role' => 'org_member']);
|
||||
@@ -274,7 +287,8 @@ class VolunteerRegistrationTest extends TestCase
|
||||
public function test_authenticated_duplicate_rejected(): void
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'name' => 'Eva Hendriks',
|
||||
'first_name' => 'Eva',
|
||||
'last_name' => 'Hendriks',
|
||||
'email' => 'eva@voorbeeld.nl',
|
||||
]);
|
||||
$this->organisation->users()->attach($user, ['role' => 'org_member']);
|
||||
@@ -326,7 +340,7 @@ class VolunteerRegistrationTest extends TestCase
|
||||
|
||||
public function test_authenticated_user_gets_person(): void
|
||||
{
|
||||
$user = User::factory()->create(['name' => 'Karin Bos']);
|
||||
$user = User::factory()->create(['first_name' => 'Karin', 'last_name' => 'Bos']);
|
||||
$this->organisation->users()->attach($user, ['role' => 'org_member']);
|
||||
|
||||
Person::factory()->create([
|
||||
@@ -346,7 +360,7 @@ class VolunteerRegistrationTest extends TestCase
|
||||
|
||||
public function test_authenticated_user_no_person_returns_404(): void
|
||||
{
|
||||
$user = User::factory()->create(['name' => 'Tom Kuiper']);
|
||||
$user = User::factory()->create(['first_name' => 'Tom', 'last_name' => 'Kuiper']);
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$response = $this->getJson("/api/v1/portal/me?event_id={$this->event->id}");
|
||||
@@ -357,7 +371,7 @@ class VolunteerRegistrationTest extends TestCase
|
||||
|
||||
public function test_missing_event_id_returns_422(): void
|
||||
{
|
||||
$user = User::factory()->create(['name' => 'Sanne Bruin']);
|
||||
$user = User::factory()->create(['first_name' => 'Sanne', 'last_name' => 'Bruin']);
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$response = $this->getJson('/api/v1/portal/me');
|
||||
|
||||
Reference in New Issue
Block a user