feat(phase3b): orders에 영상화(music_video) 발주 + video-product 조회
This commit is contained in:
16
app/api/studio/video-product/route.ts
Normal file
16
app/api/studio/video-product/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { createClient } from '@/lib/supabase/server';
|
||||
import { createAdminClient } from '@/lib/supabase/admin';
|
||||
import { getProductById } from '@/lib/supabase/product-files';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
|
||||
export async function GET() {
|
||||
const supabase = await createClient();
|
||||
const { data: { user } } = await supabase.auth.getUser();
|
||||
if (!user) return NextResponse.json({ error: '로그인이 필요합니다.' }, { status: 401 });
|
||||
const admin = createAdminClient();
|
||||
const product = await getProductById(admin, 'music_video');
|
||||
if (!product || !product.is_active) return NextResponse.json({ error: '영상화 상품이 준비 중입니다.' }, { status: 404 });
|
||||
return NextResponse.json({ product: { id: product.id, name: product.name, price: product.price, is_active: product.is_active } });
|
||||
}
|
||||
Reference in New Issue
Block a user