feat: fase 2 backend — crowd types, persons, sections, shifts, invite flow

- Crowd Types + Persons CRUD (73 tests)
- Festival Sections + Time Slots + Shifts CRUD met assign/claim flow (84 tests)
- Invite Flow + Member Management met InvitationService (109 tests)
- Schema v1.6 migraties volledig uitgevoerd
- DevSeeder bijgewerkt met crowd types voor testorganisatie
This commit is contained in:
2026-04-08 01:34:46 +02:00
parent c417a6647a
commit 9acb27af3a
114 changed files with 6916 additions and 984 deletions

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Company;
use App\Models\Organisation;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Company> */
final class CompanyFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'organisation_id' => Organisation::factory(),
'name' => fake('nl_NL')->company(),
'type' => fake()->randomElement(['supplier', 'partner', 'agency', 'venue', 'other']),
'contact_name' => fake('nl_NL')->name(),
'contact_email' => fake()->companyEmail(),
'contact_phone' => fake('nl_NL')->phoneNumber(),
];
}
}

View File

@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\CrowdType;
use App\Models\Organisation;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<CrowdType> */
final class CrowdTypeFactory extends Factory
{
private const TYPES = [
'CREW' => ['name' => 'Crew', 'color' => '#3b82f6'],
'VOLUNTEER' => ['name' => 'Vrijwilliger', 'color' => '#10b981'],
'ARTIST' => ['name' => 'Artiest', 'color' => '#8b5cf6'],
'GUEST' => ['name' => 'Gast', 'color' => '#f59e0b'],
'PRESS' => ['name' => 'Pers', 'color' => '#6366f1'],
'PARTNER' => ['name' => 'Partner', 'color' => '#ec4899'],
'SUPPLIER' => ['name' => 'Leverancier', 'color' => '#64748b'],
];
/** @return array<string, mixed> */
public function definition(): array
{
$systemType = fake()->randomElement(array_keys(self::TYPES));
$typeConfig = self::TYPES[$systemType];
return [
'organisation_id' => Organisation::factory(),
'name' => $typeConfig['name'],
'system_type' => $systemType,
'color' => $typeConfig['color'],
'icon' => null,
'is_active' => true,
];
}
public function systemType(string $type): static
{
$config = self::TYPES[$type];
return $this->state(fn () => [
'system_type' => $type,
'name' => $config['name'],
'color' => $config['color'],
]);
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Event;
use App\Models\FestivalSection;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<FestivalSection> */
final class FestivalSectionFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'event_id' => Event::factory(),
'name' => fake()->randomElement([
'Horeca',
'Backstage',
'Overig',
'Entertainment',
'Security',
'Techniek',
]),
'type' => 'standard',
'sort_order' => fake()->numberBetween(1, 5),
'responder_self_checkin' => true,
'crew_auto_accepts' => false,
];
}
public function withSortOrder(int $order): static
{
return $this->state(fn () => ['sort_order' => $order]);
}
public function crossEvent(): static
{
return $this->state(fn () => ['type' => 'cross_event']);
}
}

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Event;
use App\Models\Location;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Location> */
final class LocationFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'event_id' => Event::factory(),
'name' => fake()->randomElement([
'Hoofdpodium',
'Bar Noord',
'Bar Zuid',
'Security Gate A',
'Backstage',
'Hospitality Tent',
]),
'address' => null,
'lat' => null,
'lng' => null,
'description' => null,
'access_instructions' => null,
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\CrowdType;
use App\Models\Event;
use App\Models\Person;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Person> */
final class PersonFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'event_id' => Event::factory(),
'crowd_type_id' => CrowdType::factory(),
'name' => fake('nl_NL')->name(),
'email' => fake()->unique()->safeEmail(),
'phone' => fake('nl_NL')->phoneNumber(),
'status' => 'pending',
'is_blacklisted' => false,
'custom_fields' => null,
];
}
public function approved(): static
{
return $this->state(fn () => ['status' => 'approved']);
}
}

View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\FestivalSection;
use App\Models\Shift;
use App\Models\TimeSlot;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Shift> */
final class ShiftFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'festival_section_id' => FestivalSection::factory(),
'time_slot_id' => TimeSlot::factory(),
'title' => fake()->randomElement([
'Tapper',
'Tussenbuffet',
'Barhoofd',
'Stage Manager',
'Stagehand',
'Coördinator',
'Runner',
]),
'slots_total' => fake()->numberBetween(1, 10),
'slots_open_for_claiming' => 0,
'status' => 'draft',
'is_lead_role' => false,
'allow_overlap' => false,
];
}
public function open(): static
{
return $this->state(fn () => ['status' => 'open']);
}
public function withClaiming(int $slots): static
{
return $this->state(fn () => ['slots_open_for_claiming' => $slots]);
}
public function allowOverlap(): static
{
return $this->state(fn () => ['allow_overlap' => true]);
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Event;
use App\Models\TimeSlot;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<TimeSlot> */
final class TimeSlotFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'event_id' => Event::factory(),
'name' => fake()->randomElement([
'Vrijdag Avond',
'Zaterdag Dag',
'Zaterdag Avond',
'Zondag',
'Opbouw',
]),
'person_type' => 'VOLUNTEER',
'date' => fake()->dateTimeBetween('+1 month', '+3 months'),
'start_time' => '18:00:00',
'end_time' => '02:00:00',
'duration_hours' => 8.00,
];
}
}