feat: enable ticketing for Fiesta Futbol Infantil catalog items; update services, migrations, seeders, and tests to reflect changes
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('catalog_items')
|
||||
->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]);
|
||||
}
|
||||
};
|
||||
@@ -147,6 +147,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
'descripcion' => $data['nombre'],
|
||||
'inventory_policy' => InventoryPolicy::Unlimited->value,
|
||||
...$data,
|
||||
'has_tickets' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -90,6 +90,7 @@ class MerchandiseControllerTest extends TestCase
|
||||
'precio' => 95000,
|
||||
'max_units_per_user' => 3,
|
||||
'inventory_policy' => 'tracked',
|
||||
'has_tickets' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user