mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Truemaps for fast lookup
This commit is contained in:
parent
2b3795224d
commit
d444bb66b8
1 changed files with 18 additions and 10 deletions
|
|
@ -16,16 +16,24 @@ class Operation extends Validator
|
|||
'data',
|
||||
];
|
||||
|
||||
/** @var array<string> */
|
||||
/** @var array<string, bool> */
|
||||
private array $requiresDocumentId = [
|
||||
'create' => true,
|
||||
'update' => true,
|
||||
'upsert' => true,
|
||||
'delete' => true,
|
||||
];
|
||||
|
||||
/** @var array<string, bool> */
|
||||
private array $actions = [
|
||||
'create',
|
||||
'update',
|
||||
'upsert',
|
||||
'delete',
|
||||
'bulkCreate',
|
||||
'bulkUpdate',
|
||||
'bulkUpsert',
|
||||
'bulkDelete',
|
||||
'create' => true,
|
||||
'update' => true,
|
||||
'upsert' => true,
|
||||
'delete' => true,
|
||||
'bulkCreate' => true,
|
||||
'bulkUpdate' => true,
|
||||
'bulkUpsert' => true,
|
||||
'bulkDelete' => true,
|
||||
];
|
||||
|
||||
public function getDescription(): string
|
||||
|
|
@ -66,7 +74,7 @@ class Operation extends Validator
|
|||
}
|
||||
|
||||
// Validate action
|
||||
if (!\in_array($value['action'], $this->actions, true)) {
|
||||
if (!isset($this->actions[$value['action']])) {
|
||||
$this->description = "Key 'action' must be one of: " . \implode(', ', $this->actions);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue