use ::session::AuthedUser; 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::service::SpaceService; #[derive(Debug, Clone, Deserialize, IntoParams, ToSchema)] pub struct MemberGroupPath { pub space_name: String, pub user_id: i64, pub group_id: Uuid, } #[utoipa::path( delete, path = "/spaces/{space_name}/members/{user_id}/groups/{group_id}", tag = "space", description = "管理员移除成员的群组分配,未分配时幂等成功。", params(MemberGroupPath), responses( (status = 200, description = "group unassigned", body = AppResponseData), (status = 403, description = "forbidden", body = AppResponseData), (status = 404, description = "not found", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn unassign_group( State(service): State, AuthedUser(caller): AuthedUser, Path(path): Path, ) -> Result, ApiError> { service .unassign_group(caller, &path.space_name, path.user_id, path.group_id) .await?; Ok(AppResponseData::empty()) }