use crate::graphql::types::{position, user}; use async_graphql::{Context, Object}; /// Query struct pub struct Query; #[Object] impl Query { /// Returns the API version. It is like a "greet" function async fn api_version(&self) -> &'static str { "1.0" } /// Returns all the users async fn users<'ctx>( &self, ctx: &Context<'ctx>, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, ) -> Result>, String> { user::get_users(ctx, limit, offset).await } /// Returns all the positions async fn positions<'ctx>( &self, ctx: &Context<'ctx>, #[graphql(desc = "Filter by user id")] user_id: Option, #[graphql(desc = "Limit results")] limit: Option, #[graphql(desc = "Offset results")] offset: Option, ) -> Result>, String> { position::get_positions(ctx, user_id, limit, offset).await } }