From 26f4bcc77e165df4c6633d5f7fb6b5c30815e67d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 10 Jul 2024 10:29:52 +0200 Subject: [PATCH] fix: return data of app update --- .../Api/ApplicationsController.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index da3b986be..045b0c332 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -1372,7 +1372,17 @@ public function delete_by_uuid(Request $request) new OA\Response( response: 200, description: 'Application updated.', - ), + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string'], + ] + ) + ), + ]), new OA\Response( response: 401, ref: '#/components/responses/401', @@ -1460,11 +1470,10 @@ public function update_by_uuid(Request $request) } $domains = $request->domains; if ($request->has('domains') && $server->isProxyShouldRun()) { + $errors = []; $fqdn = $request->domains; $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim(); - $errors = []; - $fqdn = $fqdn->unique()->implode(','); $application->fqdn = $fqdn; $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); $application->custom_labels = base64_encode($customLabels); @@ -1494,7 +1503,9 @@ public function update_by_uuid(Request $request) $application->fill($data); $application->save(); - return response()->json($this->removeSensitiveData($application)); + return response()->json([ + 'uuid' => $application->uuid, + ]); } #[OA\Get( @@ -2501,6 +2512,7 @@ private function validateDataApplications(Request $request, Server $server) } } if ($request->has('domains') && $server->isProxyShouldRun()) { + $uuid = $request->uuid; $fqdn = $request->domains; $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim(); @@ -2518,7 +2530,7 @@ private function validateDataApplications(Request $request, Server $server) 'errors' => $errors, ], 422); } - if (checkIfDomainIsAlreadyUsed($fqdn, $teamId)) { + if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) { return response()->json([ 'message' => 'Validation failed.', 'errors' => [