diff --git a/radicle-httpd/src/api/error.rs b/radicle-httpd/src/api/error.rs index f1763e266..6ecfacaf8 100644 --- a/radicle-httpd/src/api/error.rs +++ b/radicle-httpd/src/api/error.rs @@ -77,20 +77,29 @@ pub enum Error { /// Routing store error. #[error(transparent)] RoutingStore(#[from] radicle::node::routing::Error), + + /// Invalid update to issue or patch. + #[error("{0}")] + BadRequest(String), } impl IntoResponse for Error { fn into_response(self) -> Response { - let (status, msg) = match &self { + let message = self.to_string(); + let (status, msg) = match self { Error::NotFound => (StatusCode::NOT_FOUND, None), + Error::CobStore(radicle::cob::store::Error::NotFound(_, _)) => { + (StatusCode::NOT_FOUND, None) + } Error::Auth(msg) => (StatusCode::BAD_REQUEST, Some(msg.to_string())), Error::Crypto(msg) => (StatusCode::BAD_REQUEST, Some(msg.to_string())), Error::Git2(e) => ( StatusCode::INTERNAL_SERVER_ERROR, Some(e.message().to_owned()), ), + Error::BadRequest(msg) => (StatusCode::BAD_REQUEST, Some(msg)), other => { - tracing::error!("Error: {:?}", &self); + tracing::error!("Error: {message}"); if cfg!(debug_assertions) { ( diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index d3b9183da..88507adfb 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -108,7 +108,7 @@ pub(crate) fn issue(id: IssueId, issue: Issue, aliases: &impl AliasStore) -> Val .comments() .map(|(id, comment)| Comment::new(id, comment, aliases)) .collect::>(), - "tags": issue.tags().collect::>(), + "labels": issue.labels().collect::>(), }) } @@ -125,9 +125,9 @@ pub(crate) fn patch( "title": patch.title(), "state": patch.state(), "target": patch.target(), - "tags": patch.tags().collect::>(), + "labels": patch.labels().collect::>(), "merges": patch.merges().map(|(nid, m)| merge(m, nid, aliases.alias(nid))).collect::>(), - "reviewers": patch.reviewers().collect::>(), + "assignees": patch.assignees().collect::>(), "revisions": patch.revisions().map(|(id, rev)| { json!({ "id": id, diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index fd3d7c3ce..e2212ccd0 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -12,8 +12,8 @@ use serde::{Deserialize, Serialize}; use serde_json::json; use tower_http::set_header::SetResponseHeaderLayer; -use radicle::cob::{issue, patch, thread, ActorId, Tag}; -use radicle::identity::Id; +use radicle::cob::{issue, patch, Label}; +use radicle::identity::{Did, Id}; use radicle::node::routing::Store; use radicle::node::AliasStore; use radicle::node::NodeId; @@ -481,8 +481,8 @@ async fn issues_handler( pub struct IssueCreate { pub title: String, pub description: String, - pub tags: Vec, - pub assignees: Vec, + pub labels: Vec