Begin adding schedule processing jobs.
This commit is contained in:
parent
c0d7e02481
commit
c5f2dfd6f6
16 changed files with 626 additions and 49 deletions
|
@ -42,33 +42,28 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParentTasksWithChainCount($server)
|
||||
public function getTaskWithServer($id)
|
||||
{
|
||||
Assert::numeric($server, 'First argument passed to GetParentTasksWithChainCount must be numeric, received %s.');
|
||||
|
||||
return $this->getBuilder()->withCount('chained')->where([
|
||||
['server_id', '=', $server],
|
||||
['parent_task_id', '=', null],
|
||||
])->get($this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTaskForServer($task, $server)
|
||||
{
|
||||
Assert::numeric($task, 'First argument passed to getTaskForServer must be numeric, received %s.');
|
||||
Assert::numeric($server, 'Second argument passed to getTaskForServer must be numeric, received %s.');
|
||||
|
||||
$instance = $this->getBuilder()->with('chained')->where([
|
||||
['server_id', '=', $server],
|
||||
['parent_task_id', '=', null],
|
||||
])->find($task, $this->getColumns());
|
||||
Assert::integerish($id, 'First argument passed to getTaskWithServer must be numeric, received %s.');
|
||||
|
||||
$instance = $this->getBuilder()->with('server')->find($id, $this->getColumns());
|
||||
if (! $instance) {
|
||||
throw new RecordNotFoundException;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNextTask($schedule, $index)
|
||||
{
|
||||
Assert::integerish($schedule, 'First argument passed to getNextTask must be integer, received %s.');
|
||||
Assert::integerish($index, 'Second argument passed to getNextTask must be integer, received %s.');
|
||||
|
||||
return $this->getBuilder()->where('schedule_id', '=', $schedule)
|
||||
->where('sequence_id', '=', $index + 1)
|
||||
->first($this->getColumns());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue