Skip to main content

yggdrasil/api/comments/
mod.rs

1//! 评论模块:提供评论的 CRUD、Markdown 渲染、审核状态流转与分页查询。
2//!
3//! 所有 Leptos server function 均注册在 `/api` 路径下,供前端与服务端调用。
4//! 仅在 `feature = "server"` 启用的服务端构建中执行数据库操作与缓存失效。
5
6#![allow(clippy::unused_unit, deprecated, unused_imports)]
7
8mod check;
9mod create;
10mod helpers;
11mod list;
12mod markdown;
13mod read;
14mod types;
15mod update;
16
17/// 查询一组评论的当前审核状态。
18pub use check::check_pending_status;
19/// 创建一条新评论。
20pub use create::create_comment;
21/// 获取全部评论分页列表。
22pub use list::get_all_comments;
23/// 后台评论分页列表(不鉴权,供 web 与 MCP 入口共用)。
24#[cfg(feature = "server")]
25pub(crate) use list::list_admin_comments_impl;
26/// 获取指定文章的已审核评论列表。
27pub use read::get_comments;
28/// 评论 API 的请求与响应数据结构。
29pub use types::*;
30/// 通过指定评论。
31pub use update::approve_comment;
32/// 批量更新评论状态。
33pub use update::batch_update_comment_status;
34/// 从回收站恢复评论(回到待审)。
35pub use update::restore_comments;
36/// 将指定评论标记为垃圾评论。
37pub use update::spam_comment;
38/// 将指定评论移入回收站。
39pub use update::trash_comment;
40/// 评论审核通过/垃圾/回收站(不鉴权,供 web 与 MCP 入口共用)。
41#[cfg(feature = "server")]
42pub(crate) use update::{approve_comment_impl, spam_comment_impl, trash_comment_impl};