fix: invalid API response on missing project
API was returning 500 instead of 404 due to attempting to load environments for a non-existent project
This commit is contained in:
@@ -90,11 +90,12 @@ class ProjectController extends Controller
|
||||
if (is_null($teamId)) {
|
||||
return invalidTokenResponse();
|
||||
}
|
||||
$project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first()->load(['environments']);
|
||||
$project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first();
|
||||
if (! $project) {
|
||||
return response()->json(['message' => 'Project not found.'], 404);
|
||||
}
|
||||
|
||||
$project->load(['environments']);
|
||||
return response()->json(
|
||||
serializeApiResponse($project),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user