use crate::{ApiResponse, error::ApiError}; use actix_web::{HttpResponse, Result, web}; use service::AppService; use session::Session; #[utoipa::path( get, path = "/api/workspaces/me", responses( (status = 200, description = "List my workspaces", body = ApiResponse), (status = 401, description = "Unauthorized"), ), tag = "Workspace" )] pub async fn workspace_list( service: web::Data, session: Session, ) -> Result { let resp = service.workspace_list(&session).await?; Ok(ApiResponse::ok(resp).to_response()) } #[utoipa::path( get, path = "/api/workspaces/{slug}", params(("slug" = String, Path)), responses( (status = 200, description = "Get workspace info", body = ApiResponse), (status = 401, description = "Unauthorized"), (status = 404, description = "Workspace not found"), ), tag = "Workspace" )] pub async fn workspace_info( service: web::Data, session: Session, path: web::Path, ) -> Result { let slug = path.into_inner(); let resp = service.workspace_info(&session, slug).await?; Ok(ApiResponse::ok(resp).to_response()) }