Merge branch 'feat-storage-buckets' into feat-sb-delete
This commit is contained in:
commit
9a673798f9
6 changed files with 19 additions and 21 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -809,7 +809,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
|
||||||
$fileLogos = Config::getParam('storage-logos');
|
$fileLogos = Config::getParam('storage-logos');
|
||||||
|
|
||||||
$date = \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
|
$date = \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
|
||||||
$key = \md5($fileId.$width.$height.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
$key = \md5($fileId.$width.$height.$gravity.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
||||||
|
|
||||||
$file = $dbForInternal->getDocument('bucket_' . $bucketId, $fileId);
|
$file = $dbForInternal->getDocument('bucket_' . $bucketId, $fileId);
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
|
||||||
$cipher = null;
|
$cipher = null;
|
||||||
$background = (empty($background)) ? 'eceff1' : $background;
|
$background = (empty($background)) ? 'eceff1' : $background;
|
||||||
$type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
|
$type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
|
||||||
$key = \md5($path.$width.$height.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
$key = \md5($path.$width.$height.$gravity.$quality.$borderWidth.$borderColor.$borderRadius.$opacity.$rotation.$background.$storage.$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$compressor = new GZIP();
|
$compressor = new GZIP();
|
||||||
|
@ -1106,7 +1106,7 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId')
|
||||||
|
|
||||||
$file = $dbForInternal->getDocument('bucket_' . $bucketId, $fileId);
|
$file = $dbForInternal->getDocument('bucket_' . $bucketId, $fileId);
|
||||||
|
|
||||||
if ($file->isEmpty() || $file->getAttribute('bucketId') != $bucketId) {
|
if ($file->isEmpty() || $file->getAttribute('bucketId') !== $bucketId) {
|
||||||
throw new Exception('File not found', 404);
|
throw new Exception('File not found', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Swagger2 extends Format
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function getUsedModels($model, array &$usedModels)
|
protected function getUsedModels($model, array &$usedModels)
|
||||||
{
|
{
|
||||||
if (is_string($model) && !in_array($model, ['string', 'integer', 'boolean', 'json', 'float', 'double'])) {
|
if (is_string($model) && !in_array($model, ['string', 'integer', 'boolean', 'json', 'float', 'double'])) {
|
||||||
$usedModels[] = $model;
|
$usedModels[] = $model;
|
||||||
return;
|
return;
|
||||||
|
@ -225,14 +225,10 @@ class Swagger2 extends Format
|
||||||
}
|
}
|
||||||
$temp['responses'][(string)$route->getLabel('sdk.response.code', '500')] = [
|
$temp['responses'][(string)$route->getLabel('sdk.response.code', '500')] = [
|
||||||
'description' => $modelDescription,
|
'description' => $modelDescription,
|
||||||
'content' => [
|
'schema' => [
|
||||||
$produces => [
|
'oneOf' => \array_map(function($m) {
|
||||||
'schema' => [
|
return ['$ref' => '#/definitions/'.$m->getType()];
|
||||||
'oneOf' => \array_map(function($m) {
|
}, $model)
|
||||||
return ['$ref' => '#/definitions/'.$m->getType()];
|
|
||||||
}, $model)
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,12 +236,8 @@ class Swagger2 extends Format
|
||||||
$usedModels[] = $model->getType();
|
$usedModels[] = $model->getType();
|
||||||
$temp['responses'][(string)$route->getLabel('sdk.response.code', '500')] = [
|
$temp['responses'][(string)$route->getLabel('sdk.response.code', '500')] = [
|
||||||
'description' => $model->getName(),
|
'description' => $model->getName(),
|
||||||
'content' => [
|
'schema' => [
|
||||||
$produces => [
|
'$ref' => '#/definitions/'.$model->getType(),
|
||||||
'schema' => [
|
|
||||||
'$ref' => '#/definitions/'.$model->getType(),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,12 @@ class Bucket extends Model
|
||||||
'example' => ['user:608f9da25e7e1'],
|
'example' => ['user:608f9da25e7e1'],
|
||||||
'array' => true,
|
'array' => true,
|
||||||
])
|
])
|
||||||
|
->addRule('permission', [
|
||||||
|
'type' => self::TYPE_STRING,
|
||||||
|
'description' => 'Bucket permission model. Possible values: `bucket` or `file`',
|
||||||
|
'default' => '',
|
||||||
|
'example' => 'file',
|
||||||
|
])
|
||||||
->addRule('dateCreated', [
|
->addRule('dateCreated', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_INTEGER,
|
||||||
'description' => 'Bucket creation date in Unix timestamp.',
|
'description' => 'Bucket creation date in Unix timestamp.',
|
||||||
|
|
Loading…
Reference in a new issue