como/como_gql/src/lib.rs
kjuulh 2604c5e301
feat: with updated deps
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-06-04 14:42:38 +02:00

34 lines
979 B
Rust

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()
}
}