refactor(db): 删除旧分区展示块与兼容字段

- v23 迁移删除 section_block 表,以及 node 的 view_mode / empty_text / show_in_sidebar / allow_groups
- 重建 node 表并保留 44 条内容、15 个分组、5 张卡片,外键检查通过
- 种子库直接生成 card / card_group,不再依赖 section_block
- 删除旧 /api/catalog、/api/categories、/api/groups/{id} 与 categories 模块
- 分组接口不再接收/返回 format,前端 GroupNode 同步移除
- README/HANDOFF 更新到 v23;管理页提示改为『格式由每条内容决定』
This commit is contained in:
2026-11-02 20:24:08 +08:00
parent 4621f8cb22
commit 27e411fd2c
10 changed files with 213 additions and 1652 deletions
+3 -3
View File
@@ -67,7 +67,7 @@ import type { Project } from '../../api'
/**
* 新版后台:原子模型。
*
* - 分组是唯一容器(可多层、带格式);
* - 分组是唯一容器(可多层);
* - 内容是条目,挂在分组上;
* - 侧边栏、首页卡片都只是「勾选分组」的展示组合。
*/
@@ -575,7 +575,7 @@ function GroupsPanel({
return (
<Space direction="column" gap="md" align="stretch" className="admin-form">
<Text size="sm" tone="muted">
说明:分组用于控制前台侧边栏与卡片;可多层嵌套,根分组决定格式。内容(条目)只挂在分组上。
说明:分组用于控制前台侧边栏与卡片,可多层嵌套。内容(条目)只挂在分组上,格式由每条内容自己决定。
</Text>
<div className="group-toolbar">
@@ -593,7 +593,7 @@ function GroupsPanel({
columns={[
{ key: 'name', title: '分组名称' },
{ key: 'sort', title: '排序权重', width: 110 },
{ key: 'count', title: '关联网页数', width: 120 },
{ key: 'count', title: '关联内容数', width: 120 },
{ key: 'status', title: '状态', width: 90 },
{ key: 'actions', title: '操作', width: 260, align: 'right' },
]}
+1 -3
View File
@@ -19,7 +19,6 @@ export type GroupNode = {
key: string
parentKey?: string | null
title: string
format: GroupFormat
icon: string
barColor: string
previewLimit?: number | null
@@ -189,13 +188,12 @@ export async function setCardGroups(
export function flattenGroups(
groups: GroupNode[],
depth = 0,
): { key: string; title: string; depth: number; format: GroupFormat; enabled: boolean }[] {
): { key: string; title: string; depth: number; enabled: boolean }[] {
return groups.flatMap((group) => [
{
key: group.key,
title: group.title,
depth,
format: group.format,
enabled: group.enabled !== false,
},
...flattenGroups(group.children, depth + 1),