1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

fix create bucket

This commit is contained in:
Damodar Lohani 2022-02-18 02:14:57 +00:00
parent 5eb6eeb6b8
commit 0b6bed0515

View file

@ -99,8 +99,6 @@ App::post('/v1/storage/buckets')
]);
}
$dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes);
$bucket = $dbForProject->createDocument('buckets', new Document([
'$id' => $bucketId,
'$collection' => 'buckets',
@ -117,6 +115,10 @@ App::post('/v1/storage/buckets')
'$write' => $write ?? [],
'search' => implode(' ', [$bucketId, $name]),
]));
$bucket = $dbForProject->getDocument('buckets', $bucketId);
$dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes);
} catch (Duplicate $th) {
throw new Exception('Bucket already exists', 409, Exception::STORAGE_BUCKET_ALREADY_EXISTS);
}