From c4e5c8ac964bedbc82d6a19937f35e821e3c3331 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 18 Aug 2021 14:41:35 +0300 Subject: [PATCH] Updated collectionId --- app/controllers/api/database.php | 12 ++++++++++-- src/Appwrite/Utopia/Response/Model/Attribute.php | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 5fab1d9234..98a12848a0 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -92,8 +92,11 @@ $attributesCallback = function ($attribute, $response, $dbForExternal, $database // So we need to create one for the response // // TODO@kodumbeats should $signed and $filters be part of the response model? + + var_dump($collectionId); $attribute = new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => $type, 'size' => $size, 'required' => $required, @@ -330,8 +333,6 @@ App::get('/v1/database/collections/:collectionId/logs') $response->dynamic(new Document(['logs' => $output]), Response::MODEL_LOG_LIST); }); - - App::put('/v1/database/collections/:collectionId') ->desc('Update Collection') ->groups(['api', 'database']) @@ -460,6 +461,7 @@ App::post('/v1/database/collections/:collectionId/attributes/string') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_STRING, 'size' => $size, 'required' => $required, @@ -497,6 +499,7 @@ App::post('/v1/database/collections/:collectionId/attributes/email') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_STRING, 'size' => 254, 'required' => $required, @@ -535,6 +538,7 @@ App::post('/v1/database/collections/:collectionId/attributes/ip') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_STRING, 'size' => 39, 'required' => $required, @@ -574,6 +578,7 @@ App::post('/v1/database/collections/:collectionId/attributes/url') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_STRING, 'size' => $size, 'required' => $required, @@ -614,6 +619,7 @@ App::post('/v1/database/collections/:collectionId/attributes/integer') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_INTEGER, 'size' => 0, 'required' => $required, @@ -658,6 +664,7 @@ App::post('/v1/database/collections/:collectionId/attributes/float') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_FLOAT, 'required' => $required, 'size' => 0, @@ -700,6 +707,7 @@ App::post('/v1/database/collections/:collectionId/attributes/boolean') return $attributesCallback(new Document([ '$id' => $attributeId, + '$collection' => $collectionId, 'type' => Database::VAR_BOOLEAN, 'size' => 0, 'required' => $required, diff --git a/src/Appwrite/Utopia/Response/Model/Attribute.php b/src/Appwrite/Utopia/Response/Model/Attribute.php index f26ca2fe64..d80251eeb7 100644 --- a/src/Appwrite/Utopia/Response/Model/Attribute.php +++ b/src/Appwrite/Utopia/Response/Model/Attribute.php @@ -10,6 +10,12 @@ class Attribute extends Model public function __construct() { $this + ->addRule('$collection', [ + 'type' => self::TYPE_STRING, + 'description' => 'Collection ID.', + 'default' => '', + 'example' => '5e5ea5c16d55', + ]) ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Attribute ID.',