30 lines
734 B
Rust
30 lines
734 B
Rust
use axum::{debug_handler, Extension, Json};
|
|
|
|
use crate::{
|
|
api::{
|
|
backend::ApiBackend,
|
|
description::API_KEY_TAG,
|
|
routes::api_keys::{models::ApiKey, sql},
|
|
},
|
|
errors::ApiError,
|
|
};
|
|
|
|
#[debug_handler]
|
|
#[utoipa::path(
|
|
get,
|
|
path = "/apikeys",
|
|
summary = "Get all API Keys",
|
|
description = "Get a list of all configured API Keys.",
|
|
responses(
|
|
(status = OK, body = Vec<ApiKey>, description = "List of API Keys"),
|
|
),
|
|
security(
|
|
("user_auth" = ["read:apikeys",]),
|
|
),
|
|
tag = API_KEY_TAG)]
|
|
pub async fn get_api_keys(
|
|
Extension(backend): Extension<ApiBackend>,
|
|
) -> Result<Json<Vec<ApiKey>>, ApiError> {
|
|
Ok(Json(sql::get_api_keys(backend.pool()).await?))
|
|
}
|