feat(event): suspend event dates instead of cancelling

This commit is contained in:
2026-09-11 15:57:17 -03:00
parent 96df431d60
commit 1880fc8147
10 changed files with 52 additions and 29 deletions

View File

@@ -216,11 +216,11 @@ class AdminAppEventControllerTest extends TestCase
);
}
public function test_cancelling_disables_only_tickets_without_another_usable_date(): void
public function test_suspending_disables_only_tickets_without_another_usable_date(): void
{
$tenant = $this->createTenant('acme');
$admin = $this->createAdminAppUser($tenant);
$cancelledDate = $tenant->eventDates()->create([
$suspendedDate = $tenant->eventDates()->create([
'date' => '2027-10-09',
'time_start' => '09:00',
'time_end' => '18:30',
@@ -230,16 +230,17 @@ class AdminAppEventControllerTest extends TestCase
'time_start' => '09:00',
'time_end' => '18:30',
]);
$singleDateVariant = $this->createVariant($tenant, $cancelledDate->id);
$singleDateVariant = $this->createVariant($tenant, $suspendedDate->id);
$multipleDateVariant = $this->createVariant($tenant);
$multipleDateVariant->eventDates()->sync([$cancelledDate->id, $otherDate->id]);
$multipleDateVariant->eventDates()->sync([$suspendedDate->id, $otherDate->id]);
$singleDateTicket = $this->createTicket($tenant, $admin, $singleDateVariant);
$multipleDateTicket = $this->createTicket($tenant, $admin, $multipleDateVariant);
Sanctum::actingAs($admin);
$this->postJson("/api/v1/adminapp/tenant/event-dates/{$cancelledDate->id}/cancel")
$this->postJson("/api/v1/adminapp/tenant/event-dates/{$suspendedDate->id}/suspend")
->assertOk()
->assertJsonPath('data.status', 'cancelled');
->assertJsonPath('data.status', 'suspended')
->assertJsonPath('data.suspended_at', fn ($value) => is_string($value));
$this->assertNotNull($singleDateTicket->fresh()->disabled_at);
$this->assertNull($multipleDateTicket->fresh()->disabled_at);
@@ -249,7 +250,7 @@ class AdminAppEventControllerTest extends TestCase
);
}
public function test_cancelling_a_reschedule_destination_disables_tickets_from_predecessor_dates(): void
public function test_suspending_a_reschedule_destination_disables_tickets_from_predecessor_dates(): void
{
$tenant = $this->createTenant('acme');
$admin = $this->createAdminAppUser($tenant);
@@ -271,7 +272,7 @@ class AdminAppEventControllerTest extends TestCase
);
Sanctum::actingAs($admin);
$this->postJson("/api/v1/adminapp/tenant/event-dates/{$destination->id}/cancel")
$this->postJson("/api/v1/adminapp/tenant/event-dates/{$destination->id}/suspend")
->assertOk();
$this->assertNotNull($ticket->fresh()->disabled_at);

View File

@@ -55,8 +55,8 @@ class EventModelsTest extends TestCase
$eventDate->date = '2026-10-08';
$this->assertSame(EventDateStatus::Completed, $eventDate->status);
$eventDate->cancelled_at = now();
$this->assertSame(EventDateStatus::Cancelled, $eventDate->status);
$eventDate->suspended_at = now();
$this->assertSame(EventDateStatus::Suspended, $eventDate->status);
$eventDate->rescheduled_to_event_date_id = 123;
$this->assertSame(EventDateStatus::Rescheduled, $eventDate->status);