51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""
|
|
SNS API 라우터
|
|
|
|
Instagram 업로드 관련 엔드포인트를 제공합니다.
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from app.sns.schemas.sns_schema import InstagramUploadResponse
|
|
from app.utils.logger import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
router = APIRouter(prefix="/sns", tags=["SNS"])
|
|
|
|
|
|
@router.get(
|
|
"/instagram/upload/{task_id}",
|
|
summary="Instagram 업로드 상태 조회",
|
|
description="""
|
|
## 개요
|
|
task_id에 해당하는 Instagram 업로드 작업의 상태를 조회합니다.
|
|
|
|
## 경로 파라미터
|
|
- **task_id**: 업로드 작업 고유 식별자
|
|
|
|
## 반환 정보
|
|
- **task_id**: 작업 고유 식별자
|
|
- **state**: 업로드 상태 (pending, processing, completed, failed)
|
|
- **message**: 상태 메시지
|
|
- **error**: 에러 메시지 (실패 시, 기본값: null)
|
|
""",
|
|
response_model=InstagramUploadResponse,
|
|
responses={
|
|
200: {"description": "상태 조회 성공"},
|
|
},
|
|
)
|
|
async def get_instagram_upload_status(task_id: str) -> InstagramUploadResponse:
|
|
"""Instagram 업로드 작업의 상태를 반환합니다."""
|
|
logger.info(f"[get_instagram_upload_status] START - task_id: {task_id}")
|
|
|
|
response = InstagramUploadResponse(
|
|
task_id=task_id,
|
|
state="pending",
|
|
message="업로드 대기 중입니다.",
|
|
error=None,
|
|
)
|
|
|
|
logger.info(f"[get_instagram_upload_status] SUCCESS - task_id: {task_id}, state: {response.state}")
|
|
return response
|