mirror of
https://github.com/appwrite/appwrite
synced 2026-05-06 06:48:22 +00:00
update: split service registrations into smaller registries.
This commit is contained in:
parent
c4a26fbb95
commit
4e83fc856a
5 changed files with 347 additions and 159 deletions
|
|
@ -2,61 +2,9 @@
|
|||
|
||||
namespace Appwrite\Platform\Modules\Databases\Services;
|
||||
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Create as CreateCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Delete as DeleteCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Get as GetCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Logs\XList as ListCollectionLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Update as UpdateCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\Usage\Get as GetCollectionUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Collections\XList as ListCollections;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Boolean\Create as CreateBoolean;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Boolean\Update as UpdateBoolean;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Datetime\Create as CreateDatetime;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Datetime\Update as UpdateDatetime;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Delete as DeleteColumn;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Email\Create as CreateEmail;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Email\Update as UpdateEmail;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Enum\Create as CreateEnum;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Enum\Update as UpdateEnum;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Float\Create as CreateFloat;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Float\Update as UpdateFloat;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Get as GetColumn;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Integer\Create as CreateInteger;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Integer\Update as UpdateInteger;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\IP\Create as CreateIP;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\IP\Update as UpdateIP;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Relationship\Create as CreateRelationship;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\Relationship\Update as UpdateRelationship;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\String\Create as CreateString;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\String\Update as UpdateString;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\URL\Create as CreateURL;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\URL\Update as UpdateURL;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Columns\XList as ListColumns;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Create as CreateDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Delete as DeleteDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Get as GetDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Logs\XList as ListDatabaseLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Update as UpdateDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\Get as GetDatabaseUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\XList as ListDatabaseUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\XList as ListDatabases;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Indexes\Create as CreateIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Indexes\Delete as DeleteIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Indexes\Get as GetIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Indexes\XList as ListIndexes;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\Create as CreateRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\Delete as DeleteRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\Get as GetRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\Logs\XList as ListRowLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\Update as UpdateRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Rows\XList as ListRows;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Create as CreateTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Delete as DeleteTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Get as GetTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Logs\XList as ListTableLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Update as UpdateTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\Usage\Get as GetTableUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Tables\XList as ListTables;
|
||||
use Appwrite\Platform\Modules\Databases\Services\Registry\Collections as CollectionsRegistry;
|
||||
use Appwrite\Platform\Modules\Databases\Services\Registry\Databases as DatabasesRegistry;
|
||||
use Appwrite\Platform\Modules\Databases\Services\Registry\Tables as TablesRegistry;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
class Http extends Service
|
||||
|
|
@ -65,109 +13,12 @@ class Http extends Service
|
|||
{
|
||||
$this->type = Service::TYPE_HTTP;
|
||||
|
||||
$this->registerDatabaseActions();
|
||||
$this->registerCollectionAndTableActions();
|
||||
$this->registerColumnActions();
|
||||
$this->registerIndexActions();
|
||||
$this->registerRowActions();
|
||||
}
|
||||
|
||||
private function registerDatabaseActions(): void
|
||||
{
|
||||
$this->addAction(CreateDatabase::getName(), new CreateDatabase());
|
||||
$this->addAction(GetDatabase::getName(), new GetDatabase());
|
||||
$this->addAction(UpdateDatabase::getName(), new UpdateDatabase());
|
||||
$this->addAction(DeleteDatabase::getName(), new DeleteDatabase());
|
||||
$this->addAction(ListDatabases::getName(), new ListDatabases());
|
||||
$this->addAction(ListDatabaseLogs::getName(), new ListDatabaseLogs());
|
||||
$this->addAction(GetDatabaseUsage::getName(), new GetDatabaseUsage());
|
||||
$this->addAction(ListDatabaseUsage::getName(), new ListDatabaseUsage());
|
||||
}
|
||||
|
||||
private function registerCollectionAndTableActions(): void
|
||||
{
|
||||
// Collections
|
||||
$this->addAction(CreateCollection::getName(), new CreateCollection());
|
||||
$this->addAction(GetCollection::getName(), new GetCollection());
|
||||
$this->addAction(UpdateCollection::getName(), new UpdateCollection());
|
||||
$this->addAction(DeleteCollection::getName(), new DeleteCollection());
|
||||
$this->addAction(ListCollections::getName(), new ListCollections());
|
||||
$this->addAction(ListCollectionLogs::getName(), new ListCollectionLogs());
|
||||
$this->addAction(GetCollectionUsage::getName(), new GetCollectionUsage());
|
||||
|
||||
// Tables
|
||||
$this->addAction(CreateTable::getName(), new CreateTable());
|
||||
$this->addAction(GetTable::getName(), new GetTable());
|
||||
$this->addAction(UpdateTable::getName(), new UpdateTable());
|
||||
$this->addAction(DeleteTable::getName(), new DeleteTable());
|
||||
$this->addAction(ListTables::getName(), new ListTables());
|
||||
$this->addAction(ListTableLogs::getName(), new ListTableLogs());
|
||||
$this->addAction(GetTableUsage::getName(), new GetTableUsage());
|
||||
}
|
||||
|
||||
private function registerColumnActions(): void
|
||||
{
|
||||
// Column top level actions
|
||||
$this->addAction(GetColumn::getName(), new GetColumn());
|
||||
$this->addAction(DeleteColumn::getName(), new DeleteColumn());
|
||||
$this->addAction(ListColumns::getName(), new ListColumns());
|
||||
|
||||
// Column: Boolean
|
||||
$this->addAction(CreateBoolean::getName(), new CreateBoolean());
|
||||
$this->addAction(UpdateBoolean::getName(), new UpdateBoolean());
|
||||
|
||||
// Column: Datetime
|
||||
$this->addAction(CreateDatetime::getName(), new CreateDatetime());
|
||||
$this->addAction(UpdateDatetime::getName(), new UpdateDatetime());
|
||||
|
||||
// Column: Email
|
||||
$this->addAction(CreateEmail::getName(), new CreateEmail());
|
||||
$this->addAction(UpdateEmail::getName(), new UpdateEmail());
|
||||
|
||||
// Column: Enum
|
||||
$this->addAction(CreateEnum::getName(), new CreateEnum());
|
||||
$this->addAction(UpdateEnum::getName(), new UpdateEnum());
|
||||
|
||||
// Column: Float
|
||||
$this->addAction(CreateFloat::getName(), new CreateFloat());
|
||||
$this->addAction(UpdateFloat::getName(), new UpdateFloat());
|
||||
|
||||
// Column: Integer
|
||||
$this->addAction(CreateInteger::getName(), new CreateInteger());
|
||||
$this->addAction(UpdateInteger::getName(), new UpdateInteger());
|
||||
|
||||
// Column: IP
|
||||
$this->addAction(CreateIP::getName(), new CreateIP());
|
||||
$this->addAction(UpdateIP::getName(), new UpdateIP());
|
||||
|
||||
// Column: Relationship
|
||||
$this->addAction(CreateRelationship::getName(), new CreateRelationship());
|
||||
$this->addAction(UpdateRelationship::getName(), new UpdateRelationship());
|
||||
|
||||
// Column: String
|
||||
$this->addAction(CreateString::getName(), new CreateString());
|
||||
$this->addAction(UpdateString::getName(), new UpdateString());
|
||||
|
||||
// Column: URL
|
||||
$this->addAction(CreateURL::getName(), new CreateURL());
|
||||
$this->addAction(UpdateURL::getName(), new UpdateURL());
|
||||
}
|
||||
|
||||
private function registerIndexActions(): void
|
||||
{
|
||||
$this->addAction(CreateIndex::getName(), new CreateIndex());
|
||||
$this->addAction(GetIndex::getName(), new GetIndex());
|
||||
$this->addAction(DeleteIndex::getName(), new DeleteIndex());
|
||||
$this->addAction(ListIndexes::getName(), new ListIndexes());
|
||||
}
|
||||
|
||||
private function registerRowActions(): void
|
||||
{
|
||||
$this->addAction(CreateRow::getName(), new CreateRow());
|
||||
$this->addAction(GetRow::getName(), new GetRow());
|
||||
$this->addAction(UpdateRow::getName(), new UpdateRow());
|
||||
$this->addAction(DeleteRow::getName(), new DeleteRow());
|
||||
$this->addAction(ListRows::getName(), new ListRows());
|
||||
$this->addAction(ListRowLogs::getName(), new ListRowLogs());
|
||||
foreach ([
|
||||
DatabasesRegistry::class,
|
||||
CollectionsRegistry::class,
|
||||
TablesRegistry::class,
|
||||
] as $registrar) {
|
||||
new $registrar($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Databases\Services\Registry;
|
||||
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
/**
|
||||
* Abstract base class for service registrars in the Databases module.
|
||||
*/
|
||||
abstract class Base
|
||||
{
|
||||
/**
|
||||
* Constructs the registrar and triggers the registration of actions.
|
||||
*/
|
||||
public function __construct(Service $service)
|
||||
{
|
||||
$this->register($service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all HTTP actions related to this module.
|
||||
*/
|
||||
abstract protected function register(Service $service): void;
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Databases\Services\Registry;
|
||||
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Boolean\Create as CreateBooleanAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Boolean\Update as UpdateBooleanAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Datetime\Create as CreateDatetimeAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Datetime\Update as UpdateDatetimeAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Delete as DeleteAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Email\Create as CreateEmailAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Email\Update as UpdateEmailAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Enum\Create as CreateEnumAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Enum\Update as UpdateEnumAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Float\Create as CreateFloatAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Float\Update as UpdateFloatAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Get as GetAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Integer\Create as CreateIntegerAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Integer\Update as UpdateIntegerAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\IP\Create as CreateIPAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\IP\Update as UpdateIPAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Relationship\Create as CreateRelationshipAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Relationship\Update as UpdateRelationshipAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\String\Create as CreateStringAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\String\Update as UpdateStringAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\URL\Create as CreateURLAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\URL\Update as UpdateURLAttribute;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\XList as ListAttributes;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Create as CreateCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Delete as DeleteCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Create as CreateDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Delete as DeleteDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Get as GetDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Update as UpdateDocument;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\XList as ListDocuments;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Get as GetCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Create as CreateIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Delete as DeleteIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Get as GetIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\XList as ListIndexes;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Logs\XList as ListCollectionLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Update as UpdateCollection;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Usage\Get as GetCollectionUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\XList as ListCollections;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
/**
|
||||
* Registers all HTTP actions related to collections in the database module.
|
||||
*
|
||||
* This includes:
|
||||
* - Collections
|
||||
* - Documents
|
||||
* - Attributes
|
||||
* - Indexes
|
||||
*/
|
||||
class Collections extends Base
|
||||
{
|
||||
protected function register(Service $service): void
|
||||
{
|
||||
$this->registerCollectionActions($service);
|
||||
$this->registerDocumentActions($service);
|
||||
$this->registerAttributeActions($service);
|
||||
$this->registerIndexActions($service);
|
||||
}
|
||||
|
||||
private function registerCollectionActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateCollection::getName(), new CreateCollection());
|
||||
$service->addAction(GetCollection::getName(), new GetCollection());
|
||||
$service->addAction(UpdateCollection::getName(), new UpdateCollection());
|
||||
$service->addAction(DeleteCollection::getName(), new DeleteCollection());
|
||||
$service->addAction(ListCollections::getName(), new ListCollections());
|
||||
$service->addAction(ListCollectionLogs::getName(), new ListCollectionLogs());
|
||||
$service->addAction(GetCollectionUsage::getName(), new GetCollectionUsage());
|
||||
}
|
||||
|
||||
private function registerDocumentActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateDocument::getName(), new CreateDocument());
|
||||
$service->addAction(GetDocument::getName(), new GetDocument());
|
||||
$service->addAction(UpdateDocument::getName(), new UpdateDocument());
|
||||
$service->addAction(DeleteDocument::getName(), new DeleteDocument());
|
||||
$service->addAction(ListDocuments::getName(), new ListDocuments());
|
||||
}
|
||||
|
||||
private function registerAttributeActions(Service $service): void
|
||||
{
|
||||
// Attribute top-level actions
|
||||
$service->addAction(GetAttribute::getName(), new GetAttribute());
|
||||
$service->addAction(DeleteAttribute::getName(), new DeleteAttribute());
|
||||
$service->addAction(ListAttributes::getName(), new ListAttributes());
|
||||
|
||||
// Attribute: Boolean
|
||||
$service->addAction(CreateBooleanAttribute::getName(), new CreateBooleanAttribute());
|
||||
$service->addAction(UpdateBooleanAttribute::getName(), new UpdateBooleanAttribute());
|
||||
|
||||
// Attribute: Datetime
|
||||
$service->addAction(CreateDatetimeAttribute::getName(), new CreateDatetimeAttribute());
|
||||
$service->addAction(UpdateDatetimeAttribute::getName(), new UpdateDatetimeAttribute());
|
||||
|
||||
// Attribute: Email
|
||||
$service->addAction(CreateEmailAttribute::getName(), new CreateEmailAttribute());
|
||||
$service->addAction(UpdateEmailAttribute::getName(), new UpdateEmailAttribute());
|
||||
|
||||
// Attribute: Enum
|
||||
$service->addAction(CreateEnumAttribute::getName(), new CreateEnumAttribute());
|
||||
$service->addAction(UpdateEnumAttribute::getName(), new UpdateEnumAttribute());
|
||||
|
||||
// Attribute: Float
|
||||
$service->addAction(CreateFloatAttribute::getName(), new CreateFloatAttribute());
|
||||
$service->addAction(UpdateFloatAttribute::getName(), new UpdateFloatAttribute());
|
||||
|
||||
// Attribute: Integer
|
||||
$service->addAction(CreateIntegerAttribute::getName(), new CreateIntegerAttribute());
|
||||
$service->addAction(UpdateIntegerAttribute::getName(), new UpdateIntegerAttribute());
|
||||
|
||||
// Attribute: IP
|
||||
$service->addAction(CreateIPAttribute::getName(), new CreateIPAttribute());
|
||||
$service->addAction(UpdateIPAttribute::getName(), new UpdateIPAttribute());
|
||||
|
||||
// Attribute: Relationship
|
||||
$service->addAction(CreateRelationshipAttribute::getName(), new CreateRelationshipAttribute());
|
||||
$service->addAction(UpdateRelationshipAttribute::getName(), new UpdateRelationshipAttribute());
|
||||
|
||||
// Attribute: String
|
||||
$service->addAction(CreateStringAttribute::getName(), new CreateStringAttribute());
|
||||
$service->addAction(UpdateStringAttribute::getName(), new UpdateStringAttribute());
|
||||
|
||||
// Attribute: URL
|
||||
$service->addAction(CreateURLAttribute::getName(), new CreateURLAttribute());
|
||||
$service->addAction(UpdateURLAttribute::getName(), new UpdateURLAttribute());
|
||||
}
|
||||
|
||||
private function registerIndexActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateIndex::getName(), new CreateIndex());
|
||||
$service->addAction(GetIndex::getName(), new GetIndex());
|
||||
$service->addAction(DeleteIndex::getName(), new DeleteIndex());
|
||||
$service->addAction(ListIndexes::getName(), new ListIndexes());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Databases\Services\Registry;
|
||||
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Create as CreateDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Delete as DeleteDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Get as GetDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Logs\XList as ListDatabaseLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Update as UpdateDatabase;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\Get as GetDatabaseUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\XList as ListDatabaseUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\XList as ListDatabases;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
/**
|
||||
* Registers all HTTP actions related to database in the module.
|
||||
*/
|
||||
class Databases extends Base
|
||||
{
|
||||
public function register(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateDatabase::getName(), new CreateDatabase());
|
||||
$service->addAction(GetDatabase::getName(), new GetDatabase());
|
||||
$service->addAction(UpdateDatabase::getName(), new UpdateDatabase());
|
||||
$service->addAction(DeleteDatabase::getName(), new DeleteDatabase());
|
||||
$service->addAction(ListDatabases::getName(), new ListDatabases());
|
||||
$service->addAction(ListDatabaseLogs::getName(), new ListDatabaseLogs());
|
||||
$service->addAction(GetDatabaseUsage::getName(), new GetDatabaseUsage());
|
||||
$service->addAction(ListDatabaseUsage::getName(), new ListDatabaseUsage());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Databases\Services\Registry;
|
||||
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Boolean\Create as CreateBoolean;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Boolean\Update as UpdateBoolean;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Datetime\Create as CreateDatetime;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Datetime\Update as UpdateDatetime;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Delete as DeleteColumn;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Email\Create as CreateEmail;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Email\Update as UpdateEmail;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Enum\Create as CreateEnum;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Enum\Update as UpdateEnum;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Float\Create as CreateFloat;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Float\Update as UpdateFloat;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Get as GetColumn;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Integer\Create as CreateInteger;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Integer\Update as UpdateInteger;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\IP\Create as CreateIP;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\IP\Update as UpdateIP;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Relationship\Create as CreateRelationship;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\Relationship\Update as UpdateRelationship;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\String\Create as CreateString;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\String\Update as UpdateString;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\URL\Create as CreateURL;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\URL\Update as UpdateURL;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Columns\XList as ListColumns;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Create as CreateTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Delete as DeleteTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Get as GetTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Indexes\Create as CreateColumnIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Indexes\Delete as DeleteColumnIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Indexes\Get as GetColumnIndex;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Indexes\XList as ListColumnIndexes;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Logs\XList as ListTableLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\Create as CreateRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\Delete as DeleteRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\Get as GetRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\Logs\XList as ListRowLogs;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\Update as UpdateRow;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Rows\XList as ListRows;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Update as UpdateTable;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\Usage\Get as GetTableUsage;
|
||||
use Appwrite\Platform\Modules\Databases\Http\Databases\Tables\XList as ListTables;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
/**
|
||||
* Registers all HTTP actions related to tables in the database module.
|
||||
*
|
||||
* This includes:
|
||||
* - Tables
|
||||
* - Rows
|
||||
* - Columns
|
||||
* - Column-Indexes
|
||||
*/
|
||||
class Tables extends Base
|
||||
{
|
||||
protected function register(Service $service): void
|
||||
{
|
||||
$this->registerTableActions($service);
|
||||
$this->registerColumnActions($service);
|
||||
$this->registerColumnIndexActions($service);
|
||||
$this->registerRowActions($service);
|
||||
}
|
||||
|
||||
private function registerTableActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateTable::getName(), new CreateTable());
|
||||
$service->addAction(GetTable::getName(), new GetTable());
|
||||
$service->addAction(UpdateTable::getName(), new UpdateTable());
|
||||
$service->addAction(DeleteTable::getName(), new DeleteTable());
|
||||
$service->addAction(ListTables::getName(), new ListTables());
|
||||
$service->addAction(ListTableLogs::getName(), new ListTableLogs());
|
||||
$service->addAction(GetTableUsage::getName(), new GetTableUsage());
|
||||
}
|
||||
|
||||
private function registerColumnActions(Service $service): void
|
||||
{
|
||||
// Column top level actions
|
||||
$service->addAction(GetColumn::getName(), new GetColumn());
|
||||
$service->addAction(DeleteColumn::getName(), new DeleteColumn());
|
||||
$service->addAction(ListColumns::getName(), new ListColumns());
|
||||
|
||||
// Column: Boolean
|
||||
$service->addAction(CreateBoolean::getName(), new CreateBoolean());
|
||||
$service->addAction(UpdateBoolean::getName(), new UpdateBoolean());
|
||||
|
||||
// Column: Datetime
|
||||
$service->addAction(CreateDatetime::getName(), new CreateDatetime());
|
||||
$service->addAction(UpdateDatetime::getName(), new UpdateDatetime());
|
||||
|
||||
// Column: Email
|
||||
$service->addAction(CreateEmail::getName(), new CreateEmail());
|
||||
$service->addAction(UpdateEmail::getName(), new UpdateEmail());
|
||||
|
||||
// Column: Enum
|
||||
$service->addAction(CreateEnum::getName(), new CreateEnum());
|
||||
$service->addAction(UpdateEnum::getName(), new UpdateEnum());
|
||||
|
||||
// Column: Float
|
||||
$service->addAction(CreateFloat::getName(), new CreateFloat());
|
||||
$service->addAction(UpdateFloat::getName(), new UpdateFloat());
|
||||
|
||||
// Column: Integer
|
||||
$service->addAction(CreateInteger::getName(), new CreateInteger());
|
||||
$service->addAction(UpdateInteger::getName(), new UpdateInteger());
|
||||
|
||||
// Column: IP
|
||||
$service->addAction(CreateIP::getName(), new CreateIP());
|
||||
$service->addAction(UpdateIP::getName(), new UpdateIP());
|
||||
|
||||
// Column: Relationship
|
||||
$service->addAction(CreateRelationship::getName(), new CreateRelationship());
|
||||
$service->addAction(UpdateRelationship::getName(), new UpdateRelationship());
|
||||
|
||||
// Column: String
|
||||
$service->addAction(CreateString::getName(), new CreateString());
|
||||
$service->addAction(UpdateString::getName(), new UpdateString());
|
||||
|
||||
// Column: URL
|
||||
$service->addAction(CreateURL::getName(), new CreateURL());
|
||||
$service->addAction(UpdateURL::getName(), new UpdateURL());
|
||||
}
|
||||
|
||||
private function registerColumnIndexActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateColumnIndex::getName(), new CreateColumnIndex());
|
||||
$service->addAction(GetColumnIndex::getName(), new GetColumnIndex());
|
||||
$service->addAction(DeleteColumnIndex::getName(), new DeleteColumnIndex());
|
||||
$service->addAction(ListColumnIndexes::getName(), new ListColumnIndexes());
|
||||
}
|
||||
|
||||
private function registerRowActions(Service $service): void
|
||||
{
|
||||
$service->addAction(CreateRow::getName(), new CreateRow());
|
||||
$service->addAction(GetRow::getName(), new GetRow());
|
||||
$service->addAction(UpdateRow::getName(), new UpdateRow());
|
||||
$service->addAction(DeleteRow::getName(), new DeleteRow());
|
||||
$service->addAction(ListRows::getName(), new ListRows());
|
||||
$service->addAction(ListRowLogs::getName(), new ListRowLogs());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue