From 7b9e9d2da5d85f23d43724fe2ca5012918ea54be Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 23 Aug 2024 22:19:32 +0200 Subject: Add doc --- src/graphql/mutation.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/graphql/mutation.rs') 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 = 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)) -- cgit v1.2.3-18-g5258