Remove redundant param

This commit is contained in:
Jake Barnby 2025-08-20 16:53:22 +12:00
parent 8b905d0388
commit a2d7c3c138
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
3 changed files with 24 additions and 5 deletions

View file

@ -0,0 +1,23 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\Databases;
use Utopia\Platform\Action as UtopiaAction;
class Action extends UtopiaAction
{
private string $context = 'legacy';
public function getDatabaseType(): string
{
return $this->context;
}
public function setHttpPath(string $path): UtopiaAction
{
if (\str_contains($path, '/tablesdb')) {
$this->context = 'tablesdb';
}
return parent::setHttpPath($path);
}
}

View file

@ -19,11 +19,9 @@ use Utopia\Database\Exception\Index as IndexException;
use Utopia\Database\Exception\Limit as LimitException;
use Utopia\Database\Exception\Structure as StructureException;
use Utopia\Database\Helpers\ID;
use Utopia\Platform\Action;
use Utopia\Swoole\Response as SwooleResponse;
use Utopia\Validator\Boolean;
use Utopia\Validator\Text;
use Utopia\Validator\WhiteList;
class Create extends Action
{
@ -67,7 +65,6 @@ class Create extends Action
->param('databaseId', '', new CustomId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Database name. Max length: 128 chars.')
->param('enabled', true, new Boolean(), 'Is the database enabled? When set to \'disabled\', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.', true)
->param('type', 'tablesdb', new WhiteList(['tablesdb','legacy']), 'Database type.', true)
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
@ -84,7 +81,7 @@ class Create extends Action
'name' => $name,
'enabled' => $enabled,
'search' => implode(' ', [$databaseId, $name]),
'type' => $type
'type' => $this->getDatabaseType(),
]));
} catch (DuplicateException) {
throw new Exception(Exception::DATABASE_ALREADY_EXISTS);

View file

@ -50,7 +50,6 @@ class Create extends DatabaseCreate
->param('databaseId', '', new CustomId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Database name. Max length: 128 chars.')
->param('enabled', true, new Boolean(), 'Is the database enabled? When set to \'disabled\', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.', true)
->param('type', 'tablesdb', new WhiteList(['tablesdb','legacy']), 'Database type.', true)
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')