1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

fix: get attribute endpoint

This commit is contained in:
Torsten Dittmann 2021-12-27 18:07:35 +01:00
parent 8122d8882b
commit 9917cdb9ac

View file

@ -1177,13 +1177,13 @@ App::get('/v1/database/collections/:collectionId/attributes/:key')
$collection = $dbForProject->getDocument('collections', $collectionId);
if (empty($collection)) {
if ($collection->isEmpty()) {
throw new Exception('Collection not found', 404);
}
$attribute = $collection->find('$id', $key, 'attributes');
$attribute = $dbForProject->getDocument('attributes', $collectionId.'_'.$key);
if (!$attribute) {
if ($attribute->isEmpty()) {
throw new Exception('Attribute not found', 404);
}
@ -1245,7 +1245,7 @@ App::delete('/v1/database/collections/:collectionId/attributes/:key')
$attribute = $dbForProject->getDocument('attributes', $collectionId.'_'.$key);
if (empty($attribute->getId())) {
if ($attribute->isEmpty()) {
throw new Exception('Attribute not found', 404);
}