From 743ded1e7967f0ebc94eb461e500940be7ff35ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 25 Feb 2025 13:03:44 +0100 Subject: [PATCH] Remove domain from deployment model --- phpunit.xml | 2 +- .../Platform/Modules/Sites/Http/Deployments/Get.php | 12 ------------ .../Modules/Sites/Http/Deployments/XList.php | 11 ----------- src/Appwrite/Utopia/Response/Model/Deployment.php | 6 ------ 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 4c4e55ea4e..598b730908 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" > diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php index 3864fdcac6..423cf0cb32 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php @@ -9,8 +9,6 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\Query; -use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -80,16 +78,6 @@ class Get extends Action $deployment->setAttribute('buildSize', $build->getAttribute('size', 0)); $deployment->setAttribute('size', $deployment->getAttribute('size', 0)); - $rule = Authorization::skip(fn () => $dbForPlatform->findOne('rules', [ - Query::equal("projectInternalId", [$project->getInternalId()]), - Query::equal("resourceType", ["deployment"]), - Query::equal("resourceInternalId", [$deployment->getInternalId()]) - ])); - - if (!empty($rule)) { - $deployment->setAttribute('domain', $rule->getAttribute('domain', '')); - } - $response->dynamic($deployment, Response::MODEL_DEPLOYMENT); } } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php index 8a79561e2b..d96e8701ba 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php @@ -12,7 +12,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; -use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -119,16 +118,6 @@ class XList extends Action $result->setAttribute('buildTime', $build->getAttribute('duration', 0)); $result->setAttribute('buildSize', $build->getAttribute('size', 0)); $result->setAttribute('size', $result->getAttribute('size', 0)); - - $rule = Authorization::skip(fn () => $dbForPlatform->findOne('rules', [ - Query::equal("projectInternalId", [$project->getInternalId()]), - Query::equal("resourceType", ["deployment"]), - Query::equal("resourceInternalId", [$result->getInternalId()]) - ])); - - if (!empty($rule)) { - $result->setAttribute('domain', $rule->getAttribute('domain', '')); - } } $response->dynamic(new Document([ diff --git a/src/Appwrite/Utopia/Response/Model/Deployment.php b/src/Appwrite/Utopia/Response/Model/Deployment.php index 6c13fd4b9e..f42ce6d334 100644 --- a/src/Appwrite/Utopia/Response/Model/Deployment.php +++ b/src/Appwrite/Utopia/Response/Model/Deployment.php @@ -106,12 +106,6 @@ class Deployment extends Model 'default' => 0, 'example' => 128, ]) - ->addRule('domain', [ - 'type' => self::TYPE_STRING, - 'description' => 'Preview domain.', - 'default' => '', - 'example' => 'deploy1-project1.appwrite.site', - ]) ->addRule('providerRepositoryName', [ 'type' => self::TYPE_STRING, 'description' => 'The name of the vcs provider repository',