use api::http::{Json, State}; use ::session::AuthedUser; use api::rest::{AppResponseData, NoData}; use crate::AuthService; use crate::errors::ApiError; use crate::services::profile::UpdateProfileCmd; #[utoipa::path( patch, path = "/me", tag = "account", description = "增量更新当前用户的显示资料、时区语言、可见性和资料开关。", request_body = UpdateProfileCmd, responses( (status = 200, description = "profile fields updated", body = AppResponseData), (status = 400, description = "request failed validation", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn update_profile( State(service): State, AuthedUser(uid): AuthedUser, Json(cmd): Json, ) -> Result, ApiError> { service .update_profile(uid, cmd) .await .map_err(ApiError::from)?; Ok(AppResponseData::empty()) }