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');
|
||||
|
||||
@@ -24,7 +24,7 @@ class LoginTest extends TestCase
|
||||
$response->assertOk()
|
||||
->assertJsonStructure([
|
||||
'success',
|
||||
'data' => ['user' => ['id', 'name', 'email'], 'token'],
|
||||
'data' => ['user' => ['id', 'first_name', 'last_name', 'full_name', 'email'], 'token'],
|
||||
'message',
|
||||
])
|
||||
->assertJson(['success' => true]);
|
||||
|
||||
@@ -35,7 +35,7 @@ class MeTest extends TestCase
|
||||
->assertJsonStructure([
|
||||
'success',
|
||||
'data' => [
|
||||
'id', 'name', 'email', 'timezone', 'locale',
|
||||
'id', 'first_name', 'last_name', 'full_name', 'email', 'timezone', 'locale',
|
||||
'organisations', 'app_roles', 'permissions',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -100,7 +100,8 @@ class CompanyTest extends TestCase
|
||||
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/companies", [
|
||||
'name' => 'Catering Janssen',
|
||||
'type' => 'supplier',
|
||||
'contact_name' => 'Jan Janssen',
|
||||
'contact_first_name' => 'Jan',
|
||||
'contact_last_name' => 'Janssen',
|
||||
'contact_email' => 'jan@janssen.nl',
|
||||
'contact_phone' => '+31612345678',
|
||||
]);
|
||||
|
||||
@@ -201,14 +201,16 @@ class FestivalEventTest extends TestCase
|
||||
Person::factory()->create([
|
||||
'event_id' => $this->festival->id,
|
||||
'crowd_type_id' => $this->crowdType->id,
|
||||
'name' => 'Jan Festivalmedewerker',
|
||||
'first_name' => 'Jan',
|
||||
'last_name' => 'Festivalmedewerker',
|
||||
]);
|
||||
|
||||
// Create a person on the sub-event
|
||||
Person::factory()->create([
|
||||
'event_id' => $this->subEvent->id,
|
||||
'crowd_type_id' => $this->crowdType->id,
|
||||
'name' => 'Piet Dagvrijwilliger',
|
||||
'first_name' => 'Piet',
|
||||
'last_name' => 'Dagvrijwilliger',
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->orgAdmin);
|
||||
@@ -218,7 +220,7 @@ class FestivalEventTest extends TestCase
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$personNames = collect($response->json('data'))->pluck('name')->all();
|
||||
$personNames = collect($response->json('data'))->pluck('full_name')->all();
|
||||
$this->assertContains('Jan Festivalmedewerker', $personNames);
|
||||
$this->assertNotContains('Piet Dagvrijwilliger', $personNames);
|
||||
}
|
||||
|
||||
@@ -152,13 +152,14 @@ class InvitationTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/invitations/{$invitation->token}/accept", [
|
||||
'name' => 'New User',
|
||||
'first_name' => 'New',
|
||||
'last_name' => 'User',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonStructure(['data' => ['user' => ['id', 'name', 'email'], 'token']]);
|
||||
$response->assertJsonStructure(['data' => ['user' => ['id', 'first_name', 'last_name', 'full_name', 'email'], 'token']]);
|
||||
|
||||
$this->assertDatabaseHas('users', ['email' => 'newuser@test.nl']);
|
||||
$this->assertDatabaseHas('organisation_user', [
|
||||
@@ -204,7 +205,8 @@ class InvitationTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/invitations/{$invitation->token}/accept", [
|
||||
'name' => 'Test',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
]);
|
||||
@@ -222,7 +224,8 @@ class InvitationTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->postJson("/api/v1/invitations/{$invitation->token}/accept", [
|
||||
'name' => 'Test',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'password' => 'password123',
|
||||
'password_confirmation' => 'password123',
|
||||
]);
|
||||
|
||||
@@ -119,17 +119,19 @@ class PersonTest extends TestCase
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons", [
|
||||
'crowd_type_id' => $this->crowdType->id,
|
||||
'name' => 'Jan de Vries',
|
||||
'first_name' => 'Jan',
|
||||
'last_name' => 'de Vries',
|
||||
'email' => 'jan@test.nl',
|
||||
'phone' => '0612345678',
|
||||
]);
|
||||
|
||||
$response->assertCreated()
|
||||
->assertJson(['data' => ['name' => 'Jan de Vries', 'email' => 'jan@test.nl', 'status' => 'pending']]);
|
||||
->assertJson(['data' => ['first_name' => 'Jan', 'last_name' => 'de Vries', 'email' => 'jan@test.nl', 'status' => 'pending']]);
|
||||
|
||||
$this->assertDatabaseHas('persons', [
|
||||
'event_id' => $this->event->id,
|
||||
'name' => 'Jan de Vries',
|
||||
'first_name' => 'Jan',
|
||||
'last_name' => 'de Vries',
|
||||
'email' => 'jan@test.nl',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ class PersonIdentityMatchTest extends TestCase
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons", [
|
||||
'crowd_type_id' => $this->crowdType->id,
|
||||
'name' => 'Jan de Vries',
|
||||
'first_name' => 'Jan',
|
||||
'last_name' => 'de Vries',
|
||||
'email' => 'jan@example.nl',
|
||||
]);
|
||||
|
||||
@@ -93,7 +94,8 @@ class PersonIdentityMatchTest extends TestCase
|
||||
|
||||
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons", [
|
||||
'crowd_type_id' => $this->crowdType->id,
|
||||
'name' => 'Piet Jansen',
|
||||
'first_name' => 'Piet',
|
||||
'last_name' => 'Jansen',
|
||||
'email' => 'unknown@example.nl',
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user