Refactor VM provisioning pipeline into focused services and add IP pool
management
This commit is contained in:
@@ -64,6 +64,7 @@ class ProductController extends Controller
|
||||
'product_categories_id' => 'nullable|integer|exists:product_categories,id',
|
||||
'product_type' => 'nullable|string',
|
||||
'category' => 'nullable|string|max:255',
|
||||
'thumbnail' => 'nullable|string|max:2048',
|
||||
'is_active' => 'boolean',
|
||||
'setup_fee' => 'nullable|numeric|min:0',
|
||||
'cpu' => 'nullable|numeric|min:0',
|
||||
@@ -93,6 +94,7 @@ class ProductController extends Controller
|
||||
'slug' => Str::slug($validated['name']),
|
||||
'product_categories_id' => $validated['product_categories_id'] ?? null,
|
||||
'product_type' => $productType,
|
||||
'thumbnail' => ($validated['thumbnail'] ?? null) ?: null,
|
||||
'is_active' => $validated['is_active'] ?? true,
|
||||
'setup_fee' => $validated['setup_fee'] ?? 0,
|
||||
'cpu' => $validated['cpu'] ?? null,
|
||||
@@ -123,6 +125,7 @@ class ProductController extends Controller
|
||||
'name' => 'sometimes|required|string|max:255',
|
||||
'product_categories_id' => 'nullable|integer|exists:product_categories,id',
|
||||
'product_type' => 'nullable|string',
|
||||
'thumbnail' => 'nullable|string|max:2048',
|
||||
'is_active' => 'boolean',
|
||||
'setup_fee' => 'nullable|numeric|min:0',
|
||||
'cpu' => 'nullable|numeric|min:0',
|
||||
@@ -153,6 +156,10 @@ class ProductController extends Controller
|
||||
$validated['product_type'] = $category?->type;
|
||||
}
|
||||
|
||||
if (array_key_exists('thumbnail', $validated) && $validated['thumbnail'] === '') {
|
||||
$validated['thumbnail'] = null;
|
||||
}
|
||||
|
||||
// Handle OS associations via product_os table
|
||||
$osIds = $validated['os_ids'] ?? null;
|
||||
unset($validated['os_ids']);
|
||||
|
||||
@@ -22,6 +22,7 @@ class ProductResource extends JsonResource
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'thumbnail' => $this->thumbnail,
|
||||
'product_type' => $this->product_type,
|
||||
'page_type' => $this->resolvePageType($this->product_type),
|
||||
'product_categories_id' => $this->whenLoaded('category', fn() => $this->category?->id),
|
||||
|
||||
Reference in New Issue
Block a user