use actix_web::{HttpResponse, web}; use serde::Deserialize; use utoipa::IntoParams; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::service::AppService; use crate::service::repo::git::merge::CherryPickParams; use crate::session::Session; #[derive(Debug, Deserialize, IntoParams)] pub struct PathParams { pub workspace_name: String, pub repo_name: String, } /// Cherry-pick a commit #[utoipa::path( post, path = "/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/cherry-pick", tag = "Git", operation_id = "gitCherryPick", params(PathParams), request_body( content = CherryPickParams, description = "Cherry-pick parameters", content_type = "application/json" ), responses( (status = 200, description = "Cherry-pick completed successfully", body = ApiResponse), (status = 401, description = "Unauthorized", body = ApiErrorResponse), (status = 409, description = "Cherry-pick conflict", body = ApiErrorResponse), (status = 500, description = "Internal server error", body = ApiErrorResponse), ), security(("session_cookie" = [])) )] pub async fn git_cherry_pick( service: web::Data, session: Session, path: web::Path, params: web::Json, ) -> Result { let result = service .repo .git_cherry_pick( &session, &path.workspace_name, &path.repo_name, params.into_inner(), ) .await?; Ok(HttpResponse::Ok().json(ApiResponse::new(result))) }