refactoring (#116)

- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
This commit is contained in:
Saeed Vaziry
2024-03-14 20:03:43 +01:00
committed by GitHub
parent cee4a70c3c
commit 428140b931
472 changed files with 24110 additions and 8159 deletions

View File

@ -2,12 +2,8 @@
namespace App\Models;
use Exception;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @property int $site_id
@ -52,11 +48,6 @@ public function sourceControl(): BelongsTo
return $this->belongsTo(SourceControl::class);
}
public function scopeHasEvent(Builder $query, string $event): Builder
{
return $query->where('events', 'like', "%\"{$event}\"%");
}
public function deployHook(): void
{
$this->update(
@ -64,19 +55,9 @@ public function deployHook(): void
);
}
/**
* @throws Throwable
*/
public function destroyHook(): void
{
DB::beginTransaction();
try {
$this->sourceControl->provider()->destroyHook($this->site->repository, $this->hook_id);
$this->delete();
DB::commit();
} catch (Exception $e) {
DB::rollBack();
throw $e;
}
$this->sourceControl->provider()->destroyHook($this->site->repository, $this->hook_id);
$this->delete();
}
}