chore: update book enabled status wiring

This commit is contained in:
2026-04-27 11:41:35 +08:00
parent 93bde0a6b6
commit 67c33d06be
25 changed files with 336 additions and 122 deletions

View File

@@ -30,7 +30,7 @@
| 字段 | 类型 | 必填 | 规则 | 说明 |
|:---|:---|:---:|:---|:---|
| name | string | 是 | 非空,最大 `128` 字符,唯一 | 作者名称 |
| authorStatus | string | 否 | `common_enabled_status``enabled`/`disabled`;默认 `enabled` | 作者启用状态 |
| isEnabled | bool | 否 | 默认 `true` | 作者是否启用 |
| intro | string | 否 | 可为空 | 作者简介 |
| coverUrl | string | 否 | 可为空,最大 `500` 字符 | 作者头像或封面 URL |
@@ -42,7 +42,7 @@
- 创建请求禁止传服务端生成字段:`id/createdAt/updatedAt`
- `name` 必须唯一,对应唯一索引 `uk_book_author_name`
- `authorStatus` 为空时按数据库默认值 `enabled` 落库;传值时必须符合 `common_enabled_status`
- `isEnabled` 未传时按数据库默认值 `true` 落库
### 删除书籍作者
@@ -104,7 +104,7 @@
|:---|:---|:---:|:---|:---|
| id | uint | 是 | `> 0` | 作者 ID |
| name | string | 是 | 非空,最大 `128` 字符,唯一 | 作者名称 |
| authorStatus | string | 否 | `common_enabled_status``enabled`/`disabled` | 作者启用状态 |
| isEnabled | bool | 否 | `true/false` | 作者是否启用 |
| intro | string | 否 | 可为空 | 作者简介 |
| coverUrl | string | 否 | 可为空,最大 `500` 字符 | 作者头像或封面 URL |
@@ -117,7 +117,6 @@
- 更新请求禁止传服务端维护字段:`createdAt/updatedAt`
- 更新为实体全量保存,前端应传完整可编辑实体,避免字段被零值覆盖。
- `name` 必须唯一,对应唯一索引 `uk_book_author_name`
- `authorStatus` 为空时会按空值保存;传值时必须符合 `common_enabled_status`
### 查询书籍作者详情
@@ -142,7 +141,7 @@
| bookAuthor.createdAt | time | 创建时间 |
| bookAuthor.updatedAt | time | 更新时间 |
| bookAuthor.name | string | 作者名称 |
| bookAuthor.authorStatus | string | 作者启用状态,见 `common_enabled_status` |
| bookAuthor.isEnabled | bool | 作者是否启用 |
| bookAuthor.intro | string | 作者简介 |
| bookAuthor.coverUrl | string | 作者头像或封面 URL |
@@ -162,7 +161,7 @@
| pageSize | int | 否 | 默认 `10`,最大 `100` | 每页数量 |
| keyword | string | 否 | 模糊匹配 `name` | 通用关键字 |
| name | string | 否 | 模糊匹配 `name` | 作者名称 |
| authorStatus | string | 否 | `common_enabled_status``enabled`/`disabled` | 作者启用状态 |
| isEnabled | bool | 否 | `true/false` | 作者是否启用 |
#### Response `response.PageResult`
@@ -173,7 +172,7 @@
| list[].createdAt | time | 创建时间 |
| list[].updatedAt | time | 更新时间 |
| list[].name | string | 作者名称 |
| list[].authorStatus | string | 作者启用状态,见 `common_enabled_status` |
| list[].isEnabled | bool | 作者是否启用 |
| list[].intro | string | 作者简介 |
| list[].coverUrl | string | 作者头像或封面 URL |
| list[].authorName | string | 作者名称展示字段,来源于 `book_author.name AS author_name` |
@@ -190,5 +189,5 @@
- admin 端书籍作者 CRUD 挂载到 `PrivateGroup`,需要 `JWT + Casbin`
- 写操作挂载 `middleware.OperationRecord()`;读操作不挂操作审计。
- `authorStatus` 固定值域来自 `common_enabled_status``enabled``disabled`
- “是否启用”统一使用 `isEnabled` 布尔字段:`true` 表示启用,`false` 表示禁用
- 表结构、字段长度、唯一约束和索引以 `.ai-specs/doc-sql/book_author.sql` 为准。