Can get the list of tokens

This commit is contained in:
2024-04-09 18:56:12 +02:00
parent 60a3cb3d10
commit f56e9c14b2
3 changed files with 28 additions and 2 deletions

View File

@ -47,3 +47,14 @@ pub async fn create(new_token: web::Json<NewToken>) -> HttpResult {
priv_key,
}))
}
/// Get the list of API tokens
pub async fn list() -> HttpResult {
let list = api_tokens::full_list()
.await?
.into_iter()
.map(RestToken::new)
.collect::<Vec<_>>();
Ok(HttpResponse::Ok().json(list))
}