summaryrefslogtreecommitdiff
path: root/src/graphql/mutation.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-08-23 22:19:32 +0200
committerSanto Cariotti <santo@dcariotti.me>2024-08-23 22:19:32 +0200
commit7b9e9d2da5d85f23d43724fe2ca5012918ea54be (patch)
tree801ccae65d27fcf69bfca5db18265fbb7b5d7f21 /src/graphql/mutation.rs
parentcb1aa9668a967fe875e716469ccf936ed8693ad3 (diff)
Add doc
Diffstat (limited to 'src/graphql/mutation.rs')
-rw-r--r--src/graphql/mutation.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/graphql/mutation.rs b/src/graphql/mutation.rs
index 9321653..9cee796 100644
--- a/src/graphql/mutation.rs
+++ b/src/graphql/mutation.rs
@@ -2,10 +2,12 @@ use crate::graphql::types::jwt;
use crate::state::AppState;
use async_graphql::{Context, Error, FieldResult, Object};
+/// Mutation struct
pub struct Mutation;
#[Object]
impl Mutation {
+ /// Make GraphQL login
async fn login<'ctx>(
&self,
ctx: &Context<'ctx>,
@@ -25,6 +27,7 @@ impl Mutation {
let id: Vec<i32> = rows.iter().map(|row| row.get(0)).collect();
if id.len() == 1 {
+ // Create a new claim using the found ID
let claims = jwt::Claims::new(id[0]);
let token = claims.get_token().unwrap();
Ok(jwt::AuthBody::new(token))