diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-13 12:49:15 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-13 12:49:15 +0000 |
| commit | ce62e3bac6a8acea555731d6222028c511dd9019 (patch) | |
| tree | 1f24ef946d8d618ec554129c9a1b4061b3a5a3de /src/routes | |
| parent | 9f7571078ac7fbffe1ca343e245f41646b907bc9 (diff) | |
Drop user creation
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/user.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/routes/user.rs b/src/routes/user.rs index 4ac994c..8c2ec0e 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -1,7 +1,7 @@ use crate::errors::AppError; use crate::models::{ auth::Claims, - user::{User, UserCreate, UserList}, + user::{User, UserList}, }; use crate::pagination::Pagination; use axum::{ @@ -14,7 +14,7 @@ use serde::Serialize; /// Create routes for `/v1/users/` namespace pub fn create_route() -> Router { Router::new() - .route("/", get(list_users).post(create_user)) + .route("/", get(list_users)) .route("/:id", get(get_user)) } @@ -36,17 +36,6 @@ async fn list_users( Ok(Json(UserPagination { count, results })) } -/// Create an user. Checks Authorization token -async fn create_user( - Json(payload): Json<UserCreate>, - _: Claims, -) -> Result<Json<UserList>, AppError> { - let user = User::new(payload.email, payload.username, payload.password); - let user_new = User::create(user).await?; - - Ok(Json(user_new)) -} - /// Get an user with id = `user_id`. Checks Authorization token async fn get_user(Path(user_id): Path<i32>, _: Claims) -> Result<Json<UserList>, AppError> { match User::find_by_id(user_id).await { |
