내부 youtube 업로드 endpoint 적용 .
This commit is contained in:
1 parent
d0334a5575
commit
6fba9c5362
5 files changed
+75
-4
No files matched your search
@@ -4,7 +4,7 @@
|
||||
소셜 미디어 영상 업로드 관련 엔드포인트를 제공합니다.
|
||||
"""
|
||||
|
||||
import logging, json
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, Query
|
||||
@@ -158,6 +158,7 @@ async def upload_to_social(
|
||||
description=body.description,
|
||||
tags=body.tags,
|
||||
privacy_status=body.privacy_status.value,
|
||||
scheduled_at=body.scheduled_at,
|
||||
platform_options={
|
||||
**(body.platform_options or {}),
|
||||
"scheduled_at": body.scheduled_at.isoformat() if body.scheduled_at else None,
|
||||
@@ -175,15 +176,19 @@ async def upload_to_social(
|
||||
f"account_id: {account.id}, upload_seq: {next_seq}, platform: {account.platform}"
|
||||
)
|
||||
|
||||
# 6. 백그라운드 태스크 등록
|
||||
background_tasks.add_task(process_social_upload, social_upload.id)
|
||||
# 6. 백그라운드 태스크 등록 (즉시 업로드 or 예약 없을 때만)
|
||||
from app.utils.timezone import now as utcnow
|
||||
is_scheduled = body.scheduled_at and body.scheduled_at > utcnow()
|
||||
if not is_scheduled:
|
||||
background_tasks.add_task(process_social_upload, social_upload.id)
|
||||
|
||||
message = "예약 업로드가 등록되었습니다." if is_scheduled else "업로드 요청이 접수되었습니다."
|
||||
return SocialUploadResponse(
|
||||
success=True,
|
||||
upload_id=social_upload.id,
|
||||
platform=account.platform,
|
||||
status=social_upload.status,
|
||||
message="업로드 요청이 접수되었습니다.",
|
||||
message=message,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user