1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

Add response filter and remove event test

This commit is contained in:
Bradley Schofield 2024-05-28 12:40:11 +09:00
parent d20d3228f5
commit aa856b6a0a
2 changed files with 34 additions and 7 deletions

View file

@ -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);

View 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;
}
}