Use new query methods

This commit is contained in:
Matej Bačo 2022-08-24 14:10:56 +00:00
parent d4ba9441b6
commit 4b01ff3f51
4 changed files with 19 additions and 18 deletions

View file

@ -1216,6 +1216,7 @@ App::post('/v1/functions/:functionId/variables')
'functionId' => $function->getId(),
'key' => $key,
'value' => $value,
'vars' => null
]);
try {
@ -1283,8 +1284,8 @@ App::get('/v1/functions/:functionId/variables/:variableId')
}
$variable = $dbForProject->findOne('variables', [
new Query('_uid', Query::TYPE_EQUAL, [$variableId]),
new Query('functionInternalId', Query::TYPE_EQUAL, [$function->getInternalId()])
Query::equal('_uid', [$variableId]),
Query::equal('functionInternalId', [$function->getInternalId()]),
]);
if ($variable === false || $variable->isEmpty()) {
@ -1323,8 +1324,8 @@ App::put('/v1/functions/:functionId/variables/:variableId')
}
$variable = $dbForProject->findOne('variables', [
new Query('_uid', Query::TYPE_EQUAL, [$variableId]),
new Query('functionInternalId', Query::TYPE_EQUAL, [$function->getInternalId()])
Query::equal('_uid', [$variableId]),
Query::equal('functionInternalId', [$function->getInternalId()]),
]);
if ($variable === false || $variable->isEmpty()) {
@ -1369,8 +1370,8 @@ App::delete('/v1/functions/:functionId/variables/:variableId')
}
$variable = $dbForProject->findOne('variables', [
new Query('_uid', Query::TYPE_EQUAL, [$variableId]),
new Query('functionInternalId', Query::TYPE_EQUAL, [$function->getInternalId()])
Query::equal('_uid', [$variableId]),
Query::equal('functionInternalId', [$function->getInternalId()]),
]);
if ($variable === false || $variable->isEmpty()) {

View file

@ -399,7 +399,7 @@ Database::addFilter(
function (mixed $value, Document $document, Database $database) {
return $database
->find('variables', [
new Query('functionInternalId', Query::TYPE_EQUAL, [$document->getInternalId()]),
Query::equal('functionInternalId', [$document->getInternalId()]),
], APP_LIMIT_SUBQUERY);
}
);

View file

@ -130,15 +130,15 @@ class DeletesV1 extends Worker
protected function deleteCacheByResource(string $projectId): void
{
$this->deleteCacheFiles([
new Query('resource', Query::TYPE_EQUAL, [$this->args['resource']])
]);
Query::equal('resource', [$this->args['resource']]),
]);
}
protected function deleteCacheByTimestamp(): void
{
$this->deleteCacheFiles([
new Query('accessedAt', Query::TYPE_LESSER, [$this->args['timestamp']])
]);
Query::lessThan('accessedAt', [$this->args['timestamp']]),
]);
}
protected function deleteCacheFiles($query): void

14
composer.lock generated
View file

@ -3526,23 +3526,23 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.15",
"version": "9.2.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f"
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073",
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.13.0",
"nikic/php-parser": "^4.14",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
@ -3591,7 +3591,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16"
},
"funding": [
{
@ -3599,7 +3599,7 @@
"type": "github"
}
],
"time": "2022-03-07T09:28:20+00:00"
"time": "2022-08-20T05:26:47+00:00"
},
{
"name": "phpunit/php-file-iterator",