first
This commit is contained in:
21
src/data/data.rs
Normal file
21
src/data/data.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use axum::{
|
||||
extract::State,
|
||||
http::StatusCode,
|
||||
response::IntoResponse,
|
||||
routing::get,
|
||||
Router,
|
||||
};
|
||||
use crate::auth::structs::AppState;
|
||||
|
||||
// Define the handler for the /user/ endpoint
|
||||
async fn get_user(State(state): State<AppState>) -> impl IntoResponse {
|
||||
// Placeholder for user data retrieval logic
|
||||
// In a real application, you would query the database using state.db
|
||||
(StatusCode::OK, "User data retrieved successfully")
|
||||
}
|
||||
|
||||
// Define the router for the data module
|
||||
pub fn router() -> Router<AppState> {
|
||||
Router::new()
|
||||
.route("/user/", get(get_user))
|
||||
}
|
||||
1
src/data/mod.rs
Normal file
1
src/data/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod data;
|
||||
10
src/data/struct.rs
Normal file
10
src/data/struct.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
// src/data/struct.rs
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::FromRow;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, FromRow)]
|
||||
pub struct County {
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub state: i32,
|
||||
}
|
||||
Reference in New Issue
Block a user