Skip to content
Clone
main
31 lines 1.1 KB Rust
use ::session::AuthedUser;
use api::http::{Query, State};
use api::rest::{AppResponseData, NoData};
use crate::errors::ApiError;
use crate::services::notifications::RecentMentionDto;
use crate::services::profile::ListLimitQuery;
use crate::services::service::UserService;
#[utoipa::path(
get,
path = "/me/recent-mentions",
tag = "user",
description = "返回最近提及当前用户的消息引用。",
params(
ListLimitQuery,
),
responses(
(status = 200, description = "recent mentions", body = AppResponseData<Vec<RecentMentionDto>>),
(status = 404, description = "resource not found", body = AppResponseData<NoData>),
(status = 401, description = "authentication required", body = AppResponseData<NoData>)
)
)]
pub async fn recent_mentions(
State(service): State<UserService>,
AuthedUser(uid): AuthedUser,
Query(query): Query<ListLimitQuery>,
) -> Result<AppResponseData<Vec<RecentMentionDto>>, ApiError> {
let mentions = service.recent_mentions(uid, query.limit).await?;
Ok(AppResponseData::ok(mentions))
}