1
0
Fork 0
mirror of synced 2024-05-20 12:42:39 +12:00

Work in progress

This commit is contained in:
Eldad Fux 2021-08-20 20:02:44 +03:00
parent 5ba2ba4c4c
commit c0b86a5d17
4 changed files with 14 additions and 14 deletions

View file

@ -849,20 +849,18 @@ App::delete('/v1/database/collections/:collectionId/attributes/:attributeId')
throw new Exception('Collection not found', 404);
}
/** @var Document[] $attributes */
$attributes = $collection->getAttribute('attributes');
$attribute = $dbForInternal->getDocument('attributes', $attributeId);
// find attribute in collection
$attribute = null;
foreach ($attributes as $a) {
if ($a->getId() === $attributeId) {
$attribute = $a->setAttribute('$collection', $collectionId); // set the collectionId
break; // break once attribute is found
}
if (empty($attribute->getId())) {
throw new Exception('Attribute not found', 404);
}
if (\is_null($attribute)) {
throw new Exception('Attribute not found', 404);
if (!$dbForInternal->deleteDocument('attributes', $attributeId)) {
throw new Exception('Failed to remove attribute from DB', 500);
}
if (!$dbForInternal->purgeDocument('collections', $collectionId)) {
throw new Exception('Failed to remove collection from the cache', 500);
}
$database

View file

@ -178,7 +178,7 @@ Database::addFilter('encrypt',
Database2::addFilter('subQuery',
function($value) {
return $value;
return null;
},
function($value, Document $document, Document $collection, Database2 $database) {
return $database

View file

@ -417,7 +417,7 @@ $logs = $this->getParam('logs', null);
<hr class="margin-top-small" />
<div class="row">
<div class="col span-1"><input type="radio" class="margin-top-no" /></div>
<div class="col span-1"><input name="permission" value="document" type="radio" class="margin-top-no" /></div>
<div class="col span-11">
<b>Document Level</b>
<p class="text-fade margin-top-tiny">Bla bla bla bla bla Bla blabla bla Bla blabla bla Bla blabla bla Bla blaBla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla</p>
@ -425,7 +425,7 @@ $logs = $this->getParam('logs', null);
</div>
<div class="row">
<div class="col span-1"><input type="radio" class="margin-top-tiny" /></div>
<div class="col span-1"><input name="permission" value="collection" type="radio" class="margin-top-tiny" /></div>
<div class="col span-11">
<b>Collection Level</b>
<p class="text-fade margin-top-tiny">Bla bla bla Bla blabla bla Bla blabla bla Bla blabla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla</p>

View file

@ -399,6 +399,8 @@ services:
redis:
image: redis:6.0-alpine
container_name: appwrite-redis
ports:
- "6379:6379"
networks:
- appwrite
volumes: