Update services controller to include new service envs commands
This commit is contained in:
parent
8d2b280b03
commit
ec7b18556e
1 changed files with 11 additions and 11 deletions
|
|
@ -483,7 +483,6 @@ public function delete_by_uuid(Request $request)
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
#[OA\Get(
|
||||
summary: 'List Envs',
|
||||
description: 'List all envs by service UUID.',
|
||||
|
|
@ -539,12 +538,11 @@ public function envs(Request $request)
|
|||
return invalidTokenResponse();
|
||||
}
|
||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||
if (!$service) {
|
||||
if (! $service) {
|
||||
return response()->json(['message' => 'Service not found.'], 404);
|
||||
}
|
||||
$envs = $service->environment_variables->sortBy('id');
|
||||
|
||||
$envs = $envs->map(function ($env) {
|
||||
$envs = $service->environment_variables->map(function ($env) {
|
||||
$env->makeHidden([
|
||||
'application_id',
|
||||
'standalone_clickhouse_id',
|
||||
|
|
@ -560,6 +558,8 @@ public function envs(Request $request)
|
|||
|
||||
return $env;
|
||||
});
|
||||
|
||||
return response()->json($envs);
|
||||
}
|
||||
|
||||
#[OA\Patch(
|
||||
|
|
@ -642,7 +642,7 @@ public function update_env_by_uuid(Request $request)
|
|||
}
|
||||
|
||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||
if (!$service) {
|
||||
if (! $service) {
|
||||
return response()->json(['message' => 'Service not found.'], 404);
|
||||
}
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ public function update_env_by_uuid(Request $request)
|
|||
}
|
||||
|
||||
$env = $service->environment_variables()->where('key', $request->key)->first();
|
||||
if (!$env) {
|
||||
if (! $env) {
|
||||
return response()->json(['message' => 'Environment variable not found.'], 404);
|
||||
}
|
||||
|
||||
|
|
@ -761,12 +761,12 @@ public function create_bulk_envs(Request $request)
|
|||
}
|
||||
|
||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||
if (!$service) {
|
||||
if (! $service) {
|
||||
return response()->json(['message' => 'Service not found.'], 404);
|
||||
}
|
||||
|
||||
$bulk_data = $request->get('data');
|
||||
if (!$bulk_data) {
|
||||
if (! $bulk_data) {
|
||||
return response()->json(['message' => 'Bulk data is required.'], 400);
|
||||
}
|
||||
|
||||
|
|
@ -876,7 +876,7 @@ public function create_env(Request $request)
|
|||
}
|
||||
|
||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||
if (!$service) {
|
||||
if (! $service) {
|
||||
return response()->json(['message' => 'Service not found.'], 404);
|
||||
}
|
||||
|
||||
|
|
@ -976,7 +976,7 @@ public function delete_env_by_uuid(Request $request)
|
|||
}
|
||||
|
||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||
if (!$service) {
|
||||
if (! $service) {
|
||||
return response()->json(['message' => 'Service not found.'], 404);
|
||||
}
|
||||
|
||||
|
|
@ -984,7 +984,7 @@ public function delete_env_by_uuid(Request $request)
|
|||
->where('service_id', $service->id)
|
||||
->first();
|
||||
|
||||
if (!$env) {
|
||||
if (! $env) {
|
||||
return response()->json(['message' => 'Environment variable not found.'], 404);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue