use crate::{ApiResponse, error::ApiError}; use actix_web::{HttpResponse, Result, web}; use service::AppService; use session::Session; #[utoipa::path( get, path = "/api/projects/{project_name}/join-settings", params(("project_name" = String, Path)), responses( (status = 200, description = "Get join settings", body = ApiResponse), (status = 401, description = "Unauthorized"), (status = 404, description = "Not found"), ), tag = "Project" )] pub async fn project_join_settings( service: web::Data, session: Session, path: web::Path, ) -> Result { let project_name = path.into_inner(); let resp = service .project_get_join_settings(project_name, &session) .await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( patch, path = "/api/projects/{project_name}/join-settings", params(("project_name" = String, Path)), request_body = service::project::join_settings::UpdateJoinSettingsRequest, responses( (status = 200, description = "Update join settings", body = ApiResponse), (status = 401, description = "Unauthorized"), (status = 403, description = "Forbidden"), (status = 404, description = "Not found"), ), tag = "Project" )] pub async fn project_update_join_settings( service: web::Data, session: Session, path: web::Path, body: web::Json, ) -> Result { let project_name = path.into_inner(); let resp = service .project_update_join_settings(project_name, body.into_inner(), &session) .await?; Ok(ApiResponse::ok(resp).to_response()) }