61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
"""演化候选审核 API。"""
|
|
|
|
from fastapi import APIRouter, Query
|
|
|
|
from app.schemas.common import Page
|
|
from app.schemas.evolution import EvolutionCandidateResponse
|
|
from app.services.evolution import (
|
|
approve_evolution_candidate,
|
|
list_evolution_candidates,
|
|
reject_evolution_candidate,
|
|
)
|
|
|
|
router = APIRouter(tags=["evolution"])
|
|
|
|
|
|
@router.get(
|
|
"/characters/{character_id}/evolution-candidates",
|
|
response_model=Page[EvolutionCandidateResponse],
|
|
)
|
|
async def list_evolution_candidates_endpoint(
|
|
character_id: str,
|
|
status: str | None = Query(
|
|
default=None, description="按状态过滤:pending/approved/rejected/applied"
|
|
),
|
|
candidate_type: str | None = Query(
|
|
default=None, alias="type", description="按候选类型过滤(契约字典 §12.1)"
|
|
),
|
|
page: int = Query(default=1, ge=1),
|
|
page_size: int = Query(default=20, ge=1, le=100),
|
|
) -> Page[EvolutionCandidateResponse]:
|
|
"""列出某人物的演化候选(大周天生成 + 审核状态)。"""
|
|
return await list_evolution_candidates(
|
|
character_id=character_id,
|
|
status=status,
|
|
candidate_type=candidate_type,
|
|
page=page,
|
|
page_size=page_size,
|
|
)
|
|
|
|
|
|
@router.post(
|
|
"/evolution-candidates/{candidate_id}/approve",
|
|
response_model=EvolutionCandidateResponse,
|
|
)
|
|
async def approve_candidate(
|
|
candidate_id: str,
|
|
) -> EvolutionCandidateResponse:
|
|
"""审核通过演化候选:派生到下游(人格版本/程序记忆等),status → applied。"""
|
|
return await approve_evolution_candidate(candidate_id)
|
|
|
|
|
|
@router.post(
|
|
"/evolution-candidates/{candidate_id}/reject",
|
|
response_model=EvolutionCandidateResponse,
|
|
)
|
|
async def reject_candidate(
|
|
candidate_id: str,
|
|
) -> EvolutionCandidateResponse:
|
|
"""驳回演化候选:status → rejected,不派生下游。"""
|
|
return await reject_evolution_candidate(candidate_id)
|