1use std::sync::Arc;
2
3use async_graphql::{EmptySubscription, Schema};
4use mutation::Mutation;
5use ora_client::ClientOperations;
6use ora_worker::registry::WorkerRegistry;
7use query::Query;
8
9pub(crate) mod common;
10pub(crate) mod mutation;
11pub(crate) mod query;
12
13pub type OraSchema = Schema<Query, Mutation, EmptySubscription>;
14
15pub fn create_schema<C, W>(client: C, worker_registry: W) -> OraSchema
17where
18 C: ClientOperations,
19 W: WorkerRegistry + Send + Sync + 'static,
20{
21 let client = Arc::new(client);
22 let worker_registry = Arc::new(worker_registry);
23 Schema::new(
24 Query {
25 client: client.clone(),
26 worker_registry: worker_registry.clone(),
27 },
28 Mutation {
29 client,
30 worker_registry,
31 },
32 EmptySubscription,
33 )
34}