summaryrefslogtreecommitdiff
path: root/server/src/routes
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-08-22 23:07:51 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-08-22 23:07:51 +0200
commit0dace9fb82953cc91e6d603c4c9970631ac036ad (patch)
tree5ecd0328296871a38d61bef4ab5a6f903877ef29 /server/src/routes
parentea2ac88a83b6de15beb8b9727f88d498a56fb5b3 (diff)
Validate into model
Diffstat (limited to 'server/src/routes')
-rw-r--r--server/src/routes/user.rs3
1 files changed, 0 insertions, 3 deletions
diff --git a/server/src/routes/user.rs b/server/src/routes/user.rs
index c15b5aa..15a67be 100644
--- a/server/src/routes/user.rs
+++ b/server/src/routes/user.rs
@@ -1,7 +1,6 @@
use crate::errors::AppError;
use crate::models::user::{User, UserCreate, UserList};
use axum::{routing::get, Json, Router};
-use validator::Validate;
pub fn create_route() -> Router {
Router::new().route("/", get(list_users).post(create_user))
@@ -15,8 +14,6 @@ async fn list_users() -> Result<Json<Vec<UserList>>, AppError> {
async fn create_user(Json(payload): Json<UserCreate>) -> Result<Json<UserList>, AppError> {
let user = User::new(payload.email, payload.password);
- user.validate()
- .map_err(|error| AppError::BadRequest(error.to_string()))?;
let user_new = User::create(user).await?;
Ok(Json(user_new))