Refactor VM provisioning pipeline into focused services and add IP pool

management
This commit is contained in:
baodev0
2026-05-29 12:03:35 +07:00
parent 6bb4a47bfb
commit 7ae237ee9d
32 changed files with 1170 additions and 1200 deletions
@@ -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']);