19 lines
507 B
Rust
19 lines
507 B
Rust
use crate::service::MagnetarService;
|
|
use crate::web::auth::AuthenticatedUser;
|
|
use crate::web::ApiError;
|
|
use axum::extract::State;
|
|
use axum::response::IntoResponse;
|
|
use axum::Json;
|
|
use std::sync::Arc;
|
|
|
|
// TODO: Not a real endpoint
|
|
pub async fn handle_user_info(
|
|
State(service): State<Arc<MagnetarService>>,
|
|
AuthenticatedUser(user): AuthenticatedUser,
|
|
) -> Result<impl IntoResponse, ApiError> {
|
|
let db = service.db.clone();
|
|
let user = db.get_user_by_id(&user.id).await?;
|
|
|
|
Ok(Json(user))
|
|
}
|