mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
updates
This commit is contained in:
@@ -2053,7 +2053,6 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/attributes')
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($attributes as $attribute) {
|
||||
if ($attribute->getAttribute('type') === Database::VAR_STRING) {
|
||||
$filters = $attribute->getAttribute('filters', []);
|
||||
|
||||
@@ -78,16 +78,20 @@ Database::addFilter(
|
||||
|
||||
foreach ($attributes as $attribute) {
|
||||
$attributeType = $attribute->getAttribute('type');
|
||||
if ($attributeType === Database::VAR_RELATIONSHIP) {
|
||||
$options = $attribute->getAttribute('options');
|
||||
foreach ($options as $key => $value) {
|
||||
$attribute->setAttribute($key, $value);
|
||||
}
|
||||
$attribute->removeAttribute('options');
|
||||
}
|
||||
if ($attributeType === Database::VAR_STRING) {
|
||||
$filters = $attribute->getAttribute('filters', []);
|
||||
$attribute->setAttribute('encrypt', in_array('encrypt', $filters));
|
||||
|
||||
switch ($attributeType) {
|
||||
case Database::VAR_RELATIONSHIP:
|
||||
$options = $attribute->getAttribute('options');
|
||||
foreach ($options as $key => $value) {
|
||||
$attribute->setAttribute($key, $value);
|
||||
}
|
||||
$attribute->removeAttribute('options');
|
||||
break;
|
||||
|
||||
case Database::VAR_STRING:
|
||||
$filters = $attribute->getAttribute('filters', []);
|
||||
$attribute->setAttribute('encrypt', in_array('encrypt', $filters));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -756,19 +756,15 @@ class DatabasesCustomServerTest extends Scope
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), []);
|
||||
$attributes = $actors['body']['attributes'];
|
||||
$firstNameAttribute = null;
|
||||
$lastNameAttribute = null;
|
||||
foreach ($attributes as $attribute) {
|
||||
$this->assertArrayHasKey('encrypt', $attribute);
|
||||
if ($attribute['key'] === 'firstName') {
|
||||
$firstNameAttribute = $attribute['encrypt'];
|
||||
$this->assertFalse($attribute['encrypt']);
|
||||
}
|
||||
if ($attribute['key'] === 'lastName') {
|
||||
$lastNameAttribute = $attribute['encrypt'];
|
||||
$this->assertTrue($attribute['encrypt']);
|
||||
}
|
||||
}
|
||||
$this->assertTrue($lastNameAttribute);
|
||||
$this->assertFalse($firstNameAttribute);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user