use export::http::{Path, State}; use export::rest::AppResponseData; use token::Session; use crate::errors::{ApiError, GitApiError}; use crate::handler::{RepoPath, require_writer}; use crate::service::GitService; use crate::service::archives::ArchiveResultDto; #[utoipa::path( post, path = "/repos/{space_name}/{repo_name}/archives/bundle", tag = "archives", description = "将仓库全部引用打包为 Git bundle 并上传存储。", params(RepoPath), responses( (status = 200, description = "create git bundle", body = AppResponseData) ) )] pub async fn create_bundle( State(service): State, session: Session, Path(path): Path, ) -> Result, ApiError> { require_writer( &service, &session, path.space_name.clone(), path.repo_name.clone(), ) .await?; let out = service .archive_create_bundle(path.space_name, path.repo_name) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }