Add documentation links to error responses in Team controller

This commit is contained in:
Andras Bacsai 2024-03-07 15:45:49 +01:00
parent 8b74e50c50
commit 93e4e723fa

View File

@ -26,7 +26,7 @@ public function team_by_id(Request $request)
$teams = auth()->user()->teams;
$team = $teams->where('id', $id)->first();
if (is_null($team)) {
return response()->json(['error' => 'Team not found.'], 404);
return response()->json(['error' => 'Team not found.', "docs" => "https://coolify.io/docs/api/team-by-id"], 404);
}
return response()->json($team);
}
@ -40,7 +40,7 @@ public function members_by_id(Request $request)
$teams = auth()->user()->teams;
$team = $teams->where('id', $id)->first();
if (is_null($team)) {
return response()->json(['error' => 'Team not found.'], 404);
return response()->json(['error' => 'Team not found.', "docs" => "https://coolify.io/docs/api/team-by-members"], 404);
}
return response()->json($team->members);
}
@ -53,7 +53,8 @@ public function current_team(Request $request)
$team = auth()->user()->currentTeam();
return response()->json($team);
}
public function current_team_members(Request $request) {
public function current_team_members(Request $request)
{
$teamId = get_team_id_from_token();
if (is_null($teamId)) {
return invalid_token();