como/crates/como_gql/src/lib.rs
kjuulh 6e16fc6b2b
feat: move project to crates
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-10-21 11:14:58 +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()
}
}