Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: git_forge read handlers take a forge-only sub-state

This commit is contained in:
atlas 2026-11-29 13:33:00 +01:00 • committed by mara
commit 52bfca85ad

View file

@ -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()))?;