Added notification on job fail
All checks were successful
Push image to registry / build-image (push) Successful in 5m20s

This commit is contained in:
2025-03-01 15:12:15 +01:00
parent 025711e09d
commit 6a95653c52
7 changed files with 107 additions and 6 deletions

View File

@ -4,6 +4,7 @@ namespace App\Notification;
use App\Models\Job;
use App\Notification\Stringifiable\StringifiableSimpleText;
use function PHPUnit\Framework\isNull;
abstract class Notification {
@ -12,12 +13,18 @@ abstract class Notification {
public bool $isError;
public function __construct(int $jobId, NotificationBody $body, bool $isError = false) {
public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) {
$this->job = Job::find($jobId);
$this->body = $body;
if (!isNull($body)) {
$this->body = $body;
}
$this->isError = $isError;
}
public function setBody(NotificationBody $body) {
$this->body = $body;
}
public function getTitle(): Stringifiable {
return new StringifiableSimpleText($this->job->name);
}