Refactor: Remove unused parameters and clean up code in TablesDB and Sites modules

This commit is contained in:
shimon 2025-11-29 19:13:18 +02:00
parent d3fac8ae07
commit c5a45aaded
5 changed files with 9 additions and 19 deletions

View file

@ -2,8 +2,6 @@
namespace Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Indexes;
use Appwrite\Event\Database as EventDatabase;
use Appwrite\Event\Event;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Create as IndexCreate;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
@ -11,7 +9,6 @@ use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Key;
use Utopia\Database\Validator\UID;
use Utopia\Swoole\Response as SwooleResponse;
@ -73,11 +70,4 @@ class Create extends IndexCreate
->callback($this->action(...));
}
public function action(string $databaseId, string $tableId, string $key, string $type, array $columns, array $orders, array $lengths, UtopiaResponse $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents, Authorization $authorization): void
{
// Map TablesDB parameters to Collections API parameters
// tableId -> collectionId
// columns -> attributes
parent::action($databaseId, $tableId, $key, $type, $columns, $orders, $lengths, $response, $dbForProject, $queueForDatabase, $queueForEvents, $authorization);
}
}

View file

@ -80,6 +80,7 @@ class Create extends Action
->inject('request')
->inject('response')
->inject('dbForProject')
->inject('dbForPlatform')
->inject('project')
->inject('queueForEvents')
->inject('deviceForSites')
@ -100,6 +101,7 @@ class Create extends Action
Request $request,
Response $response,
Database $dbForProject,
Database $dbForPlatform,
Document $project,
Event $queueForEvents,
Device $deviceForSites,

View file

@ -97,7 +97,6 @@ class Update extends Base
->inject('dbForPlatform')
->inject('gitHub')
->inject('executor')
->inject('authorization')
->callback($this->action(...));
}
@ -128,8 +127,7 @@ class Update extends Base
Build $queueForBuilds,
Database $dbForPlatform,
GitHub $github,
Executor $executor,
Authorization $authorization
Executor $executor
) {
if (!empty($adapter)) {
$configFramework = Config::getParam('frameworks')[$framework] ?? [];

View file

@ -149,10 +149,10 @@ class V20 extends Filter
}
try {
$collection = $dbForProject->getDocument(
$collection = $database = $dbForProject->getAuthorization()->skip(fn () =>$dbForProject->getDocument(
'database_' . $database->getSequence(),
$collectionId
);
));
if ($collection->isEmpty()) {
return [];
}

View file

@ -776,7 +776,7 @@ class ProjectsConsoleClientTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('Account Verification for {{project}}', $response['body']['subject']);
$this->assertEquals('Account Verification', $response['body']['subject']);
$this->assertEquals('', $response['body']['senderEmail']);
$this->assertEquals('verification', $response['body']['type']);
$this->assertEquals('en-us', $response['body']['locale']);
@ -879,7 +879,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals('Project Test', $response['body']['name']);
$this->assertEquals('Project Test 2', $response['body']['name']);
$this->assertArrayHasKey('platforms', $response['body']);
$this->assertArrayHasKey('webhooks', $response['body']);
$this->assertArrayHasKey('keys', $response['body']);
@ -3132,7 +3132,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertContains('users.write', $response['body']['scopes']);
$this->assertContains('collections.read', $response['body']['scopes']);
$this->assertContains('tables.read', $response['body']['scopes']);
$this->assertCount(4, $response['body']['scopes']);
$this->assertCount(3, $response['body']['scopes']);
$this->assertArrayHasKey('sdks', $response['body']);
$this->assertEmpty($response['body']['sdks']);
$this->assertArrayHasKey('accessedAt', $response['body']);
@ -3151,7 +3151,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertContains('users.write', $response['body']['scopes']);
$this->assertContains('collections.read', $response['body']['scopes']);
$this->assertContains('tables.read', $response['body']['scopes']);
$this->assertCount(4, $response['body']['scopes']);
$this->assertCount(3, $response['body']['scopes']);
$this->assertArrayHasKey('sdks', $response['body']);
$this->assertEmpty($response['body']['sdks']);
$this->assertArrayHasKey('accessedAt', $response['body']);