Skip to content

Commit

Permalink
fix(admin-api): update get contexts return type (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
frdomovic authored Jun 25, 2024
1 parent 88e6fd4 commit 83b9931
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/server/src/admin/handlers/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ pub async fn get_context_users_handler(
.into_response()
}

#[derive(Debug, Serialize, Deserialize)]
pub struct ContextList {
contexts: Vec<Context>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct GetContextsResponse {
data: Vec<Context>,
data: ContextList,
}

pub async fn get_contexts_handler(
Expand All @@ -106,7 +111,9 @@ pub async fn get_contexts_handler(
let contexts = get_contexts(&state.store).map_err(|err| parse_api_error(err));
return match contexts {
Ok(contexts) => ApiResponse {
payload: GetContextsResponse { data: contexts },
payload: GetContextsResponse {
data: ContextList { contexts },
},
}
.into_response(),
Err(err) => err.into_response(),
Expand Down

0 comments on commit 83b9931

Please sign in to comment.