use ::session::AuthedUser; use api::http::State; use api::rest::{AppResponseData, NoData}; use crate::AuthService; use crate::errors::ApiError; use crate::services::preferences::UserPreferencesDto; #[utoipa::path( get, path = "/me/preferences", tag = "account", description = "读取当前用户的通知与界面偏好,未配置时返回默认值。", responses( (status = 200, description = "preferences for the current user, defaults when unset", body = AppResponseData), (status = 404, description = "resource not found", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn get_preferences( State(service): State, AuthedUser(uid): AuthedUser, ) -> Result, ApiError> { let resp = service.preferences(uid).await.map_err(ApiError::from)?; Ok(AppResponseData::ok(resp)) }