feat: remove EventProductType references and related logic from catalog and fiesta futbol infantil components

This commit is contained in:
2026-08-10 16:37:28 -03:00
parent 5bfc8b9f70
commit 69320c54d4
21 changed files with 90 additions and 79 deletions

View File

@@ -1,15 +0,0 @@
<?php
namespace App\Domains\Catalog\Enums;
enum EventProductType: string
{
case Entry = 'entrada';
case Product = 'producto';
/** @return list<string> */
public static function values(): array
{
return array_column(self::cases(), 'value');
}
}

View File

@@ -4,7 +4,6 @@ namespace App\Domains\Catalog\Models;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Catalog\Enums\CatalogItemType;
use App\Domains\Catalog\Enums\EventProductType;
use App\Domains\Catalog\Enums\InventoryPolicy;
use App\Domains\Catalog\Services\CatalogInventoryService;
use App\Domains\Tenant\Models\Tenant;
@@ -20,7 +19,6 @@ use Illuminate\Support\Collection;
#[Fillable([
'tenant_code',
'event_product_type',
'category_id',
'brand_id',
'inventory_id',
@@ -54,7 +52,6 @@ class CatalogItem extends Model
'category_id' => 'integer',
'brand_id' => 'integer',
'inventory_id' => 'integer',
'event_product_type' => EventProductType::class,
'type' => CatalogItemType::class,
'precio' => 'decimal:2',
'inventory_policy' => InventoryPolicy::class,

View File

@@ -3,7 +3,6 @@
namespace App\Domains\Catalog\Requests;
use App\Domains\Catalog\Enums\CatalogItemType;
use App\Domains\Catalog\Enums\EventProductType;
use App\Domains\Catalog\Enums\InventoryPolicy;
use App\Domains\Shared\Rules\ImageOrBase64Rule;
use Illuminate\Foundation\Http\FormRequest;
@@ -26,11 +25,6 @@ class StoreCatalogItemRequest extends FormRequest
return [
'tenant_code' => ['prohibited'],
'type' => ['sometimes', Rule::enum(CatalogItemType::class)],
'event_product_type' => [
'sometimes',
'nullable',
Rule::enum(EventProductType::class),
],
'category_id' => [
'sometimes',
'nullable',

View File

@@ -24,7 +24,6 @@ class CatalogItemDetailResource extends JsonResource
return [
'id' => $this->id,
'type' => $this->type->value,
'event_product_type' => $this->event_product_type?->value,
'category_id' => $this->category_id,
'brand_id' => $this->brand_id,
'slug' => $this->slug,

View File

@@ -16,7 +16,6 @@ class CatalogItemResource extends JsonResource
return [
'id' => $this->id,
'type' => $this->type->value,
'event_product_type' => $this->event_product_type?->value,
'category_id' => $this->category_id,
'brand_id' => $this->brand_id,
'slug' => $this->slug,

View File

@@ -5,7 +5,6 @@ namespace App\Domains\Catalog\Services;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Attachable\Services\AttachmentService;
use App\Domains\Catalog\Enums\CatalogItemType;
use App\Domains\Catalog\Enums\EventProductType;
use App\Domains\Catalog\Models\Attribute;
use App\Domains\Catalog\Models\CatalogItem;
use App\Domains\Catalog\Models\Category;
@@ -65,7 +64,6 @@ class CatalogService
]);
}
$this->validateEventProductType($data);
$this->validateUniqueVariantCombinations($variants, $attributeCodes);
if ($type === CatalogItemType::Bundle) {
@@ -622,22 +620,6 @@ class CatalogService
return $variant;
}
/** @param array<string, mixed> $data */
private function validateEventProductType(array $data): void
{
$eventProductType = $data['event_product_type'] ?? null;
if ($eventProductType === null) {
return;
}
if (! in_array($eventProductType, EventProductType::values(), true)) {
throw ValidationException::withMessages([
'event_product_type' => [__('api.catalog.invalid_event_product_type')],
]);
}
}
/**
* @param array<int, array<string, mixed>> $variants
* @param array<int, string> $attributeCodes