diff --git a/server/src/controller/todo.rs b/server/src/controller/todo.rs deleted file mode 100644 index c692447..0000000 --- a/server/src/controller/todo.rs +++ /dev/null @@ -1,54 +0,0 @@ -// https://github.com/tokio-rs/axum/discussions/2081 -// use axum::{ -// async_trait, -// extract::{FromRequest, FromRequestParts, Query}, -// http, response, -// }; -// use serde::{Deserialize, Serialize}; -// use validator::Validate; - -// pub struct Validated(pub T); - -// #[async_trait] -// impl FromRequest for Validated -// where -// S: Send + Sync, -// B: Send + 'static, -// T: Validate, -// Query: FromRequestParts, -// { -// type Rejection = (http::StatusCode, String); - -// async fn from_request(req: http::Request, state: &S) -> Result { -// let query = Query::::from_request(req, state).await; - -// if let Ok(Query(data)) = query { -// match data.validate() { -// Ok(_) => Ok(Validated(data)), -// Err(err) => Err((http::StatusCode::BAD_REQUEST, err.to_string())), -// } -// } else { -// Err(( -// http::StatusCode::INTERNAL_SERVER_ERROR, -// "internal server error".to_string(), -// )) -// } -// } -// } - -// // my handler -// #[derive(Deserialize, Serialize, Validate)] -// pub struct Pagination { -// #[validate(range(min = 1))] -// page: usize, - -// #[validate(range(max = 100))] -// per_page: usize, -// } - -// #[axum::debug_handler] -// pub async fn get_query_string( -// Validated(pagination): Validated, -// ) -> response::Json { -// response::Json(pagination) -// } \ No newline at end of file