diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-06 02:09:26 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-06 02:10:32 -0500 |
commit | 9822bc18bb0cb5e13104376ecefc6ec99d93b016 (patch) | |
tree | 0137399c270a69a2c09e7c0e4c41f64cad5dbbfe /src/routes/register.rs | |
parent | f7dd456941dbc5f926a04935d3aaaa198741608e (diff) |
feat: impl jwt auth middleware and user route
Diffstat (limited to 'src/routes/register.rs')
-rw-r--r-- | src/routes/register.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/routes/register.rs b/src/routes/register.rs index 9a4f007..d2a570c 100644 --- a/src/routes/register.rs +++ b/src/routes/register.rs @@ -9,7 +9,7 @@ use axum_extra::routing::TypedPath; use serde::Deserialize; use crate::{ - model::{RegisterSchema, User}, + model::{RegisterSchema, UserSchema}, state::AppState, Error, }; @@ -45,7 +45,7 @@ impl Register { let password_hash = Argon2::default().hash_password(password.as_bytes(), &salt)?; let user = sqlx::query_as!( - User, + UserSchema, "INSERT INTO users (name,email,password_hash) VALUES ($1, $2, $3) RETURNING *", name, email.to_ascii_lowercase(), @@ -103,7 +103,7 @@ mod tests { assert_eq!(StatusCode::CREATED, response.status()); let body_bytes = response.into_body().collect().await?.to_bytes(); - let User { name, email, .. } = serde_json::from_slice(&body_bytes)?; + let UserSchema { name, email, .. } = serde_json::from_slice(&body_bytes)?; assert_eq!(user.name, name); assert_eq!(user.email, email); |