Files
keep/src/modes/server/api/status.rs
Andrew Phillips d5c36155e3 feat: add unified status service implementation
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 16:57:04 -03:00

51 lines
1.5 KiB
Rust

use axum::{
extract::State,
http::StatusCode,
response::Json,
};
use strum::IntoEnumIterator;
use crate::modes::server::common::{AppState, ApiResponse, StatusInfoResponse};
use crate::common::status::{generate_status_info, StatusInfo};
use crate::meta_plugin::MetaPluginType;
use crate::compression_engine::CompressionType;
#[utoipa::path(
get,
path = "/api/status",
operation_id = "keep_status",
summary = "Get system status",
description = "Retrieve system status including database info, storage paths, compression engines, and metadata plugins.",
responses(
(status = 200, description = "System status retrieved", body = StatusInfoResponse),
(status = 401, description = "Unauthorized"),
(status = 500, description = "Internal server error")
),
security(
("bearerAuth" = [])
),
tag = "status"
)]
pub async fn handle_status(
State(state): State<AppState>,
) -> Result<Json<ApiResponse<StatusInfo>>, StatusCode> {
// Get database path
let db_path = state.db.lock().await.path().unwrap_or("unknown").to_string();
// Use the status service to generate status info showing all supported plugins
let status_service = crate::services::status_service::StatusService::new();
let status_info = status_service.generate_supported_status(
state.data_dir.clone(),
db_path.into(),
);
let response = ApiResponse {
success: true,
data: Some(status_info),
error: None,
};
Ok(Json(response))
}