Skip to content

Commit

Permalink
refactor: return team details when creating a new team (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
chesedo committed May 3, 2024
1 parent 43d7f28 commit 399b525
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gateway/src/api/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ async fn create_team(
State(RouterState { service, .. }): State<RouterState>,
CustomErrorPath(team_name): CustomErrorPath<String>,
Claim { sub, .. }: Claim,
) -> Result<String, ApiError> {
) -> Result<AxumJson<team::Response>, ApiError> {
if team_name.chars().count() > 30 {
return Err(InvalidTeamName.into());
}
Expand All @@ -549,7 +549,11 @@ async fn create_team(

Span::current().record("shuttle.team.id", &team.id);

Ok("Team created".to_string())
Ok(AxumJson(team::Response {
id: team.id,
display_name: team.display_name,
is_admin: true,
}))
}

#[instrument(skip_all, fields(shuttle.team.id = %team_id))]
Expand Down

0 comments on commit 399b525

Please sign in to comment.