2022-05-25 00:06:42 +02:00
|
|
|
<?php
|
2022-05-25 23:26:38 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
2022-05-25 00:06:42 +02:00
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Models\ScheduledJob;
|
|
|
|
use App\Models\Scheduler;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
class TaskSchedulerTransformer extends EntityTransformer
|
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
protected $defaultIncludes = [
|
|
|
|
'job'
|
|
|
|
];
|
|
|
|
|
|
|
|
public function includeJob(Scheduler $scheduler)
|
|
|
|
{
|
|
|
|
$transformer = new ScheduledJobTransformer($this->serializer);
|
|
|
|
|
|
|
|
return $this->item($scheduler->job, $transformer, ScheduledJob::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function transform(Scheduler $scheduler)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->encodePrimaryKey($scheduler->id),
|
2022-05-27 10:25:32 +02:00
|
|
|
'is_deleted' => (bool)$scheduler->is_deleted,
|
2022-05-25 23:26:38 +02:00
|
|
|
'paused' => (bool)$scheduler->paused,
|
|
|
|
'repeat_every' => (string)$scheduler->repeat_every,
|
|
|
|
'start_from' => (int)$scheduler->start_from,
|
|
|
|
'scheduled_run' => (int)$scheduler->scheduled_run,
|
|
|
|
'updated_at' => (int)$scheduler->updated_at,
|
|
|
|
'created_at' => (int)$scheduler->created_at,
|
2022-05-26 04:29:57 +02:00
|
|
|
'archived_at' => (int) $scheduler->deleted_at,
|
2022-05-25 00:06:42 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|