use ::session::OptionalUser; use api::http::{Path, State}; use api::rest::{AppResponseData, NoData}; use serde::Deserialize; use utoipa::{IntoParams, ToSchema}; use uuid::Uuid; use crate::errors::ApiError; use crate::services::groups::GroupDto; use crate::services::service::SpaceService; #[derive(Debug, Clone, Deserialize, IntoParams, ToSchema)] pub struct GroupPath { pub space_name: String, pub group_id: Uuid, } #[utoipa::path( get, path = "/spaces/{space_name}/groups/{group_id}", tag = "space", description = "读取群组详情,并按空间可见性规则控制访问。", params(GroupPath), responses( (status = 200, description = "get group", body = AppResponseData), (status = 404, description = "group not found", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn get_group( State(service): State, OptionalUser(caller): OptionalUser, Path(path): Path, ) -> Result, ApiError> { let group = service .get_group(caller, &path.space_name, path.group_id) .await?; Ok(AppResponseData::ok(group)) }