fix/various fixes

This commit is contained in:
Kevin
2026-03-20 15:15:35 +08:00
parent 7f57f96c25
commit 7317bf10cd
112 changed files with 3790 additions and 2242 deletions

View File

@@ -2,14 +2,18 @@
回忆录 feature — books / chapters / memoir-state 合并路由
"""
from app.core.logging import get_logger
from typing import List, Optional
from fastapi import APIRouter, Body, Depends, Query
from app.core.dependencies import get_current_user
from app.core.logging import get_logger
from app.features.memoir.deps import get_memoir_service
from app.features.memoir.schemas import ExportPdfRequest, UpdateBookRequest
from app.features.memoir.schemas import (
ExportPdfRequest,
SetChapterStoryOrderRequest,
UpdateBookRequest,
)
from app.features.memoir.service import MemoirService
from app.features.user.models import User
@@ -129,6 +133,21 @@ async def regenerate_chapter(
return await service.regenerate_chapter(chapter_id, current_user.id)
@router.put("/chapters/{chapter_id}/story-order")
async def set_chapter_story_order(
chapter_id: str,
request: SetChapterStoryOrderRequest = Body(...),
current_user: User = Depends(get_current_user),
service: MemoirService = Depends(get_memoir_service),
):
"""
设置章节收录的 stories 顺序(覆盖 chapter_story_links并立即物化 canonical_markdown。
"""
return await service.set_chapter_story_order(
chapter_id, current_user.id, request.story_ids
)
# ===========================================================================
# Memoir-state endpoints
# ===========================================================================