Refactor entry reservation handling by generalizing ticket reservations

- Renamed `desfile_entry_reservations` to `entry_reservations` and `desfile_reservation_batches` to `reservation_batches`.
- Updated models, services, and requests to use the new `EntryReservation` model from the `Ticket` domain instead of the deleted `Desfile` model.
- Introduced a new `EntryReservationPaymentType` enum to manage payment types.
- Modified database migrations to ensure data integrity during the transition.
- Updated tests to reflect changes in the database schema and model relationships.
- Ensured that existing functionality remains intact while improving code organization and clarity.
This commit is contained in:
2026-10-02 11:03:00 -03:00
parent 856b9a6706
commit 47b2e8e030
27 changed files with 442 additions and 103 deletions

View File

@@ -6,7 +6,7 @@ use App\Domains\Commerce\Catalog\Enums\InventoryPolicy;
use App\Domains\Commerce\Catalog\Models\CatalogItem;
use App\Domains\Commerce\Catalog\Models\Inventory;
use App\Domains\Commerce\Catalog\Models\Variant;
use App\Domains\Ticketing\Desfile\Models\EntryReservation;
use App\Domains\Ticketing\Ticket\Models\EntryReservation;
use Illuminate\Database\Eloquent\Collection;
use Tests\TestCase;
@@ -16,10 +16,10 @@ class VariantAvailabilityTest extends TestCase
{
$reserved = new Variant;
$reserved->id = 1;
$reserved->setRelation('desfileEntryReservations', new Collection([new EntryReservation]));
$reserved->setRelation('entryReservations', new Collection([new EntryReservation]));
$available = new Variant;
$available->id = 2;
$available->setRelation('desfileEntryReservations', new Collection);
$available->setRelation('entryReservations', new Collection);
$item = new CatalogItem(['inventory_policy' => InventoryPolicy::Unlimited]);
$item->setRelation('variants', new Collection([$reserved, $available]));

View File

@@ -1,9 +1,9 @@
<?php
namespace Tests\Unit\Desfile;
namespace Tests\Unit\Ticket;
use App\Domains\Ticketing\Desfile\Enums\EntryReservationPaymentType;
use App\Domains\Ticketing\Desfile\Models\EntryReservation;
use App\Domains\Ticketing\Ticket\Enums\EntryReservationPaymentType;
use App\Domains\Ticketing\Ticket\Models\EntryReservation;
use PHPUnit\Framework\TestCase;
class EntryReservationTest extends TestCase
@@ -21,6 +21,7 @@ class EntryReservationTest extends TestCase
$reservation = new EntryReservation;
$this->assertSame([
'catalog_item_id',
'variant_id',
'ticket_id',
'inventory_id',

View File

@@ -6,8 +6,8 @@ use App\Domains\Commerce\Catalog\Models\CatalogItem;
use App\Domains\Commerce\Catalog\Models\Variant;
use App\Domains\Core\Auth\Models\User;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Ticketing\Desfile\Models\EntryReservation;
use App\Domains\Ticketing\Ticket\Enums\ValidityTimeType;
use App\Domains\Ticketing\Ticket\Models\EntryReservation;
use App\Domains\Ticketing\Ticket\Models\Ticket;
use App\Domains\Ticketing\Ticket\Models\ValidityTime;
use App\Domains\Ticketing\Ticket\Services\ResolvedTicketValidity;