feat(review): 审稿选章可用——列章端点 + 选章下拉全章可见 + 默认最近章

- 后端新增 GET /projects/{id}/chapters(列真实存在的章 + has_draft/accepted/reviewed_at),TDD 10 测
- gen:api 重生成 TS 客户端(ChapterListItem)
- 选章下拉去掉 hidden(手机/窄屏也可切章);选项以真实章为准 + 大纲结构,
  无草稿章置灰(仅当前章例外),覆盖『写过但不在大纲』的章
- 无 ?chapter 时默认落到最近一个有草稿的章,而非硬编码第 1 章
This commit is contained in:
Yaojia Wang
2026-07-12 17:52:40 +02:00
parent 5f28491ad6
commit 9aa0cddeaf
12 changed files with 652 additions and 18 deletions

View File

@@ -53,6 +53,7 @@ from ww_api.security.credentials import (
CredentialKeyError,
decrypt_api_key,
)
from ww_api.services.chapter_list import ChapterLister, SqlChapterLister
from ww_api.services.credentials import (
AUTH_TYPE_OAUTH,
STUB_OWNER_ID,
@@ -99,6 +100,13 @@ def get_chapter_repo(
return SqlChapterRepo(session)
def get_chapter_lister(
session: Annotated[AsyncSession, Depends(get_session)],
) -> ChapterLister:
"""列章只读服务GET /projects/:id/chapters。只读、不写库测试注入 fake lister。"""
return SqlChapterLister(session)
def get_memory_repos(
session: Annotated[AsyncSession, Depends(get_session)],
) -> MemoryRepos: