33
crates/como_gql/src/lib.rs
Normal file
33
crates/como_gql/src/lib.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
pub mod graphql;
|
||||
mod items;
|
||||
mod projects;
|
||||
|
||||
pub mod common {
|
||||
use async_graphql::Context;
|
||||
use como_core::items::DynItemService;
|
||||
use como_core::projects::DynProjectService;
|
||||
use como_infrastructure::register::ServiceRegister;
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn get_domain_context<'a>(ctx: &Context<'a>) -> &'a como_domain::Context {
|
||||
ctx.data_unchecked::<como_domain::Context>()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[inline(always)]
|
||||
pub(crate) fn get_service_register<'a>(ctx: &Context<'a>) -> &'a ServiceRegister {
|
||||
ctx.data_unchecked::<ServiceRegister>()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn project_service<'a>(ctx: &Context<'a>) -> DynProjectService {
|
||||
ctx.data_unchecked::<ServiceRegister>()
|
||||
.project_service
|
||||
.clone()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn item_service<'a>(ctx: &Context<'a>) -> DynItemService {
|
||||
ctx.data_unchecked::<ServiceRegister>().item_service.clone()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user