1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

Merge branch 'feat-storage-buckets' into feat-large-file

This commit is contained in:
Damodar Lohani 2021-10-17 12:00:16 +05:45
commit b282ee7c18
2 changed files with 42 additions and 8 deletions

View file

@ -2149,6 +2149,17 @@ $collections = [
'required' => true,
'array' => false,
],
[
'$id' => 'search',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
],
'indexes' => [
[
@ -2157,7 +2168,14 @@ $collections = [
'attributes' => ['name'],
'lengths' => [1024],
'orders' => [Database::ORDER_ASC],
]
],
[
'$id' => '_key_search',
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['search'],
'lengths' => [2048],
'orders' => [Database::ORDER_ASC],
],
]
],

View file

@ -244,7 +244,27 @@ App::post('/v1/storage/buckets')
'array' => false,
'filters' => [],
]),
new Document([
[
'$id' => 'search',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
]),
], [
new Document([
'$id' => '_key_search',
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['search'],
'lengths' => [2048],
'orders' => [Database::ORDER_ASC],
]),
new Document([
'$id' => '_key_bucket',
'type' => Database::INDEX_KEY,
@ -252,13 +272,6 @@ App::post('/v1/storage/buckets')
'lengths' => [Database::LENGTH_KEY],
'orders' => [Database::ORDER_ASC],
]),
new Document([
'$id' => '_fulltext_name',
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['name'],
'lengths' => [1024],
'orders' => [Database::ORDER_ASC],
]),
]);
$bucket = $dbForInternal->createDocument('buckets', new Document([
@ -276,6 +289,7 @@ App::post('/v1/storage/buckets')
'antiVirus' => $antiVirus,
'$read' => $read,
'$write' => $write,
'search' => implode(' ', [$bucketId, $name]),
]));
} catch (Duplicate $th) {
throw new Exception('Bucket already exists', 409);
@ -682,6 +696,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
'openSSLCipher' => $openSSLCipher,
'openSSLTag' => $openSSLTag,
'openSSLIV' => $openSSLIV,
'search' => implode(' ', [$fileId, $fileName,]),
]));
} else {
$file = $dbForInternal->updateDocument('bucket_' . $bucketId, $fileId, $file
@ -715,6 +730,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
'comment' => '',
'chunksTotal' => $chunks,
'chunksUploaded' => $chunksUploaded,
'search' => implode(' ', [$fileId, $fileName,]),
]));
} else {
$file = $dbForInternal->updateDocument('bucket_' . $bucketId, $fileId, $file