From 02b7e0df4dac7e319eb722cc5d082092279b0b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sun, 18 May 2025 22:51:17 +0200 Subject: [PATCH] queries backwards compatibilit --- src/Appwrite/Utopia/Request/Filters/V19.php | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Appwrite/Utopia/Request/Filters/V19.php b/src/Appwrite/Utopia/Request/Filters/V19.php index 27b854b46f..8680cd642c 100644 --- a/src/Appwrite/Utopia/Request/Filters/V19.php +++ b/src/Appwrite/Utopia/Request/Filters/V19.php @@ -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; + } }