From 01c2d0f04ba6eef555b2d993238f2a3f76c6bfad Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Tue, 3 Mar 2026 15:31:44 +0000 Subject: [PATCH] Add expire field to migration console key response --- app/controllers/api/migrations.php | 4 +++- src/Appwrite/Utopia/Response/Model/MigrationKey.php | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index 370acb8da8..a3c89e1055 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -17,6 +17,7 @@ use Utopia\Compression\Algorithms\Zstd; use Utopia\Compression\Compression; use Utopia\Config\Config; use Utopia\Database\Database; +use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Exception\Order as OrderException; use Utopia\Database\Exception\Query as QueryException; @@ -741,7 +742,8 @@ Http::get('/v1/migrations/appwrite/console-key') ]); $response->dynamic(new Document([ - 'key' => API_KEY_DYNAMIC . '_' . $consoleKey, + 'key' => API_KEY_DYNAMIC . '_' . $consoleKey, + 'expire' => DateTime::addSeconds(new \DateTime(), APP_CONSOLE_KEY_TTL), ]), Response::MODEL_MIGRATION_KEY); }); diff --git a/src/Appwrite/Utopia/Response/Model/MigrationKey.php b/src/Appwrite/Utopia/Response/Model/MigrationKey.php index 58cac0379f..b4cb829b52 100644 --- a/src/Appwrite/Utopia/Response/Model/MigrationKey.php +++ b/src/Appwrite/Utopia/Response/Model/MigrationKey.php @@ -15,6 +15,12 @@ class MigrationKey extends Model 'description' => 'Temporary API key for settings migration.', 'default' => '', 'example' => 'dynamic_eyJ...', + ]) + ->addRule('expire', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Key expiration date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]); }