add user endpoint

This commit is contained in:
2025-08-15 18:38:57 -04:00
parent 34a6f211de
commit 8a05f4edac
8 changed files with 72 additions and 1 deletions

3
src/handlers/user/mod.rs Normal file
View File

@@ -0,0 +1,3 @@
// src/handlers/user/mod.rs
pub mod user;

48
src/handlers/user/user.rs Normal file
View File

@@ -0,0 +1,48 @@
// src/handlers/user/user.rs
use axum::Json;
use axum::http::StatusCode;
use axum::response::IntoResponse;
use serde_json::json;
pub async fn user() -> impl IntoResponse {
(
StatusCode::OK,
Json(json!(
{
"message": "health check successful",
"data": {
"id": "usr_123456789",
"username": "john_doe",
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"role": "user",
"is_active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-08-15T14:20:00Z",
"profile": {
"avatar_url": "https://api.example.com/avatars/john_doe.png",
"bio": "Software developer passionate about Rust",
"location": "San Francisco, CA",
"website": "https://johndoe.dev"
},
"preferences": {
"theme": "dark",
"language": "en",
"notifications_enabled": true,
"email_verified": true
},
"stats": {
"total_posts": 42,
"total_comments": 156,
"total_likes": 523,
"account_age_days": 213
}
},
"success": true,
"error": false,
}
)),
)
}