summaryrefslogtreecommitdiff
path: root/src/api/users.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/users.rs')
-rw-r--r--src/api/users.rs35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/api/users.rs b/src/api/users.rs
index 7d1f006..0ce9988 100644
--- a/src/api/users.rs
+++ b/src/api/users.rs
@@ -1,8 +1,11 @@
-use crate::{types::{
- extract::{AuthorizedUser, Check, CheckResult, Json, Png},
- http::ResponseCode,
- user::User,
-}, public::docs::{EndpointDocumentation, EndpointMethod}};
+use crate::{
+ public::docs::{EndpointDocumentation, EndpointMethod},
+ types::{
+ extract::{AuthorizedUser, Check, CheckResult, Json, Png},
+ http::ResponseCode,
+ user::User,
+ },
+};
use axum::{
response::Response,
routing::{post, put},
@@ -14,16 +17,18 @@ pub const USERS_LOAD: EndpointDocumentation = EndpointDocumentation {
uri: "/api/users/load",
method: EndpointMethod::Post,
description: "Loads a requested set of users",
- body: Some(r#"
+ body: Some(
+ r#"
{
"ids": [0, 3, 7]
}
- "#),
+ "#,
+ ),
responses: &[
(200, "Returns users in <span>application/json</span>"),
(400, "Body does not match parameters"),
(401, "Unauthorized"),
- (500, "Failed to fetch users")
+ (500, "Failed to fetch users"),
],
cookie: Some("auth"),
};
@@ -55,17 +60,19 @@ pub const USERS_PAGE: EndpointDocumentation = EndpointDocumentation {
uri: "/api/users/page",
method: EndpointMethod::Post,
description: "Load a section of users from newest to oldest",
- body: Some(r#"
+ body: Some(
+ r#"
{
"user_id": 3,
"page": 0
}
- "#),
+ "#,
+ ),
responses: &[
(200, "Returns users in <span>application/json</span>"),
(400, "Body does not match parameters"),
(401, "Unauthorized"),
- (500, "Failed to fetch users")
+ (500, "Failed to fetch users"),
],
cookie: Some("auth"),
};
@@ -104,7 +111,7 @@ pub const USERS_SELF: EndpointDocumentation = EndpointDocumentation {
responses: &[
(200, "Successfully executed SQL query"),
(401, "Unauthorized"),
- (500, "Failed to fetch user")
+ (500, "Failed to fetch user"),
],
cookie: Some("auth"),
};
@@ -126,7 +133,7 @@ pub const USERS_AVATAR: EndpointDocumentation = EndpointDocumentation {
(200, "Successfully updated avatar"),
(400, "Invalid PNG or disallowed size"),
(401, "Unauthorized"),
- (500, "Failed to update avatar")
+ (500, "Failed to update avatar"),
],
cookie: Some("auth"),
};
@@ -150,7 +157,7 @@ pub const USERS_BANNER: EndpointDocumentation = EndpointDocumentation {
(200, "Successfully updated banner"),
(400, "Invalid PNG or disallowed size"),
(401, "Unauthorized"),
- (500, "Failed to update banner")
+ (500, "Failed to update banner"),
],
cookie: Some("auth"),
};