From 49a299f9e3b82476f49f9038f98edc48a5d9ddfe Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Thu, 4 Jul 2024 15:00:09 +0200 Subject: [PATCH] http: Rename `state` query param to `status` This allows us to match the query param with the output that is `{ "status": "open" | "merged" | ... }` --- radicle-httpd/src/api.rs | 2 +- radicle-httpd/src/api/v1/projects.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/radicle-httpd/src/api.rs b/radicle-httpd/src/api.rs index 4a0ed40d4..56883dad9 100644 --- a/radicle-httpd/src/api.rs +++ b/radicle-httpd/src/api.rs @@ -160,7 +160,7 @@ pub struct RawQuery { pub struct CobsQuery { pub page: Option, pub per_page: Option, - pub state: Option, + pub status: Option, } #[derive(Serialize, Deserialize, Clone)] diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index d99bdae29..f5ca00e92 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -612,17 +612,17 @@ async fn issues_handler( let CobsQuery { page, per_page, - state, + status, } = qs; let page = page.unwrap_or(0); let per_page = per_page.unwrap_or(10); - let state = state.unwrap_or_default(); + let status = status.unwrap_or_default(); let issues = ctx.profile.issues(&repo)?; let mut issues: Vec<_> = issues .list()? .filter_map(|r| { let (id, issue) = r.ok()?; - (state.matches(issue.state())).then_some((id, issue)) + (status.matches(issue.state())).then_some((id, issue)) }) .collect::>(); @@ -666,17 +666,17 @@ async fn patches_handler( let CobsQuery { page, per_page, - state, + status, } = qs; let page = page.unwrap_or(0); let per_page = per_page.unwrap_or(10); - let state = state.unwrap_or_default(); + let status = status.unwrap_or_default(); let patches = ctx.profile.patches(&repo)?; let mut patches = patches .list()? .filter_map(|r| { let (id, patch) = r.ok()?; - (state.matches(patch.state())).then_some((id, patch)) + (status.matches(patch.state())).then_some((id, patch)) }) .collect::>(); patches.sort_by(|(_, a), (_, b)| b.timestamp().cmp(&a.timestamp()));