summaryrefslogtreecommitdiff
path: root/src/api/ops.rs
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-05-14 10:28:20 -0400
committermrw1593 <botahamec@outlook.com>2023-05-29 10:45:59 -0400
commitff389fe18b3eb9eef54c69f201d96e940eb82a23 (patch)
treea274cc8e223dcf7e1d78182db28488dd5484e76b /src/api/ops.rs
parentafe8b4e6e2f1e854d8a97d3f62a4b011eea59130 (diff)
Update documentation
Diffstat (limited to 'src/api/ops.rs')
-rw-r--r--src/api/ops.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/api/ops.rs b/src/api/ops.rs
index 9bebc2d..018743c 100644
--- a/src/api/ops.rs
+++ b/src/api/ops.rs
@@ -6,12 +6,15 @@ use thiserror::Error;
use crate::services::db;
+/// A request to login
#[derive(Debug, Clone, Deserialize)]
struct LoginRequest {
username: Box<str>,
password: Box<str>,
}
+/// An error occurred when authenticating, because either the username or
+/// password was invalid.
#[derive(Debug, Clone, Error)]
enum LoginFailure {
#[error("No user found with the given username")]
@@ -29,6 +32,9 @@ impl ResponseError for LoginFailure {
}
}
+/// Returns `200` if login was successful.
+/// Returns `404` if the username is invalid.
+/// Returns `401` if the password was invalid.
#[post("/login")]
async fn login(
body: web::Json<LoginRequest>,