use export::http::{Path, State}; use export::rest::{AppResponseData, NoData}; use jwt::Session; use crate::errors::{ApiError, GitApiError}; use crate::handler::{RepoPath, require_writer}; use crate::service::GitService; #[utoipa::path( post, path = "/repos/{space_name}/{repo_name}/packs/repack", tag = "packs", description = "对仓库执行全量重打包并删除冗余 pack。", params(RepoPath), responses( (status = 200, description = "repack repository", body = AppResponseData) ) )] pub async fn repack( State(service): State, session: Session, Path(path): Path, ) -> Result, ApiError> { require_writer( &service, &session, path.space_name.clone(), path.repo_name.clone(), ) .await?; service .pack_repack(path.space_name, path.repo_name) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(NoData)) }