refactor queries
This commit is contained in:
16
src/domain/typ/queries/typ.rs
Normal file
16
src/domain/typ/queries/typ.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use async_graphql::{Context, FieldResult, Object};
|
||||
use sqlx::postgres::PgPool;
|
||||
|
||||
use crate::domain::typ::{model::Typ, service::Service};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TypQuery {}
|
||||
|
||||
#[Object(extends)]
|
||||
impl TypQuery {
|
||||
async fn typen(&self, ctx: &Context<'_>) -> FieldResult<Vec<Typ>> {
|
||||
let pool = ctx.data::<PgPool>()?;
|
||||
let typen = Service::new(pool.clone()).typ_alle().await?;
|
||||
Ok(typen)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user