feat(admin): 分区增删、资料设置、操作条与交互收尾
- POST/DELETE /api/categories(需登录,级联,local 保护) - profile 设置(头像/名称/角色/简介/位置)应用到资料卡 - 详情操作条:浏览 +1、点赞切换、分享复制、跳转外链 - 编辑按钮垂直居中且留 12px;设置页按钮上间距、保存 Toast、Tabs 去滚动条 - 登录密码可见切换 - 测试 48 passed
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
//! 启动时会重新建表并灌入内嵌种子。
|
||||
|
||||
pub mod auth;
|
||||
pub mod categories;
|
||||
mod catalog;
|
||||
pub mod entries;
|
||||
mod schema;
|
||||
@@ -193,6 +194,28 @@ impl Db {
|
||||
let mut conn = self.lock()?;
|
||||
entries::update(&mut conn, key, patch, expected_updated_at)
|
||||
}
|
||||
|
||||
pub fn bump_view(&self, key: &str) -> Result<(i64, i64), StashError> {
|
||||
let conn = self.lock()?;
|
||||
entries::bump_view(&conn, key)
|
||||
}
|
||||
|
||||
pub fn set_like(&self, key: &str, liked: bool) -> Result<(i64, i64), StashError> {
|
||||
let conn = self.lock()?;
|
||||
entries::set_like(&conn, key, liked)
|
||||
}
|
||||
|
||||
// ---------- 分区(首页卡片 / 侧栏项) ----------
|
||||
|
||||
pub fn create_category(&self, new: categories::NewCategory) -> Result<(), StashError> {
|
||||
let mut conn = self.lock()?;
|
||||
categories::create(&mut conn, new)
|
||||
}
|
||||
|
||||
pub fn remove_category(&self, id: &str) -> Result<(), StashError> {
|
||||
let mut conn = self.lock()?;
|
||||
categories::remove(&mut conn, id)
|
||||
}
|
||||
}
|
||||
|
||||
/// 把 rusqlite 的错误统一收敛成 `StashError::Database`。
|
||||
|
||||
Reference in New Issue
Block a user