patch: index module to use/specify columns instead of attributes.

This commit is contained in:
Darshan 2025-05-05 14:04:39 +05:30
parent 71ad9c203e
commit d30fd56573

View file

@ -4,6 +4,7 @@ namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
use Utopia\Database\Document;
class Index extends Model
{
@ -34,7 +35,7 @@ class Index extends Model
'default' => '',
'example' => 'string',
])
->addRule('attributes', [
->addRule('columns', [
'type' => self::TYPE_STRING,
'description' => 'Index attributes.',
'default' => [],
@ -78,4 +79,16 @@ class Index extends Model
{
return Response::MODEL_INDEX;
}
public function filter(Document $document): Document
{
$columns = $document->getAttribute('attributes', []);
$document
->removeAttribute('attributes')
->setAttribute('columns', $columns);
return $document;
}
}