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