summaryrefslogtreecommitdiff
path: root/src/graphql/query.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-08-23 22:37:46 +0200
committerSanto Cariotti <santo@dcariotti.me>2024-08-23 22:37:46 +0200
commitd1160f2aa59db4489aad506aaa063be4966609ce (patch)
tree255e7849e677ff1f50b30ffa168ba1a15f85c50b /src/graphql/query.rs
parent7b9e9d2da5d85f23d43724fe2ca5012918ea54be (diff)
Add `lastPositions` query with filter by `movingActivity` param
Diffstat (limited to 'src/graphql/query.rs')
-rw-r--r--src/graphql/query.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/graphql/query.rs b/src/graphql/query.rs
index 9a7ac87..c751543 100644
--- a/src/graphql/query.rs
+++ b/src/graphql/query.rs
@@ -31,4 +31,16 @@ impl Query {
) -> Result<Option<Vec<position::Position>>, String> {
position::get_positions(ctx, user_id, limit, offset).await
}
+
+ /// Returns all the last positions for each user.
+ /// It is restricted to only admin users.
+ async fn last_positions<'ctx>(
+ &self,
+ ctx: &Context<'ctx>,
+ #[graphql(desc = "Filter by moving activity")] moving_activity: Option<
+ position::MovingActivity,
+ >,
+ ) -> Result<Option<Vec<position::Position>>, String> {
+ position::last_positions(ctx, moving_activity).await
+ }
}