feat: 프로젝트 API Bearer 토큰 인증 + E2E 테스트 스크립트 + 크몽 마케팅 이미지

- app/api/projects, link/route: Cookie + Bearer 토큰 이중 인증 지원 (E2E 테스트 대응)
- app/mypage: 로또 기록 탭 제거, 구독 빈 상태 프롬프트 서비스로 변경
- scripts/test-flow.mjs: 견적서 발송→연결→마일스톤 진행 E2E 테스트 스크립트
- supabase/migrations/003: quotes RLS 비활성화 (관리자 서버 전용 접근)
- marketing/kmong-images: 크몽 서비스 A 상세 이미지 5장 (HTML 스크린샷용)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 04:15:47 +09:00
parent 19b09e3b90
commit 2c9af41631
10 changed files with 1589 additions and 77 deletions

View File

@@ -1,12 +1,29 @@
import { NextResponse } from 'next/server';
import { createAdminClient } from '@/lib/supabase/admin';
import { createClient } from '@/lib/supabase/server';
import { createClient as createSupabaseClient } from '@supabase/supabase-js';
export const runtime = 'nodejs';
export async function POST(request: Request) {
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();
// Cookie 기반 또는 Bearer 토큰 기반 인증 모두 지원
const authHeader = request.headers.get('authorization');
let user = null;
if (authHeader?.startsWith('Bearer ')) {
const token = authHeader.slice(7);
const client = createSupabaseClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
);
const { data } = await client.auth.getUser(token);
user = data?.user ?? null;
} else {
const supabase = await createClient();
const { data } = await supabase.auth.getUser();
user = data?.user ?? null;
}
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
const body = await request.json();