Skip to content

Commit

Permalink
[ENG-7151] take component as argument to get_indexes (#28916)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b809fd715b67fd5d246bef74e02c997349bc27e3
  • Loading branch information
pashabitz authored and Convex, Inc. committed Aug 15, 2024
1 parent 82337bd commit 0c1ba95
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/local_backend/src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ pub async fn delete_tables(
Ok(StatusCode::OK)
}

#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GetIndexesArgs {
component_id: Option<String>,
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct GetIndexesResponse {
Expand All @@ -114,11 +120,13 @@ struct GetIndexesResponse {
pub async fn get_indexes(
State(st): State<LocalAppState>,
ExtractIdentity(identity): ExtractIdentity,
Query(GetIndexesArgs { component_id }): Query<GetIndexesArgs>,
) -> Result<impl IntoResponse, HttpResponseError> {
must_be_admin_member(&identity)?;
let component_id = ComponentId::deserialize_from_string(component_id.as_deref())?;
let mut tx = st.application.begin(identity.clone()).await?;
let indexes = IndexModel::new(&mut tx)
.get_application_indexes(TableNamespace::TODO())
.get_application_indexes(TableNamespace::from(component_id))
.await?;
Ok(Json(GetIndexesResponse {
indexes: indexes
Expand Down

0 comments on commit 0c1ba95

Please sign in to comment.