feat: with create project

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-05-28 16:25:25 +02:00
parent c81a988061
commit 6dc0c24443
8 changed files with 92 additions and 40 deletions

View File

@@ -95,7 +95,9 @@ impl AuthController {
}
}
pub struct UserFromSession {}
pub struct UserFromSession {
pub user: User,
}
#[async_trait]
impl<S> FromRequestParts<S> for UserFromSession
@@ -123,7 +125,7 @@ where
session_cookie
);
// continue to decode the session cookie
let _user =
let user =
if let Some(session) = store.load_session(session_cookie.to_owned()).await.unwrap() {
if let Some(user) = session.get::<User>("user") {
tracing::debug!(
@@ -146,6 +148,6 @@ where
return Err((StatusCode::BAD_REQUEST, "No session found for cookie"));
};
Ok(UserFromSession {})
Ok(UserFromSession { user })
}
}

View File

@@ -32,7 +32,7 @@ pub async fn graphql_handler(
req: GraphQLRequest,
) -> Result<GraphQLResponse, StatusCode> {
let req = req.into_inner();
let req = req.data(user);
let req = req.data(user.user);
Ok(schema.execute(req).await.into())
}