From 3ae990aa40f63c810fd5ffb74a0a02ad07e24795 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 11 Jul 2024 10:17:20 +0200 Subject: [PATCH] fix: api --- .../Controllers/Api/ApplicationsController.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index c671ec44d..71ceb97ac 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -683,6 +683,9 @@ private function create_application(Request $request, $type) if (! $request->has('name')) { $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); } + if ($request->build_pack === 'dockercompose') { + $request->offsetSet('ports_exposes', '80'); + } $validator = customApiValidator($request->all(), [ sharedDataApplications(), 'git_repository' => 'string|required', @@ -756,6 +759,9 @@ private function create_application(Request $request, $type) if (! $request->has('name')) { $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); } + if ($request->build_pack === 'dockercompose') { + $request->offsetSet('ports_exposes', '80'); + } $validator = customApiValidator($request->all(), [ sharedDataApplications(), 'git_repository' => 'string|required', @@ -847,6 +853,9 @@ private function create_application(Request $request, $type) if (! $request->has('name')) { $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); } + if ($request->build_pack === 'dockercompose') { + $request->offsetSet('ports_exposes', '80'); + } $validator = customApiValidator($request->all(), [ sharedDataApplications(), 'git_repository' => 'string|required', @@ -1268,11 +1277,8 @@ public function delete_by_uuid(Request $request) if (is_null($teamId)) { return invalidTokenResponse(); } - - if ($request->collect()->count() == 0) { - return response()->json([ - 'message' => 'Invalid request.', - ], 400); + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 404); } $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first();