- DB: audit_log 테이블(diff 포함) + subscriptions.admin_note + super_admin role - Edge Functions 4개: admin-users, admin-subscriptions, admin-payments, admin-audit-log - 공유 유틸: admin-auth.ts(권한 검증), audit.ts(감사로그 기록) - Swagger UI: 독립 정적 페이지 + OpenAPI 3.0 spec - CRUD 페이지: 구독 생성/수정/삭제, role 변경, 감사로그 목록/상세 - recharts: feature별 StackedBar + DAU Line + Top Users HorizontalBar - 결제 이력: DB + Payple API 병행 조회 - 권한: super_admin만 위험 작업, admin은 조회 전용 - RLS: admin/super_admin IN 정책 + super_admin 쓰기 정책 - SQL RPC: admin_usage_by_feature, admin_top_users, admin_dau
16 lines
524 B
TypeScript
16 lines
524 B
TypeScript
// server/supabase/functions/_shared/cors.ts
|
|
// Edge Function 공통 CORS 헤더
|
|
|
|
export const corsHeaders: Record<string, string> = {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Headers':
|
|
'authorization, x-client-info, apikey, content-type',
|
|
'Access-Control-Allow-Methods': 'GET, POST, PATCH, DELETE, OPTIONS'
|
|
}
|
|
|
|
export function handleCorsPreflightRequest(req: Request): Response | null {
|
|
if (req.method === 'OPTIONS') {
|
|
return new Response('ok', { headers: corsHeaders })
|
|
}
|
|
return null
|
|
}
|