mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 00:18:25 +00:00
queries backwards compatibilit
This commit is contained in:
parent
e84ad1e83c
commit
02b7e0df4d
1 changed files with 25 additions and 0 deletions
|
|
@ -10,6 +10,16 @@ class V19 extends Filter
|
|||
public function parse(array $content, string $model): array
|
||||
{
|
||||
switch ($model) {
|
||||
case 'functions.list':
|
||||
$content = $this->convertQueryAttribute($content, 'deployment', 'deploymentId');
|
||||
break;
|
||||
case 'functions.listDeployments':
|
||||
$content = $this->convertQueryAttribute($content, 'size', 'deploymentSize');
|
||||
break;
|
||||
case 'proxy.listRules':
|
||||
$content = $this->convertQueryAttribute($content, 'resourceType', 'deploymentResourceType');
|
||||
$content = $this->convertQueryAttribute($content, 'resourceId', 'deploymentResourceId');
|
||||
break;
|
||||
case 'functions.create':
|
||||
unset($content['templateRepository']);
|
||||
unset($content['templateOwner']);
|
||||
|
|
@ -28,4 +38,19 @@ class V19 extends Filter
|
|||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function convertQueryAttribute(array $content, string $old, string $new)
|
||||
{
|
||||
if (isset($content['queries']) && is_array($content['queries'])) {
|
||||
foreach ($content['queries'] as $index => $query) {
|
||||
$query = \json_decode($query, true);
|
||||
if (($query['attribute'] ?? '') === $old) {
|
||||
$query['attribute'] = $new;
|
||||
}
|
||||
$content['queries'][$index] = \json_encode($query);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue