swarm-controller: git_forge read handlers take a forge-only sub-state
This commit is contained in:
parent
b184f4e096
commit
52bfca85ad
1 changed files with 37 additions and 10 deletions
|
|
@ -13,9 +13,10 @@ use serde::Deserialize;
|
|||
use utoipa::IntoParams;
|
||||
|
||||
use crate::forge::{self, OpenPull};
|
||||
use crate::git_forge::GitForgeState;
|
||||
use crate::issue_report::issue_report_error_status;
|
||||
use crate::review_classifier::split_repo;
|
||||
use crate::routes::{AppState, error_problem};
|
||||
use crate::routes::error_problem;
|
||||
|
||||
/// Whose open pull requests to list.
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
|
|
@ -36,7 +37,7 @@ pub(crate) struct PullsQuery {
|
|||
tag = "pulls"
|
||||
)]
|
||||
pub(crate) async fn get_pull_repos(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<GitForgeState>,
|
||||
) -> Result<Json<Vec<String>>, ProblemDetails> {
|
||||
let Some(client) = state.forge.get() else {
|
||||
return Err(no_forge());
|
||||
|
|
@ -61,7 +62,7 @@ pub(crate) async fn get_pull_repos(
|
|||
tag = "pulls"
|
||||
)]
|
||||
pub(crate) async fn get_pulls(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<GitForgeState>,
|
||||
query: Result<Query<PullsQuery>, QueryRejection>,
|
||||
) -> Result<Json<Vec<OpenPull>>, ProblemDetails> {
|
||||
let Query(query) = query.map_err(|e| error_problem(StatusCode::BAD_REQUEST, &e.body_text()))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue