2020-02-09 00:23:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Task;
|
2022-12-15 01:05:46 +01:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2020-02-09 00:23:08 +01:00
|
|
|
|
2022-12-15 01:05:46 +01:00
|
|
|
class TaskTransformer extends Transformer
|
2020-02-09 00:23:08 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return Task::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transforms a schedule's task into a client viewable format.
|
|
|
|
*/
|
2022-10-14 18:59:20 +02:00
|
|
|
public function transform(Task $model): array
|
2020-02-09 00:23:08 +01:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $model->id,
|
|
|
|
'sequence_id' => $model->sequence_id,
|
|
|
|
'action' => $model->action,
|
|
|
|
'payload' => $model->payload,
|
|
|
|
'time_offset' => $model->time_offset,
|
|
|
|
'is_queued' => $model->is_queued,
|
2021-05-01 19:44:40 +02:00
|
|
|
'continue_on_failure' => $model->continue_on_failure,
|
2022-12-15 01:05:46 +01:00
|
|
|
'created_at' => self::formatTimestamp($model->created_at),
|
|
|
|
'updated_at' => self::formatTimestamp($model->updated_at),
|
2020-02-09 00:23:08 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|