feat: add book admin display fields
This commit is contained in:
@@ -131,7 +131,9 @@
|
||||
| bookAuthorRelation | object | 关系实体 |
|
||||
| bookAuthorRelation.id | uint | 关系 ID |
|
||||
| bookAuthorRelation.bookId | uint | 书籍 ID |
|
||||
| bookAuthorRelation.bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| bookAuthorRelation.authorId | uint | 作者 ID |
|
||||
| bookAuthorRelation.authorName | string | 作者名称展示字段,来源于 `book_author.name AS author_name` |
|
||||
| bookAuthorRelation.authorSort | int | 作者展示顺序 |
|
||||
| bookAuthorRelation.createdAt | string | 创建时间 |
|
||||
| bookAuthorRelation.updatedAt | string | 更新时间 |
|
||||
@@ -160,9 +162,10 @@
|
||||
| list | array | `bookRes.BookAuthorRelationListItem` 列表 |
|
||||
| list[].id | uint | 关系 ID |
|
||||
| list[].bookId | uint | 书籍 ID |
|
||||
| list[].bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| list[].authorId | uint | 作者 ID |
|
||||
| list[].authorSort | int | 作者展示顺序 |
|
||||
| list[].authorName | string | 作者名称展示字段 |
|
||||
| list[].authorName | string | 作者名称展示字段,来源于 `book_author.name AS author_name` |
|
||||
| total | int64 | 总数 |
|
||||
| page | int | 当前页 |
|
||||
| pageSize | int | 每页数量 |
|
||||
@@ -170,6 +173,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`bookId asc, authorSort asc, id desc`。
|
||||
- 列表通过 `book_author_relation` 联表 `book`、`book_author` 补充 `bookTitle/authorName` 展示字段;写接口仍只接收 `bookId/authorId/authorSort`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -177,4 +181,5 @@
|
||||
- `bookId + authorId` 唯一,对应数据库唯一索引 `uk_book_author_relation_book_id_author_id`。
|
||||
- `authorSort` 必须大于 `0`。
|
||||
- 创建时 `authorSort` 未传或为 `0` 时默认 `1`。
|
||||
- `bookTitle/authorName` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
- 删除策略为硬删。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 实体模型:`book.BookChapter`
|
||||
- 搜索入参:`bookReq.BookChapterSearch`
|
||||
- 详情响应:`bookRes.BookChapterResponse`
|
||||
- 列表项:`book.BookChapter`
|
||||
- 列表项:`bookRes.BookChapterListItem`
|
||||
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
|
||||
- 删除策略:硬删
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
| bookChapter.createdAt | string | 创建时间 |
|
||||
| bookChapter.updatedAt | string | 更新时间 |
|
||||
| bookChapter.bookId | uint | 所属书籍 ID |
|
||||
| bookChapter.bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| bookChapter.title | string | 章节标题 |
|
||||
| bookChapter.chapterNo | int | 同书内章节顺序编号 |
|
||||
| bookChapter.isReadable | bool | 是否对 app 端开放阅读 |
|
||||
@@ -173,11 +174,12 @@
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| list | array | `book.BookChapter` 列表 |
|
||||
| list | array | `bookRes.BookChapterListItem` 列表 |
|
||||
| list[].id | uint | 章节 ID |
|
||||
| list[].createdAt | string | 创建时间 |
|
||||
| list[].updatedAt | string | 更新时间 |
|
||||
| list[].bookId | uint | 所属书籍 ID |
|
||||
| list[].bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| list[].title | string | 章节标题 |
|
||||
| list[].chapterNo | int | 同书内章节顺序编号 |
|
||||
| list[].isReadable | bool | 是否对 app 端开放阅读 |
|
||||
@@ -191,6 +193,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`book_id asc, chapter_no asc`。
|
||||
- 列表通过 `book_chapter` 联表 `book` 补充 `bookTitle` 展示字段;写接口仍只接收 `bookId`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -199,3 +202,4 @@
|
||||
- `chapterNo` 必须大于 `0`。
|
||||
- `totalLines` 不能小于 `0`;`isReadable=true` 时 `totalLines` 必须大于 `0`。
|
||||
- 创建、更新复用实体 `book.BookChapter`;列表查询复用 `bookReq.BookChapterSearch`;详情返回 `bookRes.BookChapterResponse`。
|
||||
- `bookTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
- 实体模型:`book.BookComment`
|
||||
- 搜索入参:`bookReq.BookCommentSearch`
|
||||
- 详情响应:`bookRes.BookCommentResponse`
|
||||
- 列表项:`bookRes.BookCommentListItem`
|
||||
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
|
||||
- 删除策略:硬删
|
||||
|
||||
@@ -143,7 +144,9 @@
|
||||
| bookComment.updatedAt | time | 更新时间 |
|
||||
| bookComment.memberUserId | uint | 评论用户的会员 ID |
|
||||
| bookComment.bookId | uint | 所属书籍 ID |
|
||||
| bookComment.bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| bookComment.chapterId | uint | 评论目标章节 ID,`0` 表示整本书 |
|
||||
| bookComment.chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title`;整书评论可为空 |
|
||||
| bookComment.lineIndex | int | 评论目标文本行下标,`0` 表示整章或整本书 |
|
||||
| bookComment.content | string | 评论正文内容 |
|
||||
| bookComment.likeCount | int64 | 评论点赞聚合值 |
|
||||
@@ -172,13 +175,15 @@
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| list | array | `book.BookComment` 列表 |
|
||||
| list | array | `bookRes.BookCommentListItem` 列表 |
|
||||
| list[].id | uint | 评论 ID |
|
||||
| list[].createdAt | time | 创建时间 |
|
||||
| list[].updatedAt | time | 更新时间 |
|
||||
| list[].memberUserId | uint | 评论用户的会员 ID |
|
||||
| list[].bookId | uint | 所属书籍 ID |
|
||||
| list[].bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| list[].chapterId | uint | 评论目标章节 ID,`0` 表示整本书 |
|
||||
| list[].chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title`;整书评论可为空 |
|
||||
| list[].lineIndex | int | 评论目标文本行下标,`0` 表示整章或整本书 |
|
||||
| list[].content | string | 评论正文内容 |
|
||||
| list[].likeCount | int64 | 评论点赞聚合值 |
|
||||
@@ -190,6 +195,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`id desc`。
|
||||
- 列表通过 `book_comment` 联表 `book`、`book_chapter` 补充 `bookTitle/chapterTitle` 展示字段;写接口仍只接收 `bookId/chapterId`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -197,3 +203,4 @@
|
||||
- `lineIndex/likeCount` 不能小于 `0`。
|
||||
- 整书评论 `chapterId=0` 时 `lineIndex` 必须为 `0`。
|
||||
- 删除策略为硬删。
|
||||
- `bookTitle/chapterTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 实体模型:`book.BookCommentLikeRecord`
|
||||
- 搜索入参:`bookReq.BookCommentLikeRecordSearch`
|
||||
- 详情响应:`bookRes.BookCommentLikeRecordResponse`
|
||||
- 列表项:`book.BookCommentLikeRecord`
|
||||
- 列表项:`bookRes.BookCommentLikeRecordListItem`
|
||||
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
|
||||
- 删除策略:硬删
|
||||
|
||||
@@ -133,6 +133,8 @@
|
||||
| bookCommentLikeRecord.createdAt | string | 创建时间 |
|
||||
| bookCommentLikeRecord.updatedAt | string | 更新时间 |
|
||||
| bookCommentLikeRecord.commentId | uint | 被点赞评论 ID |
|
||||
| bookCommentLikeRecord.commentContent | string | 被点赞评论内容展示字段,来源于 `book_comment.content AS comment_content` |
|
||||
| bookCommentLikeRecord.bookTitle | string | 评论所属书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| bookCommentLikeRecord.memberUserId | uint | 点赞用户的会员 ID |
|
||||
| bookCommentLikeRecord.likedAt | string | 点赞发生时间 |
|
||||
|
||||
@@ -157,11 +159,13 @@
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| list | array | `book.BookCommentLikeRecord` 列表 |
|
||||
| list | array | `bookRes.BookCommentLikeRecordListItem` 列表 |
|
||||
| list[].id | uint | 点赞记录 ID |
|
||||
| list[].createdAt | string | 创建时间 |
|
||||
| list[].updatedAt | string | 更新时间 |
|
||||
| list[].commentId | uint | 被点赞评论 ID |
|
||||
| list[].commentContent | string | 被点赞评论内容展示字段,来源于 `book_comment.content AS comment_content` |
|
||||
| list[].bookTitle | string | 评论所属书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| list[].memberUserId | uint | 点赞用户的会员 ID |
|
||||
| list[].likedAt | string | 点赞发生时间 |
|
||||
| total | int64 | 总数 |
|
||||
@@ -171,6 +175,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`id desc`。
|
||||
- 列表通过 `book_comment_like_record` 联表 `book_comment`、`book` 补充 `commentContent/bookTitle` 展示字段;写接口仍只接收 `commentId/memberUserId`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -178,3 +183,4 @@
|
||||
- `commentId + memberUserId` 是幂等判断边界,必须保持唯一。
|
||||
- 删除策略为硬删;删除后该点赞关系不再存在。
|
||||
- 时间字段以接口实际 JSON 序列化格式为准,业务语义为 `liked_at`。
|
||||
- `commentContent/bookTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 实体模型:`book.BookFavoriteRecord`
|
||||
- 搜索入参:`bookReq.BookFavoriteRecordSearch`
|
||||
- 详情响应:`bookRes.BookFavoriteRecordResponse`
|
||||
- 列表项:`book.BookFavoriteRecord`
|
||||
- 列表项:`bookRes.BookFavoriteRecordListItem`
|
||||
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
|
||||
- 删除策略:硬删
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
| bookFavoriteRecord.updatedAt | string | 更新时间 |
|
||||
| bookFavoriteRecord.memberUserId | uint | 收藏用户的会员 ID |
|
||||
| bookFavoriteRecord.bookId | uint | 收藏书籍 ID |
|
||||
| bookFavoriteRecord.bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| bookFavoriteRecord.favoritedAt | string | 收藏发生时间 |
|
||||
|
||||
### 分页查询书籍收藏记录列表
|
||||
@@ -157,12 +158,13 @@
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| list | array | `book.BookFavoriteRecord` 列表 |
|
||||
| list | array | `bookRes.BookFavoriteRecordListItem` 列表 |
|
||||
| list[].id | uint | 收藏记录 ID |
|
||||
| list[].createdAt | string | 创建时间 |
|
||||
| list[].updatedAt | string | 更新时间 |
|
||||
| list[].memberUserId | uint | 收藏用户的会员 ID |
|
||||
| list[].bookId | uint | 收藏书籍 ID |
|
||||
| list[].bookTitle | string | 书籍标题展示字段,来源于 `book.title AS book_title` |
|
||||
| list[].favoritedAt | string | 收藏发生时间 |
|
||||
| total | int64 | 总数 |
|
||||
| page | int | 当前页 |
|
||||
@@ -171,6 +173,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`id desc`。
|
||||
- 列表通过 `book_favorite_record` 联表 `book` 补充 `bookTitle` 展示字段;写接口仍只接收 `memberUserId/bookId`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -178,3 +181,4 @@
|
||||
- 写操作挂载 `middleware.OperationRecord()`;详情和分页列表不挂操作审计。
|
||||
- `memberUserId + bookId` 唯一约束由数据库索引 `uk_book_favorite_record_member_user_id_book_id` 保证。
|
||||
- 删除策略为硬删,实体使用 `HardDeleteModel`,不维护 `deletedAt`。
|
||||
- `bookTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- 实体模型:`book.BookReadRecord`
|
||||
- 搜索入参:`bookReq.BookReadRecordSearch`
|
||||
- 详情响应:`bookRes.BookReadRecordResponse`
|
||||
- 列表项:`book.BookReadRecord`
|
||||
- 列表项:`bookRes.BookReadRecordListItem`
|
||||
- 返回:写操作 `response.Response{msg}`;详情 `response.Response{data}`;列表 `response.PageResult`
|
||||
- 删除策略:硬删
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
| bookReadRecord.bookTitleSnapshot | string | 阅读书籍标题快照 |
|
||||
| bookReadRecord.readProgress | float | 阅读进度百分比 |
|
||||
| bookReadRecord.chapterId | uint | 当前续读章节 ID |
|
||||
| bookReadRecord.chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title` |
|
||||
| bookReadRecord.lineIndex | int | 当前续读文本行下标,正文首行为 `1` |
|
||||
| bookReadRecord.lastReadAt | string | 最近一次阅读时间 |
|
||||
|
||||
@@ -171,7 +172,7 @@
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|:---|:---|:---|
|
||||
| list | array | `book.BookReadRecord` 列表 |
|
||||
| list | array | `bookRes.BookReadRecordListItem` 列表 |
|
||||
| list[].id | uint | 阅读记录 ID |
|
||||
| list[].createdAt | string | 创建时间 |
|
||||
| list[].updatedAt | string | 更新时间 |
|
||||
@@ -180,6 +181,7 @@
|
||||
| list[].bookTitleSnapshot | string | 阅读书籍标题快照 |
|
||||
| list[].readProgress | float | 阅读进度百分比 |
|
||||
| list[].chapterId | uint | 当前续读章节 ID |
|
||||
| list[].chapterTitle | string | 章节标题展示字段,来源于 `book_chapter.title AS chapter_title` |
|
||||
| list[].lineIndex | int | 当前续读文本行下标,正文首行为 `1` |
|
||||
| list[].lastReadAt | string | 最近一次阅读时间 |
|
||||
| total | int64 | 总数 |
|
||||
@@ -189,6 +191,7 @@
|
||||
#### 规则
|
||||
|
||||
- 列表默认排序:`last_read_at desc, id desc`。
|
||||
- 列表通过 `book_read_record` 联表 `book_chapter` 补充 `chapterTitle` 展示字段;书籍标题使用记录内 `bookTitleSnapshot`。
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -197,3 +200,4 @@
|
||||
- 删除策略为硬删,删除后不保留软删标记。
|
||||
- `memberUserId + bookId` 是业务唯一键。
|
||||
- `readProgress` 范围为 `0-100`;`chapterId` 必须大于 `0`;`lineIndex` 必须大于 `0`。
|
||||
- `chapterTitle` 为只读展示字段,禁止写入实体表结构,禁止作为创建或更新入参。
|
||||
|
||||
Reference in New Issue
Block a user