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,8 +2,8 @@
namespace App\NotificationChannels;
use App\Contracts\NotificationChannel as NotificationChannelInterface;
use App\Models\NotificationChannel;
use App\NotificationChannels\NotificationChannel as NotificationChannelInterface;
abstract class AbstractNotificationChannel implements NotificationChannelInterface
{

View File

@ -2,8 +2,8 @@
namespace App\NotificationChannels;
use App\Contracts\Notification;
use App\Models\NotificationChannel;
use App\Notifications\NotificationInterface;
use Illuminate\Support\Facades\Http;
class Discord extends AbstractNotificationChannel
@ -59,7 +59,7 @@ private function checkConnection(string $subject, string $text): bool
return $connect->ok();
}
public function send(object $notifiable, Notification $notification): void
public function send(object $notifiable, NotificationInterface $notification): void
{
/** @var NotificationChannel $notifiable */
$this->notificationChannel = $notifiable;

View File

@ -2,9 +2,9 @@
namespace App\NotificationChannels;
use App\Contracts\Notification;
use App\Mail\NotificationMail;
use App\Models\NotificationChannel;
use App\NotificationChannels\Email\NotificationMail;
use App\Notifications\NotificationInterface;
use Illuminate\Support\Facades\Mail;
use Throwable;
@ -47,7 +47,7 @@ public function connect(): bool
return true;
}
public function send(object $notifiable, Notification $notification): void
public function send(object $notifiable, NotificationInterface $notification): void
{
/** @var NotificationChannel $notifiable */
$this->notificationChannel = $notifiable;

View File

@ -0,0 +1,25 @@
<?php
namespace App\NotificationChannels\Email;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class NotificationMail extends Mailable
{
use Queueable, SerializesModels;
public string $text;
public function __construct(string $subject, string $text)
{
$this->subject = $subject;
$this->text = $text;
}
public function build(): self
{
return $this->html($this->text);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\NotificationChannels;
use App\Notifications\NotificationInterface;
interface NotificationChannel
{
public function createRules(array $input): array;
public function createData(array $input): array;
public function data(): array;
public function connect(): bool;
public function send(object $notifiable, NotificationInterface $notification): void;
}

View File

@ -2,8 +2,8 @@
namespace App\NotificationChannels;
use App\Contracts\Notification;
use App\Models\NotificationChannel;
use App\Notifications\NotificationInterface;
use Illuminate\Support\Facades\Http;
class Slack extends AbstractNotificationChannel
@ -59,7 +59,7 @@ private function checkConnection(string $subject, string $text): bool
return $connect->ok();
}
public function send(object $notifiable, Notification $notification): void
public function send(object $notifiable, NotificationInterface $notification): void
{
/** @var NotificationChannel $notifiable */
$this->notificationChannel = $notifiable;

View File

@ -2,8 +2,8 @@
namespace App\NotificationChannels;
use App\Contracts\Notification;
use App\Models\NotificationChannel;
use App\Notifications\NotificationInterface;
use Illuminate\Support\Facades\Http;
use Throwable;
@ -46,7 +46,7 @@ public function connect(): bool
return true;
}
public function send(object $notifiable, Notification $notification): void
public function send(object $notifiable, NotificationInterface $notification): void
{
/** @var NotificationChannel $notifiable */
$this->notificationChannel = $notifiable;