|
1 | 1 | from uuid import UUID |
2 | 2 |
|
3 | | -from fastapi import APIRouter, Depends |
4 | | -from sqlalchemy.orm import Session |
| 3 | +from fastapi import Depends |
5 | 4 | from fastapi import status as http_status |
| 5 | +from sqlalchemy.orm import Session |
6 | 6 |
|
7 | 7 | from app.ai.services import step_service |
| 8 | +from app.core.api.route import EnvelopeRouter |
8 | 9 | from app.core.database import get_db |
| 10 | +from app.core.schemas.step import ( |
| 11 | + NotionTemplateResponse, |
| 12 | + StepAcceptResponse, |
| 13 | + StepDetailResponse, |
| 14 | + StepGenerateResponse, |
| 15 | +) |
9 | 16 |
|
10 | | -router = APIRouter() |
11 | | - |
12 | | - |
13 | | -def _ok(data): |
14 | | - return {"status": "success", "data": data} |
| 17 | +router = EnvelopeRouter() |
15 | 18 |
|
16 | 19 |
|
17 | 20 | @router.post("/steps/{step_id}/generate", status_code=http_status.HTTP_201_CREATED) |
18 | | -def generate_steps(step_id: UUID, db: Session = Depends(get_db)) -> dict: |
| 21 | +def generate_steps( |
| 22 | + step_id: UUID, db: Session = Depends(get_db) |
| 23 | +) -> StepGenerateResponse: |
19 | 24 | """현재 Step 기반으로 다음 후보 Step 3개를 AI로 생성.""" |
20 | | - response = step_service.generate_steps(db, step_id) |
21 | | - return _ok(response) |
| 25 | + return step_service.generate_steps(db, step_id) |
| 26 | + |
22 | 27 |
|
23 | 28 | @router.post("/steps/{step_id}/accept", status_code=http_status.HTTP_200_OK) |
24 | | -def accept_step(step_id: UUID, db: Session = Depends(get_db)) -> dict: |
25 | | - response = step_service.accept_step(db, step_id) |
26 | | - return _ok(response) |
| 29 | +def accept_step(step_id: UUID, db: Session = Depends(get_db)) -> StepAcceptResponse: |
| 30 | + return step_service.accept_step(db, step_id) |
| 31 | + |
27 | 32 |
|
28 | 33 | @router.get("/steps/{step_id}", status_code=http_status.HTTP_200_OK) |
29 | | -def get_step_detail(step_id: UUID, db: Session = Depends(get_db)) -> dict: |
30 | | - response = step_service.get_step_detail(db, step_id) |
31 | | - return _ok(response) |
| 34 | +def get_step_detail(step_id: UUID, db: Session = Depends(get_db)) -> StepDetailResponse: |
| 35 | + return step_service.get_step_detail(db, step_id) |
32 | 36 |
|
33 | 37 |
|
34 | 38 | @router.post( |
35 | 39 | "/steps/{step_id}/notion-template", status_code=http_status.HTTP_201_CREATED |
36 | 40 | ) |
37 | | -def create_notion_template(step_id: UUID) -> dict: |
| 41 | +def create_notion_template(step_id: UUID) -> NotionTemplateResponse: |
38 | 42 | """Required Step의 Notion 템플릿 페이지 생성 — TODO: Notion API 연동.""" |
39 | | - return _ok( |
40 | | - { |
41 | | - "notion_page_id": "placeholder", |
42 | | - "notion_page_url": "https://notion.so/placeholder", |
43 | | - } |
| 43 | + return NotionTemplateResponse( |
| 44 | + notion_page_id="placeholder", |
| 45 | + notion_page_url="https://notion.so/placeholder", |
44 | 46 | ) |
0 commit comments