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