use async_graphql::{Context, FieldResult, Object}; use sqlx::postgres::PgPool; use crate::{ domain::typ::{model::Typ, service::Service}, scalar::Ulid, }; #[derive(Default)] pub struct TypQuery {} #[Object(extends)] impl TypQuery { async fn typen(&self, ctx: &Context<'_>) -> FieldResult> { let pool = ctx.data::()?.clone(); let typen = Service::new(pool).typ_alle().await?; Ok(typen) } async fn einen_typen(&self, ctx: &Context<'_>, id: Ulid) -> FieldResult { let pool = ctx.data::()?.clone(); let typ = Service::new(pool).typ_einen_zeigen(id).await?; Ok(typ) } }