feat: activity page
This commit is contained in:
parent
f418b36167
commit
19395b4869
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\Shared\Application\CommandHandler;
|
||||
|
||||
use App\Domain\Shared\Application\Command\DeleteJob;
|
||||
use App\Domain\Shared\Domain\Contract\CommandHandlerInterface;
|
||||
use App\Domain\Shared\Domain\Contract\CommandInterface;
|
||||
use App\Domain\Shared\Domain\Contract\JobRepositoryInterface;
|
||||
|
||||
readonly class DeleteJobHandler implements CommandHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private JobRepositoryInterface $jobRepository
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(CommandInterface $command): void
|
||||
{
|
||||
if (!$command instanceof DeleteJob) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Command must be instance of %s, %s given',
|
||||
DeleteJob::class,
|
||||
get_class($command)
|
||||
));
|
||||
}
|
||||
|
||||
$this->jobRepository->get($command->id);
|
||||
$this->jobRepository->delete($command->id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user