mirror of
https://github.com/kristoferssolo/Axium.git
synced 2025-10-21 16:00:34 +00:00
18 lines
427 B
Rust
18 lines
427 B
Rust
use axum::{Extension, Json, response::IntoResponse};
|
|
use serde::{Serialize, Deserialize};
|
|
use crate::models::user::User;
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
struct UserResponse {
|
|
id: i32,
|
|
username: String,
|
|
email: String
|
|
}
|
|
|
|
pub async fn protected(Extension(user): Extension<User>) -> impl IntoResponse {
|
|
Json(UserResponse {
|
|
id: user.id,
|
|
username: user.username,
|
|
email: user.email
|
|
})
|
|
} |