From 17f4cb650270224be1819a2227e07ba481f5c6fb Mon Sep 17 00:00:00 2001 From: ncoronel Date: Mon, 10 Aug 2026 14:13:46 -0300 Subject: [PATCH] feat: enable ticketing for Fiesta Futbol Infantil catalog items; update services, migrations, seeders, and tests to reflect changes --- .../Services/AccommodationService.php | 4 ++-- .../Services/FoodService.php | 4 ++-- .../Services/MerchandiseService.php | 4 ++-- ...ets_for_fiesta_futbol_infantil_catalog.php | 22 +++++++++++++++++++ .../FiestaFutbolInfantilProductSeeder.php | 1 + .../AccommodationControllerTest.php | 2 ++ .../FoodControllerTest.php | 1 + .../MerchandiseControllerTest.php | 1 + .../FiestaFutbolInfantilProductSeederTest.php | 6 +++++ 9 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2026_08_10_000200_enable_tickets_for_fiesta_futbol_infantil_catalog.php diff --git a/app/Domains/FiestaFutbolInfantil/Services/AccommodationService.php b/app/Domains/FiestaFutbolInfantil/Services/AccommodationService.php index accde3e..d1dd853 100644 --- a/app/Domains/FiestaFutbolInfantil/Services/AccommodationService.php +++ b/app/Domains/FiestaFutbolInfantil/Services/AccommodationService.php @@ -137,7 +137,7 @@ class AccommodationService 'category_id' => $category->id, 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, ]); return $accommodation; @@ -152,7 +152,7 @@ class AccommodationService 'precio' => collect($variants)->min('price') ?? 0, 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, 'inventory_id' => null, ]); } diff --git a/app/Domains/FiestaFutbolInfantil/Services/FoodService.php b/app/Domains/FiestaFutbolInfantil/Services/FoodService.php index ff59c55..905bb7c 100644 --- a/app/Domains/FiestaFutbolInfantil/Services/FoodService.php +++ b/app/Domains/FiestaFutbolInfantil/Services/FoodService.php @@ -148,7 +148,7 @@ class FoodService 'category_id' => $category->id, 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, ]); return $food; @@ -163,7 +163,7 @@ class FoodService 'precio' => collect($variants)->min('price') ?? 0, 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, 'inventory_id' => null, ]); } diff --git a/app/Domains/FiestaFutbolInfantil/Services/MerchandiseService.php b/app/Domains/FiestaFutbolInfantil/Services/MerchandiseService.php index 463b8c7..7bab7fd 100644 --- a/app/Domains/FiestaFutbolInfantil/Services/MerchandiseService.php +++ b/app/Domains/FiestaFutbolInfantil/Services/MerchandiseService.php @@ -76,7 +76,7 @@ class MerchandiseService 'max_units_per_user' => (int) $data['max_units_per_user'], 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, ]); $itemAttributes = $this->itemAttributes($item, $attributes); @@ -203,7 +203,7 @@ class MerchandiseService 'max_units_per_user' => (int) $data['max_units_per_user'], 'event_product_type' => EventProductType::Product->value, 'inventory_policy' => InventoryPolicy::Tracked->value, - 'has_tickets' => false, + 'has_tickets' => true, 'inventory_id' => null, ]); } diff --git a/database/migrations/2026_08_10_000200_enable_tickets_for_fiesta_futbol_infantil_catalog.php b/database/migrations/2026_08_10_000200_enable_tickets_for_fiesta_futbol_infantil_catalog.php new file mode 100644 index 0000000..128c15c --- /dev/null +++ b/database/migrations/2026_08_10_000200_enable_tickets_for_fiesta_futbol_infantil_catalog.php @@ -0,0 +1,22 @@ +where('tenant_code', 'fiesta_futbol_infantil') + ->update(['has_tickets' => true]); + } + + public function down(): void + { + DB::table('catalog_items') + ->where('tenant_code', 'fiesta_futbol_infantil') + ->where('event_product_type', 'producto') + ->update(['has_tickets' => false]); + } +}; diff --git a/database/seeders/FiestaFutbolInfantilProductSeeder.php b/database/seeders/FiestaFutbolInfantilProductSeeder.php index fe7ae3e..32550cd 100644 --- a/database/seeders/FiestaFutbolInfantilProductSeeder.php +++ b/database/seeders/FiestaFutbolInfantilProductSeeder.php @@ -147,6 +147,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder 'descripcion' => $data['nombre'], 'inventory_policy' => InventoryPolicy::Unlimited->value, ...$data, + 'has_tickets' => true, ]); } diff --git a/tests/Feature/FiestaFutbolInfantil/AccommodationControllerTest.php b/tests/Feature/FiestaFutbolInfantil/AccommodationControllerTest.php index eb86981..e9ac69c 100644 --- a/tests/Feature/FiestaFutbolInfantil/AccommodationControllerTest.php +++ b/tests/Feature/FiestaFutbolInfantil/AccommodationControllerTest.php @@ -7,6 +7,7 @@ use App\Domains\Attachable\Models\Attachment; use App\Domains\Auth\Models\User; use App\Domains\Authorization\Enums\RoleCode; use App\Domains\Catalog\Models\Attribute; +use App\Domains\Catalog\Models\CatalogItem; use App\Domains\Menu\Models\Menu; use App\Domains\Shared\Enums\FieldType; use App\Domains\Tenant\Models\Tenant; @@ -75,6 +76,7 @@ class AccommodationControllerTest extends TestCase 'label' => 'Carpa', ]); $this->assertDatabaseCount('catalog_items', 1); + $this->assertTrue(CatalogItem::query()->sole()->has_tickets); $this->assertDatabaseCount('variantes', 2); $this->assertDatabaseCount('inventories', 2); $this->assertDatabaseCount('variant_values', 2); diff --git a/tests/Feature/FiestaFutbolInfantil/FoodControllerTest.php b/tests/Feature/FiestaFutbolInfantil/FoodControllerTest.php index 914dde5..581172f 100644 --- a/tests/Feature/FiestaFutbolInfantil/FoodControllerTest.php +++ b/tests/Feature/FiestaFutbolInfantil/FoodControllerTest.php @@ -89,6 +89,7 @@ class FoodControllerTest extends TestCase 'tenant_code' => $tenant->codigo, 'slug' => 'comida', 'nombre' => 'Comida', + 'has_tickets' => true, 'category_id' => Category::query() ->where('tenant_code', $tenant->codigo) ->where('nombre', 'Comidas') diff --git a/tests/Feature/FiestaFutbolInfantil/MerchandiseControllerTest.php b/tests/Feature/FiestaFutbolInfantil/MerchandiseControllerTest.php index c7b7e5b..bab3de6 100644 --- a/tests/Feature/FiestaFutbolInfantil/MerchandiseControllerTest.php +++ b/tests/Feature/FiestaFutbolInfantil/MerchandiseControllerTest.php @@ -90,6 +90,7 @@ class MerchandiseControllerTest extends TestCase 'precio' => 95000, 'max_units_per_user' => 3, 'inventory_policy' => 'tracked', + 'has_tickets' => true, ]); } diff --git a/tests/Feature/Seeders/FiestaFutbolInfantilProductSeederTest.php b/tests/Feature/Seeders/FiestaFutbolInfantilProductSeederTest.php index a0af0e5..f5104d6 100644 --- a/tests/Feature/Seeders/FiestaFutbolInfantilProductSeederTest.php +++ b/tests/Feature/Seeders/FiestaFutbolInfantilProductSeederTest.php @@ -56,6 +56,12 @@ class FiestaFutbolInfantilProductSeederTest extends TestCase ['abono', 'alojamiento', 'camiseta', 'comida'], CatalogItem::query()->where('tenant_code', $tenant->codigo)->orderBy('slug')->pluck('slug')->all(), ); + $this->assertTrue( + CatalogItem::query() + ->where('tenant_code', $tenant->codigo) + ->get() + ->every(fn (CatalogItem $item): bool => $item->has_tickets), + ); $expectedVariantCounts = [ 'camiseta' => 12,