Fix index models

This commit is contained in:
Jake Barnby 2025-07-23 19:48:29 +12:00
parent 898365a922
commit 1f60bb1aa6
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
2 changed files with 37 additions and 26 deletions

View file

@ -11,6 +11,24 @@ class ColumnIndex extends Model
public function __construct()
{
$this
->addRule('$id', [
'type' => self::TYPE_STRING,
'description' => 'Index ID.',
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$createdAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index creation date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('$updatedAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index update date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('key', [
'type' => self::TYPE_STRING,
'description' => 'Index Key.',
@ -56,18 +74,6 @@ class ColumnIndex extends Model
'example' => [],
'array' => true,
'required' => false,
])
->addRule('$createdAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index creation date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('$updatedAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index update date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
]);
}
@ -89,7 +95,6 @@ class ColumnIndex extends Model
public function filter(Document $document): Document
{
$columns = $document->getAttribute('attributes', []);
$document
->removeAttribute('attributes')

View file

@ -10,9 +10,27 @@ class Index extends Model
public function __construct()
{
$this
->addRule('$id', [
'type' => self::TYPE_STRING,
'description' => 'Index ID.',
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$createdAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index creation date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('$updatedAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index update date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('key', [
'type' => self::TYPE_STRING,
'description' => 'Index Key.',
'description' => 'Index key.',
'default' => '',
'example' => 'index1',
])
@ -55,18 +73,6 @@ class Index extends Model
'example' => [],
'array' => true,
'required' => false,
])
->addRule('$createdAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index creation date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('$updatedAt', [
'type' => self::TYPE_DATETIME,
'description' => 'Index update date in ISO 8601 format.',
'default' => '',
'example' => self::TYPE_DATETIME_EXAMPLE,
]);
}