summaryrefslogtreecommitdiff
path: root/src/graphql.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-08-21 11:59:50 +0200
committerSanto Cariotti <santo@dcariotti.me>2024-08-21 12:04:28 +0200
commit185ba5270aaf94de9b91e4455be27db5198ec21e (patch)
treefc8d71e7ac6fd6b5b5aa8cc3fbf3c511d2b51342 /src/graphql.rs
parentc2b09dbb88591d9695c1cd2227c5d559b4a8e775 (diff)
Reformat graphql mod
Diffstat (limited to 'src/graphql.rs')
-rw-r--r--src/graphql.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/graphql.rs b/src/graphql.rs
deleted file mode 100644
index 2843156..0000000
--- a/src/graphql.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-use std::sync::Arc;
-
-use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema};
-use async_graphql_axum::{GraphQLRequest, GraphQLResponse};
-
-// use crate::state::AppState;
-
-pub struct Query;
-
-#[Object]
-impl Query {
- async fn api_version(&self) -> &'static str {
- "1.0"
- }
-
- /// Returns the sum of a and b
- async fn add<'ctx>(
- &self,
- _ctx: &Context<'ctx>,
- #[graphql(desc = "First value")] a: i32,
- #[graphql(desc = "Second value")] b: Option<i32>,
- ) -> i32 {
- // let state = ctx.data::<AppState>().unwrap();
- // let client = &*state.client;
- //
- // // Perform a database query
- // let rows = client
- // .query("SELECT owner FROM payment", &[])
- // .await
- // .unwrap();
- // for row in rows {
- // let owner: String = row.get(0);
- // println!("{owner}");
- // }
-
- match b {
- Some(x) => a + x,
- None => a,
- }
- }
-}
-
-pub async fn graphql_handler(
- schema: Arc<Schema<Query, EmptyMutation, EmptySubscription>>,
- req: GraphQLRequest,
-) -> GraphQLResponse {
- schema.execute(req.into_inner()).await.into()
-}