httpd: Return correct count for `patches`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
parent
8e26e4c046
commit
a1e1e04fd9
|
|
@ -13,6 +13,7 @@ use tokio::sync::RwLock;
|
|||
use tower_http::cors::{self, CorsLayer};
|
||||
|
||||
use radicle::cob::issue::Issues;
|
||||
use radicle::cob::patch::Patches;
|
||||
use radicle::identity::Id;
|
||||
use radicle::storage::{ReadRepository, ReadStorage};
|
||||
use radicle::Profile;
|
||||
|
|
@ -52,13 +53,14 @@ impl Context {
|
|||
let payload = doc.project()?;
|
||||
let delegates = doc.delegates;
|
||||
let issues = (Issues::open(self.profile.public_key, &repo)?).count()?;
|
||||
let patches = (Patches::open(self.profile.public_key, &repo)?).count()?;
|
||||
|
||||
Ok(project::Info {
|
||||
payload,
|
||||
delegates,
|
||||
head,
|
||||
issues,
|
||||
patches: 0,
|
||||
patches,
|
||||
id,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use axum::routing::get;
|
|||
use axum::{Json, Router};
|
||||
|
||||
use radicle::cob::issue::Issues;
|
||||
use radicle::cob::patch::Patches;
|
||||
use radicle::identity::Did;
|
||||
use radicle::storage::{ReadRepository, ReadStorage};
|
||||
|
||||
|
|
@ -49,13 +50,15 @@ async fn delegates_projects_handler(
|
|||
|
||||
let Ok(issues) = Issues::open(ctx.profile.public_key, &repo) else { return None };
|
||||
let Ok(issues) = (*issues).count() else { return None };
|
||||
let Ok(patches) = Patches::open(ctx.profile.public_key, &repo) else { return None };
|
||||
let Ok(patches) = (*patches).count() else { return None };
|
||||
|
||||
Some(Info {
|
||||
payload,
|
||||
delegates,
|
||||
head,
|
||||
issues,
|
||||
patches: 0,
|
||||
patches,
|
||||
id,
|
||||
})
|
||||
})
|
||||
|
|
@ -93,7 +96,7 @@ mod routes {
|
|||
"defaultBranch": "master",
|
||||
"delegates": ["did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"],
|
||||
"head": HEAD,
|
||||
"patches": 0,
|
||||
"patches": 1,
|
||||
"issues": 1,
|
||||
"id": "rad:z4FucBZHZMCsxTyQE1dfE2YR59Qbp"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ async fn project_root_handler(
|
|||
let Ok(doc) = repo.identity_of(ctx.profile.id()) else { return None };
|
||||
let Ok(issues) = Issues::open(ctx.profile.public_key, &repo) else { return None };
|
||||
let Ok(issues) = (*issues).count() else { return None };
|
||||
let Ok(patches) = Patches::open(ctx.profile.public_key, &repo) else { return None };
|
||||
let Ok(patches) = (*patches).count() else { return None };
|
||||
let delegates = doc.delegates;
|
||||
|
||||
Some(Info {
|
||||
|
|
@ -88,7 +90,7 @@ async fn project_root_handler(
|
|||
delegates,
|
||||
head,
|
||||
issues,
|
||||
patches: 0,
|
||||
patches,
|
||||
id,
|
||||
})
|
||||
})
|
||||
|
|
@ -579,7 +581,7 @@ mod routes {
|
|||
"defaultBranch": "master",
|
||||
"delegates": ["did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"],
|
||||
"head": HEAD,
|
||||
"patches": 0,
|
||||
"patches": 1,
|
||||
"issues": 1,
|
||||
"id": "rad:z4FucBZHZMCsxTyQE1dfE2YR59Qbp"
|
||||
}
|
||||
|
|
@ -602,7 +604,7 @@ mod routes {
|
|||
"defaultBranch": "master",
|
||||
"delegates": ["did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"],
|
||||
"head": HEAD,
|
||||
"patches": 0,
|
||||
"patches": 1,
|
||||
"issues": 1,
|
||||
"id": "rad:z4FucBZHZMCsxTyQE1dfE2YR59Qbp"
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ use axum::body::Body;
|
|||
use axum::body::{BoxBody, Bytes};
|
||||
use axum::extract::{ConnectInfo, Path as AxumPath, RawQuery};
|
||||
use axum::http::header::HeaderName;
|
||||
use axum::http::HeaderMap;
|
||||
use axum::http::{Method, StatusCode};
|
||||
use axum::http::{Request, Response};
|
||||
use axum::http::{HeaderMap, Method, Request, Response, StatusCode};
|
||||
use axum::response::IntoResponse;
|
||||
use axum::routing::any;
|
||||
use axum::{Extension, Router};
|
||||
|
|
|
|||
Loading…
Reference in New Issue