Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
10 lines
348 B
Rust
10 lines
348 B
Rust
use axum::{Json, extract::State};
|
|
|
|
use crate::{dto::LibraryStatisticsResponse, error::ApiError, state::AppState};
|
|
|
|
pub async fn library_statistics(
|
|
State(state): State<AppState>,
|
|
) -> Result<Json<LibraryStatisticsResponse>, ApiError> {
|
|
let stats = state.storage.library_statistics().await?;
|
|
Ok(Json(LibraryStatisticsResponse::from(stats)))
|
|
}
|