use axum::extract::{Json, Path, State}; use export::rest::{AppResponseData, NoData}; use jwt::Session; use crate::errors::ApiError; use crate::services::dir::{DirNodeDto, DirPath, UpdateDirCmd}; use crate::services::service::SpaceService; use jwt::share::session::require_uid; #[utoipa::path( patch, path = "/spaces/{space_name}/dir/{dir_id}", tag = "space", description = "重命名空间目录节点。", params(DirPath), request_body = UpdateDirCmd, responses( (status = 200, description = "dir node updated", body = AppResponseData), (status = 400, description = "bad request", body = AppResponseData), (status = 403, description = "forbidden", body = AppResponseData), (status = 404, description = "dir node not found", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn update_dir_node( State(service): State, session: Session, Path(path): Path, Json(cmd): Json, ) -> Result, ApiError> { let uid = require_uid(&session)?; let node = service .update_dir_node(uid, &path.space_name, path.dir_id, cmd) .await?; Ok(AppResponseData::ok(node)) }