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:
parent
8c07a36d9c
commit
9e8d9e6a9e
1 changed files with 2 additions and 1 deletions
|
|
@ -90,11 +90,12 @@ public function project_by_uuid(Request $request)
|
||||||
if (is_null($teamId)) {
|
if (is_null($teamId)) {
|
||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
}
|
}
|
||||||
$project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first()->load(['environments']);
|
$project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first();
|
||||||
if (! $project) {
|
if (! $project) {
|
||||||
return response()->json(['message' => 'Project not found.'], 404);
|
return response()->json(['message' => 'Project not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$project->load(['environments']);
|
||||||
return response()->json(
|
return response()->json(
|
||||||
serializeApiResponse($project),
|
serializeApiResponse($project),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue