Skip to content

Commit

Permalink
fix: serde for query string
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Dec 17, 2024
1 parent 0985220 commit bbf6a7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions committer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ async fn metrics(registry: web::Data<Arc<Registry>>) -> impl Responder {
}

#[derive(Deserialize)]
#[serde(tag = "variant", content = "value")]
#[serde(rename_all = "lowercase", tag = "variant", content = "value")]
enum HeightVariant {
Latest,
Height(u32),
}

#[derive(Deserialize)]
struct CostQueryParams {
from_height: HeightVariant,
variant: HeightVariant,
limit: Option<usize>,
}

Expand All @@ -110,7 +110,7 @@ async fn costs(
) -> impl Responder {
let limit = query.limit.unwrap_or(100);

let response = match query.from_height {
let response = match query.variant {
HeightVariant::Latest => data.get_latest_costs(limit).await,
HeightVariant::Height(from_height) => data.get_costs(from_height, limit).await,
};
Expand Down

0 comments on commit bbf6a7b

Please sign in to comment.