From 99bb59373b5918b2baf7e70f510d2b0ec1122a28 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 16 Sep 2024 22:40:24 +0200 Subject: Use `AppState` instead of `String` using some traits --- src/graphql/query.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/graphql/query.rs') diff --git a/src/graphql/query.rs b/src/graphql/query.rs index e3750c9..9e6e0c3 100644 --- a/src/graphql/query.rs +++ b/src/graphql/query.rs @@ -1,4 +1,4 @@ -use crate::graphql::types::*; +use crate::{errors::AppError, graphql::types::*}; use async_graphql::{Context, Object}; /// Query struct @@ -25,7 +25,7 @@ impl Query { ctx: &Context<'ctx>, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, - ) -> Result>, String> { + ) -> Result>, AppError> { user::query::get_users(ctx, limit, offset).await } @@ -42,7 +42,7 @@ impl Query { &self, ctx: &Context<'ctx>, #[graphql(desc = "User to find")] id: i32, - ) -> Result { + ) -> Result { user::query::get_user_by_id(ctx, id).await } @@ -61,7 +61,7 @@ impl Query { #[graphql(desc = "Filter by user id")] user_id: Option, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, - ) -> Result>, String> { + ) -> Result>, AppError> { position::query::get_positions(ctx, user_id, limit, offset).await } @@ -81,7 +81,7 @@ impl Query { #[graphql(desc = "Filter by moving activity")] moving_activity: Option< position::MovingActivity, >, - ) -> Result>, String> { + ) -> Result>, AppError> { position::query::last_positions(ctx, moving_activity).await } @@ -100,7 +100,7 @@ impl Query { #[graphql(desc = "Filter by ID")] id: Option, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, - ) -> Result>, String> { + ) -> Result>, AppError> { alert::query::get_alerts(ctx, id, limit, offset).await } @@ -128,7 +128,7 @@ impl Query { #[graphql(desc = "Filter by alert ID")] alert_id: Option, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, - ) -> Result>, String> { + ) -> Result>, AppError> { notification::query::get_notifications(ctx, seen, id, alert_id, limit, offset).await } } -- cgit v1.2.3-18-g5258