mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
misc: name fixes.
This commit is contained in:
parent
4e83fc856a
commit
44a5fef345
14 changed files with 49 additions and 30 deletions
|
|
@ -23,7 +23,7 @@ class Create extends Action
|
|||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'createBooleanColumn';
|
||||
return 'createBooleanAttribute';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string|array
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class Update extends Action
|
|||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'updateBooleanColumn';
|
||||
return 'updateBooleanAttribute';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string|array
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Get extends Action
|
|||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'getColumn';
|
||||
return 'getAttribute';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string|array
|
||||
|
|
@ -44,7 +44,7 @@ class Get extends Action
|
|||
$this
|
||||
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
|
||||
->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/attributes/:key')
|
||||
->desc('Get column')
|
||||
->desc('Get attribute')
|
||||
->groups(['api', 'database'])
|
||||
->label('scope', 'collections.read')
|
||||
->label('resourceType', RESOURCE_TYPE_DATABASES)
|
||||
|
|
@ -63,7 +63,7 @@ class Get extends Action
|
|||
))
|
||||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('tableId', '', new UID(), 'Table ID.')
|
||||
->param('key', '', new Key(), 'Column Key.')
|
||||
->param('key', '', new Key(), 'Attribute Key.')
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->callback([$this, 'action']);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Appwrite\SDK\AuthType;
|
|||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Database\Validator\Queries\Attributes;
|
||||
use Appwrite\Utopia\Database\Validator\Queries\Columns;
|
||||
use Appwrite\Utopia\Response as UtopiaResponse;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
|
|
@ -57,7 +56,7 @@ class XList extends Action
|
|||
))
|
||||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('collectionId', '', new UID(), 'Collection ID.')
|
||||
->param('queries', [], new Columns(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Attributes::ALLOWED_ATTRIBUTES), true)
|
||||
->param('queries', [], new Attributes(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Attributes::ALLOWED_ATTRIBUTES), true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->callback([$this, 'action']);
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ class Create extends Action
|
|||
|
||||
$relationships = \array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
|
|
@ -261,7 +261,7 @@ class Create extends Action
|
|||
|
||||
$relationships = \array_filter(
|
||||
$table->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
|
|
@ -300,10 +300,10 @@ class Create extends Action
|
|||
->dynamic($document, $this->getResponseModel());
|
||||
|
||||
$relationships = \array_map(
|
||||
fn ($row) => $document->getAttribute('key'),
|
||||
fn ($document) => $document->getAttribute('key'),
|
||||
\array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class Get extends Action
|
|||
|
||||
$relationships = \array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class Update extends Action
|
|||
|
||||
$relationships = \array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
|
|
@ -256,7 +256,7 @@ class Update extends Action
|
|||
|
||||
$relationships = \array_filter(
|
||||
$table->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
|
|
@ -290,7 +290,7 @@ class Update extends Action
|
|||
fn ($row) => $document->getAttribute('key'),
|
||||
\array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
fn ($column) => $column->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -212,12 +212,12 @@ class XList extends Action
|
|||
}
|
||||
|
||||
if ($select) {
|
||||
foreach ($documents as $row) {
|
||||
foreach ($documents as $document) {
|
||||
if (!$hasDatabaseId) {
|
||||
$row->removeAttribute('$databaseId');
|
||||
$document->removeAttribute('$databaseId');
|
||||
}
|
||||
if (!$hasCollectionId) {
|
||||
$row->removeAttribute('$collectionId');
|
||||
$document->removeAttribute('$collectionId');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,23 +150,23 @@ class Create extends Action
|
|||
throw new Exception($this->getParentUnknownException(), "Unknown $contextType: " . $attribute . ". Verify the $contextType name or create the $contextType.");
|
||||
}
|
||||
|
||||
$columnStatus = $oldAttributes[$attributeIndex]['status'];
|
||||
$columnType = $oldAttributes[$attributeIndex]['type'];
|
||||
$columnArray = $oldAttributes[$attributeIndex]['array'] ?? false;
|
||||
$attributeStatus = $oldAttributes[$attributeIndex]['status'];
|
||||
$attributeType = $oldAttributes[$attributeIndex]['type'];
|
||||
$attributeArray = $oldAttributes[$attributeIndex]['array'] ?? false;
|
||||
|
||||
if ($columnType === Database::VAR_RELATIONSHIP) {
|
||||
if ($attributeType === Database::VAR_RELATIONSHIP) {
|
||||
throw new Exception($this->getParentInvalidTypeException(), "Cannot create an index for a relationship $contextType: " . $oldAttributes[$attributeIndex]['key']);
|
||||
}
|
||||
|
||||
// ensure attribute is available
|
||||
if ($columnStatus !== 'available') {
|
||||
if ($attributeStatus !== 'available') {
|
||||
$contextType = ucfirst($contextType);
|
||||
throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']);
|
||||
}
|
||||
|
||||
$lengths[$i] = null;
|
||||
|
||||
if ($columnArray === true) {
|
||||
if ($attributeArray === true) {
|
||||
$lengths[$i] = Database::ARRAY_INDEX_LENGTH;
|
||||
$orders[$i] = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ class Create extends IndexCreate
|
|||
{
|
||||
use HTTP;
|
||||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'createColumnIndex';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string
|
||||
{
|
||||
return UtopiaResponse::MODEL_COLUMN_INDEX;
|
||||
|
|
@ -44,7 +49,7 @@ class Create extends IndexCreate
|
|||
->label('sdk', new Method(
|
||||
namespace: $this->getSdkNamespace(),
|
||||
group: $this->getSdkGroup(),
|
||||
name: self::getName(),
|
||||
name: 'createIndex', // getName needs to be different from parent action to avoid conflict in path name
|
||||
description: '/docs/references/databases/create-index.md',
|
||||
auth: [AuthType::KEY],
|
||||
responses: [
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ class Delete extends IndexDelete
|
|||
{
|
||||
use HTTP;
|
||||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'updateColumnIndex';
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. `SDKResponse` uses `UtopiaResponse::MODEL_NONE`.
|
||||
* 2. But we later need the actual return type for events queue below!
|
||||
|
|
@ -46,7 +51,7 @@ class Delete extends IndexDelete
|
|||
->label('sdk', new Method(
|
||||
namespace: $this->getSdkNamespace(),
|
||||
group: $this->getSdkGroup(),
|
||||
name: self::getName(),
|
||||
name: 'deleteIndex', // getName needs to be different from parent action to avoid conflict in path name
|
||||
description: '/docs/references/databases/delete-index.md',
|
||||
auth: [AuthType::KEY],
|
||||
responses: [
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ class Get extends IndexGet
|
|||
{
|
||||
use HTTP;
|
||||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'getColumnIndex';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string
|
||||
{
|
||||
return UtopiaResponse::MODEL_COLUMN_INDEX;
|
||||
|
|
@ -37,7 +42,7 @@ class Get extends IndexGet
|
|||
->label('sdk', new Method(
|
||||
namespace: $this->getSdkNamespace(),
|
||||
group: $this->getSdkGroup(),
|
||||
name: self::getName(),
|
||||
name: 'getIndex', // getName needs to be different from parent action to avoid conflict in path name
|
||||
description: '/docs/references/databases/get-index.md',
|
||||
auth: [AuthType::KEY],
|
||||
responses: [
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ class XList extends IndexXList
|
|||
{
|
||||
use HTTP;
|
||||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'listColumnIndexes';
|
||||
}
|
||||
|
||||
protected function getResponseModel(): string
|
||||
{
|
||||
return UtopiaResponse::MODEL_COLUMN_INDEX_LIST;
|
||||
|
|
@ -37,7 +42,7 @@ class XList extends IndexXList
|
|||
->label('sdk', new Method(
|
||||
namespace: $this->getSdkNamespace(),
|
||||
group: $this->getSdkGroup(),
|
||||
name: self::getName(),
|
||||
name: 'listIndexes', // getName needs to be different from parent action to avoid conflict in path name
|
||||
description: '/docs/references/databases/list-indexes.md',
|
||||
auth: [AuthType::KEY],
|
||||
responses: [
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Tables extends Base
|
|||
{
|
||||
$this->registerTableActions($service);
|
||||
$this->registerColumnActions($service);
|
||||
$this->registerColumnIndexActions($service);
|
||||
$this->registerIndexActions($service);
|
||||
$this->registerRowActions($service);
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class Tables extends Base
|
|||
$service->addAction(UpdateURL::getName(), new UpdateURL());
|
||||
}
|
||||
|
||||
private function registerColumnIndexActions(Service $service): void
|
||||
private function registerIndexActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateColumnIndex::getName(), new CreateColumnIndex());
|
||||
$service->addAction(GetColumnIndex::getName(), new GetColumnIndex());
|
||||
|
|
|
|||
Loading…
Reference in a new issue