Add response filter and remove event test
This commit is contained in:
parent
d20d3228f5
commit
aa856b6a0a
2 changed files with 34 additions and 7 deletions
|
@ -79,13 +79,6 @@ class Migrations extends Action
|
|||
$this->dbForProject = $dbForProject;
|
||||
$this->dbForConsole = $dbForConsole;
|
||||
|
||||
/**
|
||||
* Handle Event execution.
|
||||
*/
|
||||
if (! empty($events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$log->addTag('projectId', $project->getId());
|
||||
|
||||
$this->processMigration($project, $migration, $log);
|
||||
|
|
34
src/Appwrite/Utopia/Response/Filters/V18.php
Normal file
34
src/Appwrite/Utopia/Response/Filters/V18.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Filters;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Filter;
|
||||
|
||||
class V18 extends Filter
|
||||
{
|
||||
// Convert 1.5.7 -> 1.5.8 data format
|
||||
public function parse(array $content, string $model): array
|
||||
{
|
||||
$parsedResponse = $content;
|
||||
|
||||
$parsedResponse = match($model) {
|
||||
Response::MODEL_MIGRATION => $this->parseMigration($parsedResponse),
|
||||
default => $parsedResponse,
|
||||
};
|
||||
|
||||
return $parsedResponse;
|
||||
}
|
||||
|
||||
protected function parseMigration(array $content) {
|
||||
$content['stage'] = match($content['status']) {
|
||||
'pending' => 'init',
|
||||
'processing' => 'migrating',
|
||||
'completed' => 'finished',
|
||||
'failed' => 'finished',
|
||||
default => 'processing',
|
||||
};
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue