mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Add response filter and remove event test
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user