🔴 P0 | KnowledgeItem 新增 durationSeconds 字段 #59

Closed
opened 2026-05-30 16:24:25 +08:00 by wangdl · 1 comment
Owner

背景

iOS 知识点列表页新增「学习时长」展示,当前使用客户端伪数据(progressFor 函数估算),需要后端提供真实学习时长。

需求

KnowledgeItem 模型新增字段:

durationSeconds: Int?  // 该知识点的累计学习秒数

影响页面

  • 知识点列表(类型:PDF 创建:05/30 学习:15:00)

前端占位代码

LibrarySubpages.swiftprogressFor() / formatDuration() 使用 status 做近似估算

## 背景 iOS 知识点列表页新增「学习时长」展示,当前使用客户端伪数据(progressFor 函数估算),需要后端提供真实学习时长。 ## 需求 KnowledgeItem 模型新增字段: ``` durationSeconds: Int? // 该知识点的累计学习秒数 ``` ## 影响页面 - 知识点列表(类型:PDF 创建:05/30 学习:15:00) ## 前端占位代码 `LibrarySubpages.swift` — `progressFor()` / `formatDuration()` 使用 status 做近似估算
wangdl added this to the H0:iOS 对接阻断修复(P0) milestone 2026-05-30 16:24:25 +08:00
Author
Owner

修复汇报 (2026-06-05)

实现

  1. Prisma SchemaKnowledgeItem 新增 durationSeconds Int @default(0) 字段
  2. Repositorycreate() DTO 新增 durationSeconds?,默认值 0

后续

  • 可在 LearningSession 完成时回写 KnowledgeItem.durationSeconds(累积学习时长)
  • iOS 端已用 progressFor() 做伪数据,字段就绪后可切真实数据

状态

代码完成,文件和 schema 已传服务器。需执行 npx prisma migrate deploy + 重启 NestJS。

## 修复汇报 (2026-06-05) ### 实现 1. **Prisma Schema** — `KnowledgeItem` 新增 `durationSeconds Int @default(0)` 字段 2. **Repository** — `create()` DTO 新增 `durationSeconds?`,默认值 0 ### 后续 - 可在 `LearningSession` 完成时回写 `KnowledgeItem.durationSeconds`(累积学习时长) - iOS 端已用 `progressFor()` 做伪数据,字段就绪后可切真实数据 ### 状态 ✅ 代码完成,文件和 schema 已传服务器。需执行 `npx prisma migrate deploy` + 重启 NestJS。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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