use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema}; use std::sync::Arc; use crate::service::GitService; use super::context::{RepoCtx, map_git}; use super::repo::Repo; pub type GitSchema = Schema; pub struct Query; #[Object] impl Query { async fn api_version(&self) -> &'static str { "1.0.0" } async fn repo( &self, ctx: &Context<'_>, space_name: String, repo_name: String, ) -> Result { let svc = ctx.data_unchecked::>().clone(); let ctx_data = svc .context(space_name.clone(), repo_name.clone()) .await .map_err(map_git)?; let baby = svc.baby(&ctx_data); Ok(Repo { inner: RepoCtx { svc, ctx: ctx_data, space_name, repo_name, baby, }, }) } }