feat: activity page
This commit is contained in:
parent
f418b36167
commit
19395b4869
41
src/Domain/Shared/Application/Response/JobResponse.php
Normal file
41
src/Domain/Shared/Application/Response/JobResponse.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\Shared\Application\Response;
|
||||
|
||||
use App\Domain\Shared\Domain\Contract\ResponseInterface;
|
||||
use App\Domain\Shared\Domain\Model\Job;
|
||||
|
||||
readonly class JobResponse implements ResponseInterface
|
||||
{
|
||||
public function __construct(
|
||||
public string $id,
|
||||
public string $type,
|
||||
public string $status,
|
||||
public \DateTimeImmutable $createdAt,
|
||||
public ?\DateTimeImmutable $startedAt,
|
||||
public ?\DateTimeImmutable $completedAt,
|
||||
public ?string $failureReason,
|
||||
public int $attempts,
|
||||
public int $maxAttempts,
|
||||
public array $context
|
||||
) {
|
||||
}
|
||||
|
||||
public static function fromJob(Job $job): self
|
||||
{
|
||||
return new self(
|
||||
id: $job->id,
|
||||
type: $job->type,
|
||||
status: $job->status->value,
|
||||
createdAt: $job->createdAt,
|
||||
startedAt: $job->startedAt,
|
||||
completedAt: $job->completedAt,
|
||||
failureReason: $job->failureReason,
|
||||
attempts: $job->attempts,
|
||||
maxAttempts: $job->maxAttempts,
|
||||
context: $job->context
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user