diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-08-22 22:25:57 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2024-08-22 22:26:24 +0200 |
commit | fc51ff9e22a809e257ae92f12272f1dbcb31f594 (patch) | |
tree | b1e0fcd8e9ca931f7d89b976eaf2a40388e98f6c /src/graphql/query.rs | |
parent | 8738cf2c6b1ce9f99e3399f35ba9f49832ffed52 (diff) |
Add position type and query on it
Diffstat (limited to 'src/graphql/query.rs')
-rw-r--r-- | src/graphql/query.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/graphql/query.rs b/src/graphql/query.rs index 0e19771..a875d25 100644 --- a/src/graphql/query.rs +++ b/src/graphql/query.rs @@ -1,4 +1,4 @@ -use crate::{errors::AppError, graphql::types::user}; +use crate::graphql::types::{position, user}; use async_graphql::{Context, Object}; pub struct Query; @@ -18,4 +18,14 @@ impl Query { ) -> Result<Option<Vec<user::User>>, String> { user::get_users(ctx, limit, offset).await } + + /// Returns all the positions + async fn positions<'ctx>( + &self, + ctx: &Context<'ctx>, + #[graphql(desc = "Limit results")] limit: Option<i64>, + #[graphql(desc = "Offset results")] offset: Option<i64>, + ) -> Result<Option<Vec<position::Position>>, String> { + position::get_positions(ctx, limit, offset).await + } } |