refactoring delete models

This commit is contained in:
Peter Schiwy
2024-06-04 11:06:51 +02:00
parent 534d819865
commit 85f1840d7b
8 changed files with 95 additions and 104 deletions

View File

@@ -10,17 +10,6 @@ pub struct HerstellerQuery {
#[Object(extends)]
impl HerstellerQuery {
// #[graphql(external)]
// async fn id(&self) -> &i32 {
// &self.id
// }
// async fn modell<'a>(&self, ctx: &'a Context<'_>) -> FieldResult<Vec<Modell>> {
// let pool = ctx.data::<PgPool>().unwrap();
// let rows = Modell::read_by_typ(pool, &self.id).await?;
// Ok(rows)
// }
async fn alle_hersteller<'a>(&self, ctx: &'a Context<'_>) -> FieldResult<Vec<Hersteller>> {
let pool = ctx.data::<PgPool>()?;
let rows = Hersteller::read_all(pool).await?;

View File

@@ -10,16 +10,6 @@ pub struct TypQuery {
#[Object(extends)]
impl TypQuery {
// #[graphql(external)]
// async fn id(&self) -> &i32 {
// &self.id
// }
// async fn modell<'a>(&self, ctx: &'a Context<'_>) -> FieldResult<Vec<Modell>> {
// let pool = ctx.data::<PgPool>().unwrap();
// let rows = Modell::read_by_typ(pool, &self.id).await?;
// Ok(rows)
// }
async fn typen<'a>(&self, ctx: &'a Context<'_>) -> FieldResult<Vec<Typ>> {
let pool = ctx.data::<PgPool>()?;
let rows = Typ::read_all(pool).await?;
@@ -31,11 +21,4 @@ impl TypQuery {
let row = Typ::read_one(pool, &id).await?;
Ok(row)
}
// #[graphql(entity)]
// async fn find_typ_by_id<'a>(&self, ctx: &'a Context<'_>, id: i32) -> FieldResult<Typ> {
// let pool = ctx.data::<PgPool>().unwrap();
// let row = Typ::read_one(pool, &id).await?;
// Ok(row)
// }
}