fix: return data of app update

This commit is contained in:
Andras Bacsai 2024-07-10 10:29:52 +02:00
parent c2b2d06e47
commit 26f4bcc77e

View File

@ -1372,7 +1372,17 @@ public function delete_by_uuid(Request $request)
new OA\Response( new OA\Response(
response: 200, response: 200,
description: 'Application updated.', description: 'Application updated.',
), content: [
new OA\MediaType(
mediaType: 'application/json',
schema: new OA\Schema(
type: 'object',
properties: [
'uuid' => ['type' => 'string'],
]
)
),
]),
new OA\Response( new OA\Response(
response: 401, response: 401,
ref: '#/components/responses/401', ref: '#/components/responses/401',
@ -1460,11 +1470,10 @@ public function update_by_uuid(Request $request)
} }
$domains = $request->domains; $domains = $request->domains;
if ($request->has('domains') && $server->isProxyShouldRun()) { if ($request->has('domains') && $server->isProxyShouldRun()) {
$errors = [];
$fqdn = $request->domains; $fqdn = $request->domains;
$fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceEnd(',', '')->trim();
$fqdn = str($fqdn)->replaceStart(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim();
$errors = [];
$fqdn = $fqdn->unique()->implode(',');
$application->fqdn = $fqdn; $application->fqdn = $fqdn;
$customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->custom_labels = base64_encode($customLabels); $application->custom_labels = base64_encode($customLabels);
@ -1494,7 +1503,9 @@ public function update_by_uuid(Request $request)
$application->fill($data); $application->fill($data);
$application->save(); $application->save();
return response()->json($this->removeSensitiveData($application)); return response()->json([
'uuid' => $application->uuid,
]);
} }
#[OA\Get( #[OA\Get(
@ -2501,6 +2512,7 @@ private function validateDataApplications(Request $request, Server $server)
} }
} }
if ($request->has('domains') && $server->isProxyShouldRun()) { if ($request->has('domains') && $server->isProxyShouldRun()) {
$uuid = $request->uuid;
$fqdn = $request->domains; $fqdn = $request->domains;
$fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceEnd(',', '')->trim();
$fqdn = str($fqdn)->replaceStart(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim();
@ -2518,7 +2530,7 @@ private function validateDataApplications(Request $request, Server $server)
'errors' => $errors, 'errors' => $errors,
], 422); ], 422);
} }
if (checkIfDomainIsAlreadyUsed($fqdn, $teamId)) { if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) {
return response()->json([ return response()->json([
'message' => 'Validation failed.', 'message' => 'Validation failed.',
'errors' => [ 'errors' => [