remane queries to query

This commit is contained in:
2026-06-06 17:03:35 +02:00
parent e649d0211a
commit c0e4b88c05
23 changed files with 33 additions and 26 deletions

View File

@@ -0,0 +1,25 @@
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<Vec<Typ>> {
let pool = ctx.data::<PgPool>()?.clone();
let typen = Service::new(pool).typ_alle().await?;
Ok(typen)
}
async fn einen_typen(&self, ctx: &Context<'_>, id: Ulid) -> FieldResult<Typ> {
let pool = ctx.data::<PgPool>()?.clone();
let typ = Service::new(pool).typ_einen_zeigen(id).await?;
Ok(typ)
}
}