fix(knowledge): 翻页游标的字段名写错,点「加载更多」必 500
CI / backend (push) Canceled after 0s

知识列表拿游标做 keyset 分页时写成了 `cur.item_id`,而 `Cursor` 只有
`created_at` 和 `id` 两个字段——属性不存在,直接 AttributeError,
前端只看到"服务器内部错误"。

库里不足一页(默认 30 条)时永远走不到这条分支,所以一直没暴露;
旧备忘导进来 84 条之后,用户点「加载更多」就撞上了。

补一条回归用例:造 25 条、每页 10 条翻到底,断言不重不漏、末页游标为空。
This commit is contained in:
Steven
2026-11-01 02:55:23 +08:00
parent d24be46d8c
commit b662429842
2 changed files with 43 additions and 1 deletions
+1 -1
View File
@@ -328,7 +328,7 @@ async def list_knowledge(
stmt = stmt.where(
or_(
Item.updated_at < cur.created_at,
and_(Item.updated_at == cur.created_at, Item.id < cur.item_id),
and_(Item.updated_at == cur.created_at, Item.id < cur.id),
)
)