Merge pull request #3338 from coollabsio/add-missing-api-endpoints-for-service-envs
Add missing api endpoints for service envs
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Route::group([
|
|||||||
Route::get('/applications/{uuid}/envs', [ApplicationsController::class, 'envs']);
|
Route::get('/applications/{uuid}/envs', [ApplicationsController::class, 'envs']);
|
||||||
Route::post('/applications/{uuid}/envs', [ApplicationsController::class, 'create_env'])->middleware([IgnoreReadOnlyApiToken::class]);
|
Route::post('/applications/{uuid}/envs', [ApplicationsController::class, 'create_env'])->middleware([IgnoreReadOnlyApiToken::class]);
|
||||||
Route::patch('/applications/{uuid}/envs/bulk', [ApplicationsController::class, 'create_bulk_envs'])->middleware([IgnoreReadOnlyApiToken::class]);
|
Route::patch('/applications/{uuid}/envs/bulk', [ApplicationsController::class, 'create_bulk_envs'])->middleware([IgnoreReadOnlyApiToken::class]);
|
||||||
Route::patch('/applications/{uuid}/envs', [ApplicationsController::class, 'update_env_by_uuid']);
|
Route::patch('/applications/{uuid}/envs', [ApplicationsController::class, 'update_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
|
||||||
Route::delete('/applications/{uuid}/envs/{env_uuid}', [ApplicationsController::class, 'delete_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
|
Route::delete('/applications/{uuid}/envs/{env_uuid}', [ApplicationsController::class, 'delete_env_by_uuid'])->middleware([IgnoreReadOnlyApiToken::class]);
|
||||||
|
|
||||||
Route::match(['get', 'post'], '/applications/{uuid}/start', [ApplicationsController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
|
Route::match(['get', 'post'], '/applications/{uuid}/start', [ApplicationsController::class, 'action_deploy'])->middleware([IgnoreReadOnlyApiToken::class]);
|
||||||
|
|||||||
Reference in New Issue
Block a user