From d30fd565733df843c038eb83b7ae418f09ac0901 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 5 May 2025 14:04:39 +0530 Subject: [PATCH] patch: index module to use/specify `columns` instead of `attributes`. --- src/Appwrite/Utopia/Response/Model/Index.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/Index.php b/src/Appwrite/Utopia/Response/Model/Index.php index 2d795ad439..e18a9db334 100644 --- a/src/Appwrite/Utopia/Response/Model/Index.php +++ b/src/Appwrite/Utopia/Response/Model/Index.php @@ -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; + + } }