🟡 P1 | PATCH /knowledge-items/{id} 支持 parentId 和重命名 #65
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
iOS 知识点长按菜单有「重命名」和「移动到」两个操作。UpdateKnowledgeItemRequest 当前仅支持 title/content/summary,但 PATCH 接口可能需要确认 parentId 支持。
需求
UpdateKnowledgeItemRequest 新增字段:
parentId: String? // 移动到目标文件夹(null = 根目录)
确认 title 字段在 PATCH 时正常更新。
关联
重命名:现有 PATCH 接口已支持 title 更新,需前端接入
移动到:需新增 parentId 支持
wangdl referenced this issue2026-06-05 19:34:41 +08:00
wangdl referenced this issue2026-06-05 19:34:41 +08:00
wangdl referenced this issue2026-06-05 19:36:03 +08:00
wangdl referenced this issue2026-06-05 19:36:05 +08:00
修复汇报 (2026-06-05)
实现
parentId校验:如果传入非 null 值,检查目标父节点存在且属于同一知识库,否则抛BadRequestExceptionparentId: null表示移动到根目录title更新已通过Record<string, any>透传支持状态
✅ 完成。
Bug 修复 (2026-06-06)
问题
KnowledgeItemsRepository.update()使用Record<string, any>直接透传给 Prisma,存在 Mass Assignment 漏洞。攻击者可传入userId、deletedAt、status等任意字段覆写数据库记录。修复
新增字段白名单:
title、content、summary、parentId、itemType、sourceType、orderIndex、status、durationSeconds。仅白名单内的字段可被更新。状态
✅ 已修复。