use ::session::AuthedUser; use api::http::{Json, Path, State}; use api::rest::AppResponseData; use crate::errors::{ApiError, GitApiError}; use crate::handler::RepoPath; 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, AuthedUser(uid): AuthedUser, Path(path): Path, Json(cmd): Json, ) -> Result, ApiError> { let caller = uid; let ctx = service .context(path.space_name, path.repo_name) .await .map_err(GitApiError::from)?; let out = service .update_repo(&ctx, caller, cmd) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }