mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
patch: index module to use/specify columns instead of attributes.
This commit is contained in:
parent
71ad9c203e
commit
d30fd56573
1 changed files with 14 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue