use ::session::Session; use export::http::{Path, State}; use export::rest::AppResponseData; use crate::errors::{ApiError, GitApiError}; use crate::handler::{RepoPath, resolve_reader}; use crate::service::GitService; use crate::service::packs::PackStatsDto; #[utoipa::path( get, path = "/repos/{space_name}/{repo_name}/packs/stats", tag = "packs", description = "返回仓库松散对象数量与体积统计。", params(RepoPath), responses( (status = 200, description = "pack statistics", body = AppResponseData) ) )] pub async fn stats( State(service): State, session: Session, Path(path): Path, ) -> Result, ApiError> { resolve_reader( &service, &session, path.space_name.clone(), path.repo_name.clone(), ) .await?; let out = service .pack_stats(path.space_name, path.repo_name) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }