remane queries to query
This commit is contained in:
25
src/domain/typ/query/typ.rs
Normal file
25
src/domain/typ/query/typ.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user