video_id 추가

feature-dashboard
hbyang 2026-02-26 14:13:32 +09:00
parent 05dc2e1cc2
commit 1569ead56c
3 changed files with 19 additions and 2 deletions

View File

@ -45,6 +45,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
// 소셜 미디어 포스팅 모달
const [showSocialModal, setShowSocialModal] = useState(false);
const [videoDbId, setVideoDbId] = useState<number | null>(null);
// 저장된 완료 데이터
const [songCompletionData, setSongCompletionData] = useState<{
@ -203,6 +204,10 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
if (videoUrlFromResponse) {
setVideoUrl(videoUrlFromResponse);
const videoId = statusResponse.render_data?.video_id;
if (videoId) {
setVideoDbId(videoId);
}
setVideoStatus('complete');
setStatusMessage('');
saveToStorage(videoTaskId, currentSongTaskId, 'complete', videoUrlFromResponse);
@ -515,8 +520,8 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
<SocialPostingModal
isOpen={showSocialModal}
onClose={handleCloseSocialConnect}
video={videoUrl ? {
video_id: 0,
video={videoUrl && videoDbId ? {
video_id: videoDbId,
store_name: songCompletionData?.businessName || '',
region: '',
task_id: songTaskId || '',

View File

@ -158,6 +158,7 @@ export interface VideoStatusResponse {
status: string;
url: string | null;
snapshot_url: string | null;
video_id?: number;
} | null;
raw_response?: Record<string, unknown>;
error_message: string | null;

View File

@ -301,6 +301,17 @@ export async function getVideosList(page: number = 1, pageSize: number = 10): Pr
return response.json();
}
// task_id로 video_id 조회 (소셜 업로드용)
export async function getVideoIdByTaskId(taskId: string): Promise<number | null> {
try {
const response = await getVideosList(1, 50);
const found = response.items.find(v => v.task_id === taskId);
return found?.video_id ?? null;
} catch {
return null;
}
}
// 비디오 삭제 API (개별 비디오 삭제)
export async function deleteVideo(videoId: number): Promise<void> {
const response = await authenticatedFetch(`${API_URL}/archive/videos/${videoId}`, {