mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
add: filter for latest changes.
This commit is contained in:
parent
814be66b98
commit
4f1f9bb4a2
2 changed files with 25 additions and 10 deletions
|
|
@ -805,7 +805,8 @@ App::init()
|
|||
if (version_compare($requestFormat, '1.6.0', '<')) {
|
||||
$request->addFilter(new RequestV18());
|
||||
}
|
||||
if (version_compare($requestFormat, '1.7.0', '<')) {
|
||||
// alias filters on 1.7.x, so we use `<=` and not just `<`
|
||||
if (version_compare($requestFormat, '1.7.0', '<=')) {
|
||||
$request->addFilter(new RequestV19());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,32 @@ use Appwrite\Utopia\Request\Filter;
|
|||
|
||||
class V19 extends Filter
|
||||
{
|
||||
// Convert 1.6 params to 1.7
|
||||
public function parse(array $content, string $model): array
|
||||
{
|
||||
/*
|
||||
Uncomment with first request filter; current is just a copy of V18
|
||||
switch ($model) {
|
||||
case 'functions.create':
|
||||
$content['something'] = $content['somethingElse'] ?? "";
|
||||
unset($content['something']);
|
||||
break;
|
||||
return $this->overrideDatabaseParams($content, $model);
|
||||
}
|
||||
|
||||
// Database terminology change handling.
|
||||
protected function overrideDatabaseParams(array $content, string $model): array
|
||||
{
|
||||
if (!str_starts_with($model, 'databases.')) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$map = [
|
||||
'collectionId' => 'tableId',
|
||||
'attributeId' => 'columnId',
|
||||
'attributes' => 'columns',
|
||||
'documentId' => 'rowId',
|
||||
'relatedCollectionId' => 'relatedTableId'
|
||||
];
|
||||
|
||||
foreach ($map as $oldKey => $newKey) {
|
||||
if (isset($content[$oldKey])) {
|
||||
$content[$newKey] = $content[$oldKey];
|
||||
unset($content[$oldKey]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue