use ::session::Session; use export::http::{Json, Path, State}; use export::rest::AppResponseData; use crate::errors::{ApiError, GitApiError}; use crate::handler::{RepoPath, ensure_caller}; use crate::service::GitService; use crate::service::repos::{RepoDto, UpdateRepoCmd}; #[utoipa::path( patch, path = "/repos/{space_name}/{repo_name}", tag = "repos", description = "更新仓库描述、主页、可见性、LFS 和默认分支;仅空间所有者可操作。", params(RepoPath), request_body = UpdateRepoCmd, responses( (status = 200, description = "update repo", body = AppResponseData) ) )] pub async fn update_repo( State(service): State, session: Session, Path(path): Path, Json(cmd): Json, ) -> Result, ApiError> { let caller = ensure_caller(&session)?; let out = service .update_repo(path.space_name, path.repo_name, caller, cmd) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }