mirror of
https://github.com/shiroyashik/sculptor.git
synced 2025-12-06 13:01:12 +03:00
The system design has changed, but the refactor is not over.
In future commits, I will strive to maintain a consistent style.
This commit is contained in:
parent
7594e3d615
commit
a1f9eba502
25 changed files with 410 additions and 367 deletions
24
src/api/v1/users.rs
Normal file
24
src/api/v1/users.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use axum::{
|
||||
extract::State,
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
Json
|
||||
};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::{auth::{Token, Userinfo}, AppState};
|
||||
|
||||
pub(super) async fn create_user(
|
||||
Token(token): Token,
|
||||
State(state): State<AppState>,
|
||||
Json(json): Json<Userinfo>
|
||||
) -> Response {
|
||||
debug!("Json: {json:?}");
|
||||
match state.config.lock().await.clone().verify_token(&token) {
|
||||
Ok(_) => {},
|
||||
Err(e) => return e,
|
||||
}
|
||||
|
||||
state.user_manager.insert_user(json.uuid, json);
|
||||
(StatusCode::OK, "ok".to_string()).into_response()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue