use ::session::AuthedUser; use api::http::{Path, State}; use api::rest::{AppResponseData, NoData}; use crate::AuthService; use crate::errors::ApiError; use crate::share::account::types::UserPublic; #[utoipa::path( get, path = "/users/{user_id}", tag = "users", description = "按用户 ID 返回公开身份资料,并按账号状态与可见性过滤。", params( ("user_id" = i64, Path, description = "user id") ), responses( (status = 200, description = "public user identity", body = AppResponseData), (status = 401, description = "authentication required", body = AppResponseData) ) )] pub async fn get_user( State(service): State, AuthedUser(caller): AuthedUser, Path(user_id): Path, ) -> Result, ApiError> { let user = service .public_user(caller, user_id) .await .map_err(ApiError::from)?; Ok(AppResponseData::ok(user)) }