mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 00:18:25 +00:00
update: collection response model to table.
This commit is contained in:
parent
d184d1c7b1
commit
8504fbc0b9
3 changed files with 22 additions and 22 deletions
|
|
@ -31,7 +31,7 @@ use Appwrite\Utopia\Response\Model\AuthProvider;
|
|||
use Appwrite\Utopia\Response\Model\BaseList;
|
||||
use Appwrite\Utopia\Response\Model\Branch;
|
||||
use Appwrite\Utopia\Response\Model\Bucket;
|
||||
use Appwrite\Utopia\Response\Model\Collection;
|
||||
use Appwrite\Utopia\Response\Model\Table;
|
||||
use Appwrite\Utopia\Response\Model\ConsoleVariables;
|
||||
use Appwrite\Utopia\Response\Model\Continent;
|
||||
use Appwrite\Utopia\Response\Model\Country;
|
||||
|
|
@ -160,8 +160,8 @@ class Response extends SwooleResponse
|
|||
// Database
|
||||
public const MODEL_DATABASE = 'database';
|
||||
public const MODEL_DATABASE_LIST = 'databaseList';
|
||||
public const MODEL_COLLECTION = 'collection';
|
||||
public const MODEL_COLLECTION_LIST = 'collectionList';
|
||||
public const MODEL_TABLE = 'table';
|
||||
public const MODEL_TABLE_LIST = 'tableList';
|
||||
public const MODEL_INDEX = 'index';
|
||||
public const MODEL_INDEX_LIST = 'indexList';
|
||||
public const MODEL_DOCUMENT = 'document';
|
||||
|
|
@ -376,8 +376,8 @@ class Response extends SwooleResponse
|
|||
->setModel(new Error())
|
||||
->setModel(new ErrorDev())
|
||||
// Lists
|
||||
->setModel(new BaseList('Documents List', self::MODEL_DOCUMENT_LIST, 'documents', self::MODEL_DOCUMENT))
|
||||
->setModel(new BaseList('Collections List', self::MODEL_COLLECTION_LIST, 'collections', self::MODEL_COLLECTION))
|
||||
->setModel(new BaseList('Rows List', self::MODEL_DOCUMENT_LIST, 'rows', self::MODEL_DOCUMENT))
|
||||
->setModel(new BaseList('Tables List', self::MODEL_TABLE_LIST, 'tables', self::MODEL_TABLE))
|
||||
->setModel(new BaseList('Databases List', self::MODEL_DATABASE_LIST, 'databases', self::MODEL_DATABASE))
|
||||
->setModel(new BaseList('Indexes List', self::MODEL_INDEX_LIST, 'indexes', self::MODEL_INDEX))
|
||||
->setModel(new BaseList('Users List', self::MODEL_USER_LIST, 'users', self::MODEL_USER))
|
||||
|
|
@ -428,7 +428,7 @@ class Response extends SwooleResponse
|
|||
->setModel(new BaseList('VCS Content List', self::MODEL_VCS_CONTENT_LIST, 'contents', self::MODEL_VCS_CONTENT))
|
||||
// Entities
|
||||
->setModel(new Database())
|
||||
->setModel(new Collection())
|
||||
->setModel(new Table())
|
||||
->setModel(new Attribute())
|
||||
->setModel(new AttributeList())
|
||||
->setModel(new AttributeString())
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@ class BaseList extends Model
|
|||
|
||||
if ($paging) {
|
||||
$namesWithCap = [
|
||||
'documents', 'collections', 'users', 'files', 'buckets', 'functions',
|
||||
'rows', 'tables', 'users', 'files', 'buckets', 'functions',
|
||||
'deployments', 'executions', 'projects', 'webhooks', 'keys',
|
||||
'platforms', 'rules', 'memberships', 'teams'
|
||||
];
|
||||
|
||||
if (\in_array($name, $namesWithCap)) {
|
||||
$description = 'Total number of ' . $key . ' documents that matched your query used as reference for offset pagination. When the `total` number of ' . $key . ' documents available is greater than 5000, total returned will be capped at 5000, and cursor pagination should be used. Read more about [pagination](https://appwrite.io/docs/pagination).';
|
||||
$description = 'Total number of ' . $key . ' rows that matched your query used as reference for offset pagination. When the `total` number of ' . $key . ' rows available is greater than 5000, total returned will be capped at 5000, and cursor pagination should be used. Read more about [pagination](https://appwrite.io/docs/pagination).';
|
||||
} else {
|
||||
$description = 'Total number of ' . $key . ' documents that matched your query.';
|
||||
$description = 'Total number of ' . $key . ' rows that matched your query.';
|
||||
}
|
||||
|
||||
$this->addRule('total', [
|
||||
|
|
|
|||
|
|
@ -5,32 +5,32 @@ namespace Appwrite\Utopia\Response\Model;
|
|||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class Collection extends Model
|
||||
class Table extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('$id', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Collection ID.',
|
||||
'description' => 'Table ID.',
|
||||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$createdAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Collection creation date in ISO 8601 format.',
|
||||
'description' => 'Table creation date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('$updatedAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Collection update date in ISO 8601 format.',
|
||||
'description' => 'Table update date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('$permissions', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).',
|
||||
'description' => 'Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).',
|
||||
'default' => '',
|
||||
'example' => ['read("any")'],
|
||||
'array' => true
|
||||
|
|
@ -43,13 +43,13 @@ class Collection extends Model
|
|||
])
|
||||
->addRule('name', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Collection name.',
|
||||
'description' => 'Table name.',
|
||||
'default' => '',
|
||||
'example' => 'My Collection',
|
||||
'example' => 'My Table',
|
||||
])
|
||||
->addRule('enabled', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Collection enabled. Can be \'enabled\' or \'disabled\'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys.',
|
||||
'description' => 'Table enabled. Can be \'enabled\' or \'disabled\'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys.',
|
||||
'default' => true,
|
||||
'example' => false,
|
||||
])
|
||||
|
|
@ -59,7 +59,7 @@ class Collection extends Model
|
|||
'default' => '',
|
||||
'example' => true,
|
||||
])
|
||||
->addRule('attributes', [
|
||||
->addRule('columns', [
|
||||
'type' => [
|
||||
Response::MODEL_ATTRIBUTE_BOOLEAN,
|
||||
Response::MODEL_ATTRIBUTE_INTEGER,
|
||||
|
|
@ -72,14 +72,14 @@ class Collection extends Model
|
|||
Response::MODEL_ATTRIBUTE_RELATIONSHIP,
|
||||
Response::MODEL_ATTRIBUTE_STRING, // needs to be last, since its condition would dominate any other string attribute
|
||||
],
|
||||
'description' => 'Collection attributes.',
|
||||
'description' => 'Table columns.',
|
||||
'default' => [],
|
||||
'example' => new \stdClass(),
|
||||
'array' => true,
|
||||
])
|
||||
->addRule('indexes', [
|
||||
'type' => Response::MODEL_INDEX,
|
||||
'description' => 'Collection indexes.',
|
||||
'description' => 'Table indexes.',
|
||||
'default' => [],
|
||||
'example' => new \stdClass(),
|
||||
'array' => true
|
||||
|
|
@ -94,7 +94,7 @@ class Collection extends Model
|
|||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'Collection';
|
||||
return 'Table';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -104,6 +104,6 @@ class Collection extends Model
|
|||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return Response::MODEL_COLLECTION;
|
||||
return Response::MODEL_TABLE;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue