style: cargo fmt

DevITWay
This commit is contained in:
2026-03-03 11:03:40 +00:00
parent 99c1f9b5ec
commit 8da4c4278a
12 changed files with 492 additions and 32 deletions

View File

@@ -13,8 +13,8 @@ use std::collections::HashMap;
use std::path::Path;
use std::sync::Arc;
use crate::AppState;
use crate::tokens::Role;
use crate::AppState;
/// Htpasswd-based authentication
#[derive(Clone)]
@@ -247,12 +247,18 @@ async fn create_token(
};
let role = match req.role.as_str() {
"read" => Role::Read,
"write" => Role::Write,
"admin" => Role::Admin,
_ => return (StatusCode::BAD_REQUEST, "Invalid role. Use: read, write, admin").into_response(),
};
match token_store.create_token(&req.username, req.ttl_days, req.description, role) {
"read" => Role::Read,
"write" => Role::Write,
"admin" => Role::Admin,
_ => {
return (
StatusCode::BAD_REQUEST,
"Invalid role. Use: read, write, admin",
)
.into_response()
}
};
match token_store.create_token(&req.username, req.ttl_days, req.description, role) {
Ok(token) => Json(CreateTokenResponse {
token,
expires_in_days: req.ttl_days,