Skip to main content

yggdrasil/api/posts/
mod.rs

1//! 文章模块:提供文章的 CRUD、列表、搜索、标签聚合与统计等 server function。
2//!
3//! 所有 Dioxus server function 均注册在 `/api` 路径下,供前端与服务端调用。
4//! 仅在 `feature = "server"` 启用的服务端构建中执行数据库操作与缓存失效。
5
6#![allow(clippy::unused_unit, deprecated, unused_imports)]
7
8mod create;
9mod delete;
10pub(crate) mod helpers;
11mod list;
12mod read;
13mod rebuild;
14mod search;
15mod stats;
16mod tags;
17mod trash;
18mod types;
19mod update;
20
21/// 创建新文章。
22pub use create::create_post;
23/// 删除指定文章。
24pub use delete::delete_post;
25/// 获取回收站中已软删除的文章列表。
26pub use list::list_deleted_posts;
27/// 获取管理员视角的全部文章分页列表。
28pub use list::list_posts;
29/// 获取已发布文章分页列表。
30pub use list::{get_posts_by_tag, list_published_posts};
31/// 根据 id 获取文章详情。
32pub use read::{get_post_by_id, get_post_by_slug};
33/// 重新渲染文章的 Markdown HTML 与目录。
34pub use rebuild::rebuild_content_html;
35/// 重新渲染指定文章的 Markdown HTML 与目录(单篇)。
36pub use rebuild::rebuild_post_content_html;
37/// 全文搜索已发布文章。
38pub use search::search_posts;
39/// 获取文章统计信息。
40pub use stats::get_post_stats;
41/// 获取全部标签及其文章数量。
42pub use tags::list_tags;
43/// 恢复已删除文章。
44pub use trash::{batch_purge_posts, batch_restore_posts, empty_trash, purge_post, restore_post};
45/// 文章 API 的请求与响应数据结构。
46pub use types::*;
47/// 更新指定文章。
48pub use update::update_post;