summaryrefslogtreecommitdiff
path: root/src/api/users.rs
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-01-26 21:29:06 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-01-26 21:29:06 -0500
commit6bea3bf2ef31f978b98848a5f2a045dcab0cc2f0 (patch)
tree76e6eda59aa43378f5744fd08962b9767147671f /src/api/users.rs
parenti did things (diff)
downloadxssbook-6bea3bf2ef31f978b98848a5f2a045dcab0cc2f0.tar.gz
xssbook-6bea3bf2ef31f978b98848a5f2a045dcab0cc2f0.tar.bz2
xssbook-6bea3bf2ef31f978b98848a5f2a045dcab0cc2f0.zip
input length and range checking
Diffstat (limited to 'src/api/users.rs')
-rw-r--r--src/api/users.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/users.rs b/src/api/users.rs
index 283ec96..45ed195 100644
--- a/src/api/users.rs
+++ b/src/api/users.rs
@@ -1,12 +1,18 @@
use axum::{Router, response::Response, routing::post};
use serde::Deserialize;
-use crate::types::{extract::{AuthorizedUser, Json}, response::ResponseCode, user::User};
+use crate::types::{extract::{AuthorizedUser, Json, Check, CheckResult}, response::ResponseCode, user::User};
#[derive(Deserialize)]
struct UserLoadRequest {
ids: Vec<u64>
}
+impl Check for UserLoadRequest {
+ fn check(&self) -> CheckResult {
+ Ok(())
+ }
+}
+
async fn load_batch(AuthorizedUser(_user): AuthorizedUser, Json(body): Json<UserLoadRequest>) -> Response {
let users = User::from_user_ids(body.ids);
@@ -22,6 +28,12 @@ struct UserPageReqiest {
page: u64
}
+impl Check for UserPageReqiest {
+ fn check(&self) -> CheckResult {
+ Ok(())
+ }
+}
+
async fn load_page(AuthorizedUser(_user): AuthorizedUser, Json(body): Json<UserPageReqiest>) -> Response {
let Ok(users) = User::from_user_page(body.page) else {