Can get a single API token
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
//! # API tokens management
|
||||
|
||||
use crate::api_tokens;
|
||||
use crate::api_tokens::NewToken;
|
||||
use crate::api_tokens::{NewToken, TokenID};
|
||||
use crate::controllers::api_tokens_controller::rest_token::RestToken;
|
||||
use crate::controllers::HttpResult;
|
||||
use crate::utils::jwt_utils::TokenPrivKey;
|
||||
@ -58,3 +58,15 @@ pub async fn list() -> HttpResult {
|
||||
|
||||
Ok(HttpResponse::Ok().json(list))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct TokenIDInPath {
|
||||
uid: TokenID,
|
||||
}
|
||||
|
||||
/// Get the information about a single token
|
||||
pub async fn get_single(path: web::Path<TokenIDInPath>) -> HttpResult {
|
||||
let token = api_tokens::get_single(path.uid).await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(RestToken::new(token)))
|
||||
}
|
||||
|
Reference in New Issue
Block a user