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.
79 lines
3.7 KiB
PHP
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_command_jobs_o extends db
|
|
{
|
|
use db_object_t;
|
|
|
|
public object_property $gateway_id;
|
|
public object_property $command_type;
|
|
public object_property $status;
|
|
public object_property $request_json;
|
|
public object_property $response_json;
|
|
public object_property $delivery_json;
|
|
public object_property $correlation_id;
|
|
public object_property $requested_by;
|
|
public object_property $requested_at;
|
|
public object_property $completed_at;
|
|
public object_property $error_message;
|
|
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_command_jobs');
|
|
}
|
|
|
|
public function getObjectProperties(): void
|
|
{
|
|
$this->gateway_id = new object_property($this->table, $this->id, 'gateway_id', 'int', false);
|
|
$this->command_type = new object_property($this->table, $this->id, 'command_type', 'string', false);
|
|
$this->status = new object_property($this->table, $this->id, 'status', 'string', false);
|
|
$this->request_json = new object_property($this->table, $this->id, 'request_json', 'json', false);
|
|
$this->response_json = new object_property($this->table, $this->id, 'response_json', 'json', false);
|
|
$this->delivery_json = new object_property($this->table, $this->id, 'delivery_json', 'json', false);
|
|
$this->correlation_id = new object_property($this->table, $this->id, 'correlation_id', '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->completed_at = new object_property($this->table, $this->id, 'completed_at', 'string', false);
|
|
$this->error_message = new object_property($this->table, $this->id, 'error_message', 'text', 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_type' => (string)$this->command_type->value(),
|
|
'status' => (string)$this->status->value(),
|
|
'request' => (array)($this->request_json->value() ?? []),
|
|
'response' => (array)($this->response_json->value() ?? []),
|
|
'delivery' => (array)($this->delivery_json->value() ?? []),
|
|
'correlation_id' => (string)$this->correlation_id->value(),
|
|
'requested_by' => $this->requested_by->value() === null ? null : (int)$this->requested_by->value(),
|
|
'requested_at' => (string)$this->requested_at->value(),
|
|
'completed_at' => $this->completed_at->value() === null ? null : (string)$this->completed_at->value(),
|
|
'error_message' => $this->error_message->value() === null ? null : (string)$this->error_message->value(),
|
|
'created_at' => (string)$this->created_at->value(),
|
|
'updated_at' => $this->updated_at->value() === null ? null : (string)$this->updated_at->value(),
|
|
];
|
|
}
|
|
}
|