From 0dace9fb82953cc91e6d603c4c9970631ac036ad Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 22 Aug 2022 23:07:51 +0200 Subject: Validate into model --- server/src/routes/user.rs | 3 --- 1 file changed, 3 deletions(-) (limited to 'server/src/routes') 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>, AppError> { async fn create_user(Json(payload): Json) -> Result, 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)) -- cgit v1.2.3-18-g5258