Update services controller to include new service envs commands
This commit is contained in:
@@ -483,7 +483,6 @@ class ServicesController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[OA\Get(
|
#[OA\Get(
|
||||||
summary: 'List Envs',
|
summary: 'List Envs',
|
||||||
description: 'List all envs by service UUID.',
|
description: 'List all envs by service UUID.',
|
||||||
@@ -539,12 +538,11 @@ class ServicesController extends Controller
|
|||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
}
|
}
|
||||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||||
if (!$service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
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([
|
$env->makeHidden([
|
||||||
'application_id',
|
'application_id',
|
||||||
'standalone_clickhouse_id',
|
'standalone_clickhouse_id',
|
||||||
@@ -560,6 +558,8 @@ class ServicesController extends Controller
|
|||||||
|
|
||||||
return $env;
|
return $env;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return response()->json($envs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Patch(
|
#[OA\Patch(
|
||||||
@@ -642,7 +642,7 @@ class ServicesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||||
if (!$service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
return response()->json(['message' => 'Service not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ class ServicesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$env = $service->environment_variables()->where('key', $request->key)->first();
|
$env = $service->environment_variables()->where('key', $request->key)->first();
|
||||||
if (!$env) {
|
if (! $env) {
|
||||||
return response()->json(['message' => 'Environment variable not found.'], 404);
|
return response()->json(['message' => 'Environment variable not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,12 +761,12 @@ class ServicesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||||
if (!$service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
return response()->json(['message' => 'Service not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bulk_data = $request->get('data');
|
$bulk_data = $request->get('data');
|
||||||
if (!$bulk_data) {
|
if (! $bulk_data) {
|
||||||
return response()->json(['message' => 'Bulk data is required.'], 400);
|
return response()->json(['message' => 'Bulk data is required.'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -876,7 +876,7 @@ class ServicesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||||
if (!$service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
return response()->json(['message' => 'Service not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +976,7 @@ class ServicesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
$service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first();
|
||||||
if (!$service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
return response()->json(['message' => 'Service not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,7 +984,7 @@ class ServicesController extends Controller
|
|||||||
->where('service_id', $service->id)
|
->where('service_id', $service->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$env) {
|
if (! $env) {
|
||||||
return response()->json(['message' => 'Environment variable not found.'], 404);
|
return response()->json(['message' => 'Environment variable not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user