Files
api/services/nginx/app/objects/edge_gateway_update_jobs_o.php
T
Jeppe Bundgaard d30a006457 Add delivery metadata support, preferred channels, and enhanced agent validation
This commit introduces delivery metadata tracking for gateway commands, updates, and shells. Adds preferred delivery channel handling, refined validation for edge agents, improved relay management logic, and broker presence reporting. Includes schema changes, enhanced shell handling, and test coverage.
2026-04-16 13:44:28 +02:00

79 lines
3.7 KiB
PHP

<?php
namespace objects;
use classes\db;
use classes\edge_gateway_schema_bootstrap;
use classes\object_property;
use traits\db_object_t;
class edge_gateway_update_jobs_o extends db
{
use db_object_t;
public object_property $gateway_id;
public object_property $command_job_id;
public object_property $target_version;
public object_property $release_channel;
public object_property $status;
public object_property $requested_by;
public object_property $requested_at;
public object_property $started_at;
public object_property $completed_at;
public object_property $delivery_json;
public object_property $result_json;
public object_property $created_at;
public object_property $updated_at;
public object_property $deleted_at;
public function structure(): void
{
edge_gateway_schema_bootstrap::ensureTables();
$this->setTable('edge_gateway_update_jobs');
}
public function getObjectProperties(): void
{
$this->gateway_id = new object_property($this->table, $this->id, 'gateway_id', 'int', false);
$this->command_job_id = new object_property($this->table, $this->id, 'command_job_id', 'int', false);
$this->target_version = new object_property($this->table, $this->id, 'target_version', 'string', false);
$this->release_channel = new object_property($this->table, $this->id, 'release_channel', 'string', false);
$this->status = new object_property($this->table, $this->id, 'status', 'string', false);
$this->requested_by = new object_property($this->table, $this->id, 'requested_by', 'int', false);
$this->requested_at = new object_property($this->table, $this->id, 'requested_at', 'string', false);
$this->started_at = new object_property($this->table, $this->id, 'started_at', 'string', false);
$this->completed_at = new object_property($this->table, $this->id, 'completed_at', 'string', false);
$this->delivery_json = new object_property($this->table, $this->id, 'delivery_json', 'json', false);
$this->result_json = new object_property($this->table, $this->id, 'result_json', 'json', false);
$this->created_at = new object_property($this->table, $this->id, 'created_at', 'timestamp', false);
$this->updated_at = new object_property($this->table, $this->id, 'updated_at', 'timestamp', false);
$this->deleted_at = new object_property($this->table, $this->id, 'deleted_at', 'timestamp', false);
}
public function objectChanged(): void
{
}
public function asArray(): array
{
$this->requireSelected();
return [
'id' => (int)$this->id,
'gateway_id' => (int)$this->gateway_id->value(),
'command_job_id' => $this->command_job_id->value() === null ? null : (int)$this->command_job_id->value(),
'target_version' => (string)$this->target_version->value(),
'release_channel' => (string)$this->release_channel->value(),
'status' => (string)$this->status->value(),
'requested_by' => $this->requested_by->value() === null ? null : (int)$this->requested_by->value(),
'requested_at' => (string)$this->requested_at->value(),
'started_at' => $this->started_at->value() === null ? null : (string)$this->started_at->value(),
'completed_at' => $this->completed_at->value() === null ? null : (string)$this->completed_at->value(),
'delivery' => (array)($this->delivery_json->value() ?? []),
'result' => (array)($this->result_json->value() ?? []),
'created_at' => (string)$this->created_at->value(),
'updated_at' => $this->updated_at->value() === null ? null : (string)$this->updated_at->value(),
];
}
}