chore(phase0): 고아 API 제거 — track/[token](페이지 직접조회로 대체됨)·saju/lotto

- app/api/track/[token]: 페이지에서 Supabase 직접 조회로 대체됨
- app/api/saju/lotto: 프론트 fetch 0회, 외부 saju-engine 전용

참조: Task 6 (Phase 0 cleanup)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-02 14:25:05 +09:00
parent 8c5858b350
commit 7366c18692
2 changed files with 0 additions and 72 deletions

View File

@@ -1,41 +0,0 @@
import { NextRequest, NextResponse } from 'next/server';
const SAJU_ENGINE_URL = process.env.SAJU_ENGINE_URL;
const SAJU_ENGINE_SECRET = process.env.SAJU_ENGINE_SECRET;
export async function POST(request: NextRequest) {
if (!SAJU_ENGINE_URL) {
return NextResponse.json({ error: '사주 엔진 URL이 설정되지 않았습니다' }, { status: 503 });
}
try {
const body = await request.json();
const response = await fetch(`${SAJU_ENGINE_URL}/saju/lotto`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...(SAJU_ENGINE_SECRET ? { 'X-API-Secret': SAJU_ENGINE_SECRET } : {}),
},
body: JSON.stringify(body),
signal: AbortSignal.timeout(15000),
});
const data = await response.json();
if (!response.ok) {
return NextResponse.json(
{ error: data.detail || '로또 번호 생성 실패' },
{ status: response.status }
);
}
return NextResponse.json(data);
} catch (error: unknown) {
if (error instanceof Error && error.name === 'TimeoutError') {
return NextResponse.json({ error: '사주 엔진 응답 시간 초과' }, { status: 504 });
}
console.error('로또 번호 생성 프록시 오류:', error);
return NextResponse.json({ error: '서버 오류' }, { status: 500 });
}
}

View File

@@ -1,31 +0,0 @@
import { NextResponse } from 'next/server';
import { createAdminClient } from '@/lib/supabase/admin';
export const runtime = 'nodejs';
// 비회원 의뢰 추적 API — 향후 클라이언트 측 폴링/갱신용.
// PII(이메일·전화·메시지 본문)는 select에서 제외한다.
// DB 예외(마이그레이션 미적용 42703 포함)는 모두 404로 폴백한다.
export async function GET(_req: Request, { params }: { params: Promise<{ token: string }> }) {
const { token } = await params;
if (!token || token.length > 64) return NextResponse.json({ error: 'not found' }, { status: 404 });
const admin = createAdminClient();
const { data: request, error } = await admin
.from('contact_requests')
.select('id, name, service, status, project_type, budget, timeline, created_at, updated_at')
.eq('public_token', token)
.maybeSingle();
if (error || !request) return NextResponse.json({ error: 'not found' }, { status: 404 });
const { data: quote } = await admin
.from('quotes')
.select('public_token, title, status, valid_until')
.eq('contact_request_id', request.id)
.in('status', ['sent', 'accepted', 'rejected'])
.order('created_at', { ascending: false })
.limit(1)
.maybeSingle();
return NextResponse.json({ request, quote: quote ?? null });
}