Merge remote-tracking branch 'origin/feat-decouple-collections' into feat-response-models-new-attributes

This commit is contained in:
kodumbeats 2021-08-23 17:45:31 -04:00
commit 65fbf03290
5 changed files with 11 additions and 15 deletions

View file

@ -136,7 +136,7 @@ $collections = [
'$id' => 'status',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 256,
'size' => 16,
'signed' => true,
'required' => false,
'default' => null,
@ -179,7 +179,7 @@ $collections = [
[
'$id' => 'signed',
'type' => Database::VAR_BOOLEAN,
'size' => 64,
'size' => 0,
'signed' => true,
'required' => false,
'default' => null,
@ -189,7 +189,7 @@ $collections = [
[
'$id' => 'array',
'type' => Database::VAR_BOOLEAN,
'size' => 64,
'size' => 0,
'signed' => true,
'required' => false,
'default' => null,
@ -240,8 +240,8 @@ $collections = [
'indexes' => [
'$collection' => Database::METADATA,
'$id' => 'attributes',
'name' => 'Attributes',
'$id' => 'indexes',
'name' => 'Indexes',
'attributes' => [
[
'$id' => 'collectionId',
@ -269,7 +269,7 @@ $collections = [
'$id' => 'type',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 256,
'size' => 16,
'signed' => true,
'required' => false,
'default' => null,
@ -280,7 +280,7 @@ $collections = [
'$id' => 'status',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 256,
'size' => 16,
'signed' => true,
'required' => false,
'default' => null,
@ -313,7 +313,7 @@ $collections = [
'$id' => 'orders',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 255,
'size' => 4,
'signed' => true,
'required' => false,
'default' => null,

View file

@ -21,7 +21,6 @@ class DatabaseV1 extends Worker
public function run(): void
{
Authorization::disable();
$projectId = $this->args['projectId'] ?? '';
$type = $this->args['type'] ?? '';
$collection = $this->args['collection'] ?? [];
@ -89,7 +88,6 @@ class DatabaseV1 extends Worker
if(!$dbForExternal->createAttribute($collectionId, $key, $type, $size, $required, $default, $signed, $array, $format, $formatOptions, $filters)) {
throw new Exception('Failed to create Attribute');
}
$dbForInternal->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', 'available'));
} catch (\Throwable $th) {
Console::error($th->getMessage());
@ -108,7 +106,6 @@ class DatabaseV1 extends Worker
{
$dbForInternal = $this->getInternalDB($projectId);
$dbForExternal = $this->getExternalDB($projectId);
$collectionId = $collection->getId();
$key = $attribute->getAttribute('key', '');
@ -147,7 +144,6 @@ class DatabaseV1 extends Worker
if(!$dbForExternal->createIndex($collectionId, $key, $type, $attributes, $lengths, $orders)) {
throw new Exception('Failed to create Index');
}
$dbForInternal->updateDocument('indexes', $index->getId(), $index->setAttribute('status', 'available'));
} catch (\Throwable $th) {
Console::error($th->getMessage());

2
composer.lock generated
View file

@ -6287,5 +6287,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}

View file

@ -26,7 +26,7 @@ class Attribute extends Model
'type' => self::TYPE_STRING,
'description' => 'Attribute status. Possible values: `available`, `processing`, `deleting`, or `failed`',
'default' => '',
'example' => 'string',
'example' => 'available',
])
->addRule('required', [
'type' => self::TYPE_BOOLEAN,

View file

@ -26,7 +26,7 @@ class Index extends Model
'type' => self::TYPE_STRING,
'description' => 'Index status. Possible values: `available`, `processing`, `deleting`, or `failed`',
'default' => '',
'example' => 'string',
'example' => 'available',
])
->addRule('attributes', [
'type' => self::TYPE_STRING,