mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
update: address minor comments by coderabbitai.
This commit is contained in:
parent
6493759536
commit
b55521e3de
4 changed files with 15 additions and 16 deletions
|
|
@ -451,11 +451,11 @@ abstract class Action extends UtopiaAction
|
|||
throw new Exception($this->getNotAvailableException());
|
||||
}
|
||||
|
||||
if ($attribute->getAttribute(('type') !== $type)) {
|
||||
if ($attribute->getAttribute('type') !== $type) {
|
||||
throw new Exception($this->getTypeInvalidException());
|
||||
}
|
||||
|
||||
if ($attribute->getAttribute('type') === Database::VAR_STRING && $attribute->getAttribute(('filter') !== $filter)) {
|
||||
if ($attribute->getAttribute('type') === Database::VAR_STRING && $attribute->getAttribute('filter') !== $filter) {
|
||||
throw new Exception($this->getTypeInvalidException());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Create extends Action
|
|||
->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/attributes/boolean')
|
||||
->desc('Create boolean attribute')
|
||||
->groups(['api', 'database', 'schema'])
|
||||
->label('event', 'databases.[databaseId].collections.[collectionId].collections.[attributeId].create')
|
||||
->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create')
|
||||
->label('scope', 'collections.write')
|
||||
->label('resourceType', RESOURCE_TYPE_DATABASES)
|
||||
->label('audits.event', 'attribute.create')
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Create extends Action
|
|||
]
|
||||
))
|
||||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('tableId', '', new UID(), 'Collection ID.')
|
||||
->param('collectionId', '', new UID(), 'Collection ID.')
|
||||
->param('key', '', new Key(), 'Attribute Key.')
|
||||
->param('required', null, new Boolean(), 'Is attribute required?')
|
||||
->param('default', null, new Email(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true)
|
||||
|
|
@ -68,20 +68,20 @@ class Create extends Action
|
|||
}
|
||||
|
||||
public function action(
|
||||
string $databaseId,
|
||||
string $tableId,
|
||||
string $key,
|
||||
?bool $required,
|
||||
?string $default,
|
||||
bool $array,
|
||||
string $databaseId,
|
||||
string $collectionId,
|
||||
string $key,
|
||||
?bool $required,
|
||||
?string $default,
|
||||
bool $array,
|
||||
UtopiaResponse $response,
|
||||
Database $dbForProject,
|
||||
EventDatabase $queueForDatabase,
|
||||
Event $queueForEvents
|
||||
Database $dbForProject,
|
||||
EventDatabase $queueForDatabase,
|
||||
Event $queueForEvents
|
||||
): void {
|
||||
$attribute = $this->createAttribute(
|
||||
$databaseId,
|
||||
$tableId,
|
||||
$collectionId,
|
||||
new Document([
|
||||
'key' => $key,
|
||||
'type' => Database::VAR_STRING,
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ class XList extends Action
|
|||
$cursorDocument = $dbForProject->getDocument('database_' . $database->getInternalId(), $collectionIdId);
|
||||
|
||||
if ($cursorDocument->isEmpty()) {
|
||||
$message =
|
||||
throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, ucfirst($this->getContext()) . " '$collectionIdId' for the 'cursor' value not found.");
|
||||
throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, ucfirst($this->getContext()) . " '$collectionIdId' for the 'cursor' value not found.");
|
||||
}
|
||||
|
||||
$cursor->setValue($cursorDocument);
|
||||
|
|
|
|||
Loading…
Reference in a new issue