fix: service deletion

This commit is contained in:
Andras Bacsai
2024-01-31 09:58:41 +01:00
parent 1cef233db2
commit 0686e48e89
3 changed files with 8 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Jobs;
use App\Actions\Application\StopApplication;
use App\Actions\Database\StopDatabase;
use App\Actions\Service\DeleteService;
use App\Actions\Service\StopService;
use App\Models\Application;
use App\Models\Service;
use App\Models\StandaloneMariadb;
@@ -30,33 +31,21 @@ class DeleteResourceJob implements ShouldQueue, ShouldBeEncrypted
public function handle()
{
try {
$this->resource->forceDelete();
switch ($this->resource->type()) {
case 'application':
StopApplication::run($this->resource);
$this->resource->forceDelete();
break;
case 'standalone-postgresql':
StopDatabase::run($this->resource);
$this->resource->forceDelete();
break;
case 'standalone-redis':
StopDatabase::run($this->resource);
$this->resource->forceDelete();
break;
case 'standalone-mongodb':
StopDatabase::run($this->resource);
$this->resource->forceDelete();
break;
case 'standalone-mysql':
StopDatabase::run($this->resource);
$this->resource->forceDelete();
break;
case 'standalone-mariadb':
StopDatabase::run($this->resource);
$this->resource->forceDelete();
break;
case 'service':
DeleteService::dispatch($this->resource);
StopService::run($this->resource);
DeleteService::run($this->resource);
break;
}
} catch (\Throwable $e) {