Chore: remove encrypt param on update Atrribute and tests as well
This commit is contained in:
parent
a15551368f
commit
f160c55ecb
2 changed files with 1 additions and 39 deletions
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue