From f160c55ecb644ec01f730a5aa342354e22df9fef Mon Sep 17 00:00:00 2001 From: Bishwajeet Parhi Date: Wed, 26 Jul 2023 11:25:25 +0530 Subject: [PATCH] Chore: remove encrypt param on update Atrribute and tests as well --- app/controllers/api/databases.php | 9 +----- .../Databases/DatabasesCustomServerTest.php | 31 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index abc13710ba..00e4247cbe 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1789,17 +1789,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/strin ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new Text(0, 0)), 'Default value for attribute when not provided. Cannot be set when attribute is required.') - ->param('encrypt', null, new Boolean(), 'Encrypt attribute? Encrypting an attribute means that the attribute can not be queried.', true) ->inject('response') ->inject('dbForProject') ->inject('events') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?bool $encrypt, Response $response, Database $dbForProject, Event $events) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $events) { - $filter = ''; - - if ($encrypt != null) { - $filter = $encrypt ? 'encrypt' : 'decrypt'; - } $attribute = updateAttribute( databaseId: $databaseId, @@ -1808,7 +1802,6 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/strin dbForProject: $dbForProject, events: $events, type: Database::VAR_STRING, - filter: empty($filter) ? null : $filter, default: $default, required: $required ); diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index c4d71d8428..648a4de800 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -695,37 +695,6 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(200, $document['headers']['status-code']); $this->assertEquals('Jonah', $document['body']['firstName']); $this->assertEquals('Jameson', $document['body']['lastName']); - - /** - * Update Attribute - */ - $updatedFirstname = $this->client->call(Client::METHOD_PATCH, $attributesPath . '/string/' . $firstName['body']['key'], array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'required' => false, - 'encrypt' => true, - 'default' => '' - ]); - - $this->assertEquals(200, $updatedFirstname['headers']['status-code']); - $this->assertEquals('firstName', $updatedFirstname['body']['key']); - $this->assertEquals('string', $updatedFirstname['body']['type']); - - $updatedLastName = $this->client->call(Client::METHOD_PATCH, $attributesPath . '/string/' . $lastName['body']['key'], array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ]), [ - 'required' => false, - 'encrypt' => false, - 'default' => '' - ]); - - $this->assertEquals(200, $updatedLastName['headers']['status-code']); - $this->assertEquals('lastName', $updatedLastName['body']['key']); - $this->assertEquals('string', $updatedLastName['body']['type']); } public function testDeleteAttribute(): array