import { NextRequest, NextResponse } from 'next/server'; const GATEWAY_HOST = 'http://kt-event-marketing-api.20.214.196.128.nip.io'; export async function POST( request: NextRequest, { params }: { params: { eventId: string } } ) { try { const { eventId } = params; const token = request.headers.get('Authorization'); const body = await request.json(); console.log('🎰 [Proxy] Draw winners request:', { eventId, hasToken: !!token, timestamp: new Date().toISOString(), }); if (!token) { return NextResponse.json( { message: '인증 토큰이 ν•„μš”ν•©λ‹ˆλ‹€.' }, { status: 401 } ); } const response = await fetch( `${GATEWAY_HOST}/api/v1/participations/events/${eventId}/draw-winners`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: token, }, body: JSON.stringify(body), } ); const data = await response.json(); console.log('πŸ“₯ [Proxy] Draw winners response:', { status: response.status, success: response.ok, }); if (!response.ok) { return NextResponse.json(data, { status: response.status }); } return NextResponse.json(data); } catch (error) { console.error('❌ [Proxy] Draw winners error:', error); return NextResponse.json( { message: 'λ‹Ήμ²¨μž 좔첨 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.' }, { status: 500 } ); } }