use crate::{ApiResponse, error::ApiError}; use actix_web::{HttpResponse, Result, web}; use service::AppService; use service::git::commit::{ CommitAmendRequest, CommitAncestorsQuery, CommitCherryPickAbortRequest, CommitCherryPickRequest, CommitCreateRequest, CommitCreateResponse, CommitDescendantsQuery, CommitGetQuery, CommitGraphReactResponse, CommitLogQuery, CommitLogResponse, CommitResolveQuery, CommitRevertAbortRequest, CommitRevertRequest, CommitWalkQuery, }; use session::Session; #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit metadata", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_get( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_get(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/exists", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Check if commit exists", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_exists( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_exists(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/is-commit", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Check if object is a commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_is_commit( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_is_commit(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/message", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit message", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_message( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_message(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/summary", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit summary", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_summary( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_summary(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/short-id", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit short ID", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_short_id( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_short_id(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/author", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit author", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_author( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_author(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/tree-id", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit tree ID", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_tree_id( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_tree_id(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/parent-count", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit parent count", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_parent_count( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_parent_count(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/parent-ids", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit parent IDs", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_parent_ids( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_parent_ids(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/parent/{index}", params( ("namespace" = String, Path), ("repo" = String, Path), ("index" = usize, Path), ), responses( (status = 200, description = "Get commit parent", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_parent( service: web::Data, session: Session, path: web::Path<(String, String, String, usize)>, ) -> Result { let (namespace, repo_name, oid, index) = path.into_inner(); let resp = service .git_commit_parent(namespace, repo_name, oid, index, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/first-parent", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit first parent", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_first_parent( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_first_parent(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/is-merge", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Check if commit is a merge", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_is_merge( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_is_merge(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits", params( ("namespace" = String, Path), ("repo" = String, Path), ("rev" = Option, Query), ("per_page" = Option, Query), ("page" = Option, Query), ), responses( (status = 200, description = "Get commit log (paginated)", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_log( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_log(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/count", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit count", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_count( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_count( namespace, repo_name, query.from.clone(), query.to.clone(), &session, ) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/refs", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit refs", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_refs( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_refs(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/branches", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit branches", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_branches( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_branches(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/tags", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit tags", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_tags( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_tags(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/is-tip", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Check if commit is a tip", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_is_tip( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_is_tip(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/ref-count", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit ref count", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_ref_count( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_ref_count(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/reflog", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit reflog", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_reflog( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, refname: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_reflog( namespace, repo_name, query.into_inner(), refname.refname.clone(), &session, ) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/graph", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit graph", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_graph( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_graph(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } /// Returns commit graph data enriched with full commit metadata (author, timestamp, /// parents, lane_index) for use with @gitgraph/react on the frontend. #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/graph-react", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit graph for gitgraph-react", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_graph_react( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_graph_react(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/walk", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Walk commits", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_walk( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_walk(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/ancestors", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit ancestors", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_ancestors( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_ancestors(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/descendants", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Get commit descendants", body = ApiResponse>), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_descendants( service: web::Data, session: Session, path: web::Path<(String, String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name, oid) = path.into_inner(); let mut req = query.into_inner(); req.oid = oid; let resp = service .git_commit_descendants(namespace, repo_name, req, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/repos/{namespace}/{repo}/git/commits/resolve", params( ("namespace" = String, Path), ("repo" = String, Path), ), responses( (status = 200, description = "Resolve revision to commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_resolve_rev( service: web::Data, session: Session, path: web::Path<(String, String)>, query: web::Query, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_resolve_rev(namespace, repo_name, query.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( post, path = "/api/repos/{namespace}/{repo}/git/commits", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitCreateRequest, responses( (status = 200, description = "Create commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_create( service: web::Data, session: Session, path: web::Path<(String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name) = path.into_inner(); let resp = service .git_commit_create(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( patch, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/amend", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitAmendRequest, responses( (status = 200, description = "Amend commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_amend( service: web::Data, session: Session, path: web::Path<(String, String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name, _oid) = path.into_inner(); let resp = service .git_commit_amend(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( post, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/cherry-pick", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitCherryPickRequest, responses( (status = 200, description = "Cherry-pick commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_cherry_pick( service: web::Data, session: Session, path: web::Path<(String, String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name, _oid) = path.into_inner(); let resp = service .git_commit_cherry_pick(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( post, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/cherry-pick/abort", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitCherryPickAbortRequest, responses( (status = 200, description = "Abort cherry-pick", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_cherry_pick_abort( service: web::Data, session: Session, path: web::Path<(String, String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name, _oid) = path.into_inner(); service .git_commit_cherry_pick_abort(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(true).to_response()) } #[utoipa::path( post, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/revert", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitRevertRequest, responses( (status = 200, description = "Revert commit", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_revert( service: web::Data, session: Session, path: web::Path<(String, String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name, _oid) = path.into_inner(); let resp = service .git_commit_revert(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( post, path = "/api/repos/{namespace}/{repo}/git/commits/{oid}/revert/abort", params( ("namespace" = String, Path), ("repo" = String, Path), ), request_body = CommitRevertAbortRequest, responses( (status = 200, description = "Abort revert", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiResponse), (status = 404, description = "Not found", body = ApiResponse), ), tag = "Git" )] pub async fn git_commit_revert_abort( service: web::Data, session: Session, path: web::Path<(String, String, String)>, body: web::Json, ) -> Result { let (namespace, repo_name, _oid) = path.into_inner(); service .git_commit_revert_abort(namespace, repo_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(true).to_response()) } // Query helpers #[derive(serde::Deserialize, utoipa::IntoParams)] pub struct CommitCountQuery { pub from: Option, pub to: Option, } #[derive(serde::Deserialize, utoipa::IntoParams)] pub struct CommitReflogQuery { pub refname: Option, }