refactor queries

This commit is contained in:
2026-05-31 22:03:06 +02:00
parent 90a88c15dc
commit 7ffd06f446
13 changed files with 15 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
use async_graphql::{Context, FieldResult, Object};
use sqlx::postgres::PgPool;
use crate::domain::benutzer::{model::Benutzer, service::Service};
#[derive(Default)]
pub struct BenutzerQuery {}
#[Object(extends)]
impl BenutzerQuery {
// async fn rolle<'a>(&self, ctx: &'a Context<'_>, id: Id) -> FieldResult<Modell> {
// let pool = ctx.data::<PgPool>()?;
// let row = Modell::read_one(pool, &id).await?;
// Ok(row)
// }
async fn benutzer_alle(&self, ctx: &Context<'_>) -> FieldResult<Vec<Benutzer>> {
let pool = ctx.data::<PgPool>()?;
let benutzer = Service::new(pool.clone()).alle_benutzer().await?;
Ok(benutzer)
}
}