use ::session::AuthedUser; use api::http::{Json, Path, State}; use api::rest::{AppResponseData, NoData}; use crate::errors::ApiError; use crate::handlers::get_group::GroupPath; use crate::services::groups::{GroupDto, UpdateGroupCmd}; use crate::services::service::SpaceService; #[utoipa::path( patch, path = "/spaces/{space_name}/groups/{group_id}", tag = "space", description = "更新群组名称、图标、排序或整体权限集合。", params(GroupPath), request_body = UpdateGroupCmd, responses( (status = 200, description = "group updated", body = AppResponseData), (status = 400, description = "bad request", body = AppResponseData), (status = 403, description = "forbidden", body = AppResponseData), (status = 404, description = "not found", body = AppResponseData), (status = 409, description = "group name conflict", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn update_group( State(service): State, AuthedUser(uid): AuthedUser, Path(path): Path, Json(cmd): Json, ) -> Result, ApiError> { let group = service .update_group(uid, &path.space_name, path.group_id, cmd) .await?; Ok(AppResponseData::ok(group)) }