22 lines
825 B
Python
22 lines
825 B
Python
"""Per-Character 目标管理端点(非 admin,供 /drive 等前端使用)。"""
|
|
|
|
from fastapi import APIRouter, Query
|
|
|
|
from app.schemas.admin import CreateGoalRequest, GoalNode
|
|
from app.services import governance as governance_service
|
|
|
|
router = APIRouter(prefix="/goals", tags=["goals"])
|
|
|
|
|
|
@router.get("", response_model=list[GoalNode])
|
|
async def list_goals(
|
|
character_id: str = Query(..., description="按人物过滤。"),
|
|
status: str | None = Query(default=None, description="按状态过滤(§5.12)。"),
|
|
) -> list[GoalNode]:
|
|
return await governance_service.list_goals_by_character(character_id, status_filter=status)
|
|
|
|
|
|
@router.post("", response_model=GoalNode, status_code=201)
|
|
async def create_goal(payload: CreateGoalRequest) -> GoalNode:
|
|
return await governance_service.create_goal(payload)
|