Add base bulk operation models and envvars

This commit is contained in:
Bradley Schofield 2024-11-11 12:36:58 +09:00
parent 59c233b1e5
commit 2a8ab8d610
3 changed files with 44 additions and 0 deletions

1
.env
View file

@ -33,6 +33,7 @@ _APP_DB_SCHEMA=appwrite
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_DB_ROOT_PASS=rootsecretpassword
_APP_DATABASE_BATCH_SIZE=10_000
_APP_STORAGE_DEVICE=Local
_APP_STORAGE_S3_ACCESS_KEY=
_APP_STORAGE_S3_SECRET=

View file

@ -31,6 +31,7 @@ use Appwrite\Utopia\Response\Model\BaseList;
use Appwrite\Utopia\Response\Model\Branch;
use Appwrite\Utopia\Response\Model\Bucket;
use Appwrite\Utopia\Response\Model\Build;
use Appwrite\Utopia\Response\Model\BulkOperation;
use Appwrite\Utopia\Response\Model\Collection;
use Appwrite\Utopia\Response\Model\ConsoleVariables;
use Appwrite\Utopia\Response\Model\Continent;
@ -151,6 +152,7 @@ class Response extends SwooleResponse
public const MODEL_INDEX_LIST = 'indexList';
public const MODEL_DOCUMENT = 'document';
public const MODEL_DOCUMENT_LIST = 'documentList';
public const MODEL_BULK_OPERATION = 'bulkOperation';
// Database Attributes
public const MODEL_ATTRIBUTE = 'attribute';
@ -482,6 +484,7 @@ class Response extends SwooleResponse
->setModel(new Migration())
->setModel(new MigrationReport())
->setModel(new MigrationFirebaseProject())
->setModel(new BulkOperation())
// Tests (keep last)
->setModel(new Mock());

View file

@ -0,0 +1,40 @@
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class BulkOperation extends Model
{
public function __construct()
{
$this
->addRule('modified', [
'type' => self::TYPE_INTEGER,
'description' => 'Total number of documents affected by the operation.',
'default' => 0,
'example' => 64,
]);
}
/**
* Get Name
*
* @return string
*/
public function getName(): string
{
return 'BulkOperation';
}
/**
* Get Type
*
* @return string
*/
public function getType(): string
{
return Response::MODEL_BULK_OPERATION;
}
}