treewide: fix various UI bugs; optimize crypto dependencies & format
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
This commit is contained in:
parent
764aafa88d
commit
3ccddce7fd
178 changed files with 58285 additions and 54241 deletions
|
|
@ -1,34 +1,31 @@
|
|||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use axum::{Json, extract::State};
|
||||
|
||||
use crate::dto::DatabaseStatsResponse;
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
use crate::{dto::DatabaseStatsResponse, error::ApiError, state::AppState};
|
||||
|
||||
pub async fn database_stats(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<DatabaseStatsResponse>, ApiError> {
|
||||
let stats = state.storage.database_stats().await?;
|
||||
Ok(Json(DatabaseStatsResponse {
|
||||
media_count: stats.media_count,
|
||||
tag_count: stats.tag_count,
|
||||
collection_count: stats.collection_count,
|
||||
audit_count: stats.audit_count,
|
||||
database_size_bytes: stats.database_size_bytes,
|
||||
backend_name: stats.backend_name,
|
||||
}))
|
||||
let stats = state.storage.database_stats().await?;
|
||||
Ok(Json(DatabaseStatsResponse {
|
||||
media_count: stats.media_count,
|
||||
tag_count: stats.tag_count,
|
||||
collection_count: stats.collection_count,
|
||||
audit_count: stats.audit_count,
|
||||
database_size_bytes: stats.database_size_bytes,
|
||||
backend_name: stats.backend_name,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn vacuum_database(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
state.storage.vacuum().await?;
|
||||
Ok(Json(serde_json::json!({"status": "ok"})))
|
||||
state.storage.vacuum().await?;
|
||||
Ok(Json(serde_json::json!({"status": "ok"})))
|
||||
}
|
||||
|
||||
pub async fn clear_database(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
state.storage.clear_all_data().await?;
|
||||
Ok(Json(serde_json::json!({"status": "ok"})))
|
||||
state.storage.clear_all_data().await?;
|
||||
Ok(Json(serde_json::json!({"status": "ok"})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue