feat: activity page
This commit is contained in:
parent
f418b36167
commit
19395b4869
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\Shared\Application\QueryHandler;
|
||||
|
||||
use App\Domain\Shared\Application\Query\GetJobById;
|
||||
use App\Domain\Shared\Application\Response\JobResponse;
|
||||
use App\Domain\Shared\Domain\Contract\QueryHandlerInterface;
|
||||
use App\Domain\Shared\Domain\Contract\QueryInterface;
|
||||
use App\Domain\Shared\Domain\Contract\ResponseInterface;
|
||||
use App\Domain\Shared\Domain\Contract\JobRepositoryInterface;
|
||||
|
||||
readonly class GetJobByIdHandler implements QueryHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private JobRepositoryInterface $jobRepository
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(QueryInterface $query): ResponseInterface
|
||||
{
|
||||
if (!$query instanceof GetJobById) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Query must be instance of %s, %s given',
|
||||
GetJobById::class,
|
||||
get_class($query)
|
||||
));
|
||||
}
|
||||
|
||||
$job = $this->jobRepository->get($query->id);
|
||||
|
||||
return JobResponse::fromJob($job);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user