wowowowowo
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\Services\CreateStatefulServiceUpdateOperation;
|
||||
use App\Actions\Services\ResolveServiceImageDigest;
|
||||
use App\Enums\ServiceType;
|
||||
use App\Http\Requests\StoreServiceUpdateRequest;
|
||||
use App\Models\Organisation;
|
||||
@@ -33,6 +34,7 @@ class ServiceUpdateController extends Controller
|
||||
CreateStatefulServiceUpdateOperation $createStatefulServiceUpdateOperation,
|
||||
): RedirectResponse {
|
||||
abort_unless((int) $server->organisation_id === (int) $organisation->id && (int) $service->server_id === (int) $server->id, 404);
|
||||
abort_unless($request->string('confirmation')->toString() === $service->name, 422);
|
||||
|
||||
$createStatefulServiceUpdateOperation->execute(
|
||||
service: $service,
|
||||
@@ -45,4 +47,26 @@ class ServiceUpdateController extends Controller
|
||||
'server' => $server->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function resolve(
|
||||
Organisation $organisation,
|
||||
Server $server,
|
||||
Service $service,
|
||||
ResolveServiceImageDigest $resolveServiceImageDigest,
|
||||
): RedirectResponse {
|
||||
abort_unless((int) $server->organisation_id === (int) $organisation->id && (int) $service->server_id === (int) $server->id, 404);
|
||||
abort_unless(in_array($service->type, [ServiceType::POSTGRES, ServiceType::VALKEY], true), 404);
|
||||
|
||||
$service->update([
|
||||
'available_image_digest' => $resolveServiceImageDigest->execute($service),
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('service-updates.create', [
|
||||
'organisation' => $organisation->id,
|
||||
'server' => $server->id,
|
||||
'service' => $service->id,
|
||||
])
|
||||
->with('success', 'Latest image digest resolved.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user