Repo Interface für tests
This commit is contained in:
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobStatus;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ScheduledJobRepository
|
||||
class ScheduledJobRepository implements ScheduledJobRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false
|
||||
{
|
||||
|
||||
30
lib/Repository/Scheduler/ScheduledJobRepositoryInterface.php
Normal file
30
lib/Repository/Scheduler/ScheduledJobRepositoryInterface.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface ScheduledJobRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByKey(string $jobKey): ?array;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listDueJobs(string $nowUtc, int $limit = 20): array;
|
||||
|
||||
public function updateJobMeta(int $id, array $data): bool;
|
||||
|
||||
public function markRunning(int $id, string $startedAtUtc): bool;
|
||||
|
||||
public function finishRun(
|
||||
int $id,
|
||||
string $status,
|
||||
string $startedAtUtc,
|
||||
string $finishedAtUtc,
|
||||
?string $nextRunAtUtc,
|
||||
?string $errorCode,
|
||||
?string $errorMessage
|
||||
): bool;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ScheduledJobRunRepository
|
||||
class ScheduledJobRunRepository implements ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function listPagedByJobId(int $jobId, array $filters): array;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Scheduler;
|
||||
use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult;
|
||||
use MintyPHP\DB;
|
||||
|
||||
class SchedulerRuntimeRepository
|
||||
class SchedulerRuntimeRepository implements SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool;
|
||||
|
||||
public function findStatus(): ?array;
|
||||
}
|
||||
Reference in New Issue
Block a user