use crate::{ApiResponse, error::ApiError}; use actix_web::{HttpResponse, Result, web}; use service::AppService; use session::Session; #[utoipa::path( patch, path = "/api/projects/{project_name}/settings/name", params(("project_name" = String, Path)), request_body = service::project::settings::ExchangeProjectName, responses( (status = 200, description = "Update project name"), (status = 401, description = "Unauthorized"), (status = 403, description = "Forbidden"), (status = 404, description = "Not found"), ), tag = "Project" )] pub async fn project_exchange_name( service: web::Data, session: Session, path: web::Path, body: web::Json, ) -> Result { let project_name = path.into_inner(); service .project_exchange_name(&session, project_name, body.into_inner()) .await?; Ok(ApiResponse::ok(serde_json::json!({ "success": true })).to_response()) } #[utoipa::path( patch, path = "/api/projects/{project_name}/settings/visibility", params(("project_name" = String, Path)), request_body = service::project::settings::ExchangeProjectVisibility, responses( (status = 200, description = "Update project visibility"), (status = 401, description = "Unauthorized"), (status = 403, description = "Forbidden"), (status = 404, description = "Not found"), ), tag = "Project" )] pub async fn project_exchange_visibility( service: web::Data, session: Session, path: web::Path, body: web::Json, ) -> Result { let project_name = path.into_inner(); service .project_exchange_visibility(&session, project_name, body.into_inner()) .await?; Ok(ApiResponse::ok(serde_json::json!({ "success": true })).to_response()) } #[utoipa::path( patch, path = "/api/projects/{project_name}/settings/title", params(("project_name" = String, Path)), request_body = service::project::settings::ExchangeProjectTitle, responses( (status = 200, description = "Update project title"), (status = 401, description = "Unauthorized"), (status = 403, description = "Forbidden"), (status = 404, description = "Not found"), ), tag = "Project" )] pub async fn project_exchange_title( service: web::Data, session: Session, path: web::Path, body: web::Json, ) -> Result { let project_name = path.into_inner(); service .project_exchange_title(&session, project_name, body.into_inner()) .await?; Ok(ApiResponse::ok(serde_json::json!({ "success": true })).to_response()) }