API-INFO-016 P0 | 查询资料阅读进度接口 【status:todo】 #114

Closed
opened 2026-06-07 11:03:39 +08:00 by wangdl · 2 comments
Owner

目标

GET /materials/:id/reading-progress?readingTargetType=knowledge_source

返回

lastPosition, lastProgress, totalActiveSeconds, isMarkedRead, status

无记录

status=not_started

权限

  • knowledge_source: 校验 KB 访问权限
  • temporary_file: 校验 userId

详见设计文档 API-INFO-000。

## 目标 ```http GET /materials/:id/reading-progress?readingTargetType=knowledge_source ``` ### 返回 lastPosition, lastProgress, totalActiveSeconds, isMarkedRead, status ### 无记录 status=not_started ### 权限 - knowledge_source: 校验 KB 访问权限 - temporary_file: 校验 userId 详见设计文档 API-INFO-000。
wangdl added this to the M8:学习信息收集与基础分析闭环 milestone 2026-06-07 11:03:39 +08:00
wangdl changed title from API-INFO-009 P0 | 查询资料阅读进度接口 to API-INFO-016 P0 | 查询资料阅读进度接口 2026-06-07 11:22:17 +08:00
wangdl changed title from API-INFO-016 P0 | 查询资料阅读进度接口 to API-INFO-016 P0 | 查询资料阅读进度接口 【status:todo】 2026-06-07 19:04:15 +08:00
Author
Owner

审查结论:当前 API 项目学习信息收集体系基本为全新建设。可复用:JWT Guard、LearningSession 基础表/CRUD、DailyLearningActivity 基础表、ActivityController 部分接口、LearningRecord schema。其余 ReadingEvent/TemporaryMaterial/Progress/批量上报/Processor/聚合/查询接口/错误码/去重/权限/测试/文档均不存在或仅部分存在。

本 Issue: 接口不存在。依赖 progress 表。blocked-by:api-info-core

标签: audit:reviewed audit:api-info status:todo work:api

## 审查结论:当前 API 项目学习信息收集体系基本为全新建设。可复用:JWT Guard、LearningSession 基础表/CRUD、DailyLearningActivity 基础表、ActivityController 部分接口、LearningRecord schema。其余 ReadingEvent/TemporaryMaterial/Progress/批量上报/Processor/聚合/查询接口/错误码/去重/权限/测试/文档均不存在或仅部分存在。 **本 Issue**: 接口不存在。依赖 progress 表。blocked-by:api-info-core **标签**: audit:reviewed audit:api-info status:todo work:api
Author
Owner

完成报告

交付

ReadingController.getProgress() — 资料阅读进度查询:

GET /materials/:id/reading-progress?readingTargetType=knowledge_source
Authorization: Bearer <jwt>

Response:
{
  "status": "reading" | "read" | "not_started",
  "lastPosition": { "type": "Markdown", "blockId": "ch1", "scrollProgress": 0.5 },
  "lastProgress": 0.5,
  "totalActiveSeconds": 120,
  "isMarkedRead": false,
  "firstOpenedAt": "2026-01-01T00:00:00Z",
  "lastReadAt": "2026-01-01T00:02:00Z"
}

// 无记录:
{ "status": "not_started", "lastPosition": null, "lastProgress": null, "totalActiveSeconds": 0, "isMarkedRead": false }

// 权限拒绝:
{ "status": "not_started", "reason": "material not found or access denied" }

权限校验

  • resolveReadingTarget(userId, targetType, materialId) — 复用 ProcessorService 的权限检查
  • knowledge_source → 查 KnowledgeSource userId 匹配
  • temporary_file → 查 TemporaryReadingMaterial userId + deletedAt + expiresAt
## 完成报告 ### 交付 **`ReadingController.getProgress()`** — 资料阅读进度查询: ``` GET /materials/:id/reading-progress?readingTargetType=knowledge_source Authorization: Bearer <jwt> Response: { "status": "reading" | "read" | "not_started", "lastPosition": { "type": "Markdown", "blockId": "ch1", "scrollProgress": 0.5 }, "lastProgress": 0.5, "totalActiveSeconds": 120, "isMarkedRead": false, "firstOpenedAt": "2026-01-01T00:00:00Z", "lastReadAt": "2026-01-01T00:02:00Z" } // 无记录: { "status": "not_started", "lastPosition": null, "lastProgress": null, "totalActiveSeconds": 0, "isMarkedRead": false } // 权限拒绝: { "status": "not_started", "reason": "material not found or access denied" } ``` **权限校验**: - `resolveReadingTarget(userId, targetType, materialId)` — 复用 ProcessorService 的权限检查 - knowledge_source → 查 KnowledgeSource userId 匹配 - temporary_file → 查 TemporaryReadingMaterial userId + deletedAt + expiresAt
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/api-server#114
No description provided.