fluentci_graphql/schema/
hermit.rs

1use std::sync::{Arc, Mutex};
2
3use super::objects::hermit::Hermit;
4use async_graphql::{Context, Error, Object};
5use fluentci_common::hermit::hermit as common_hermit;
6use fluentci_core::deps::Graph;
7
8#[derive(Default, Clone)]
9pub struct HermitQuery;
10
11#[Object]
12impl HermitQuery {
13    async fn hermit(&self, ctx: &Context<'_>) -> Result<Hermit, Error> {
14        let graph = ctx.data::<Arc<Mutex<Graph>>>().unwrap();
15        let hermit = common_hermit(graph.clone(), true)?;
16        Ok(Hermit::from(hermit))
17    }
18}