- 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
100 lines
3 KiB
HTML
100 lines
3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>D3RO-VOICE Admin API</title>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css" />
|
|
<style>
|
|
body { margin: 0; padding: 0; background: #1a1a2e; }
|
|
.topbar { display: none !important; }
|
|
.swagger-ui .info .title { color: #e0e0e0; }
|
|
.swagger-ui { max-width: 1200px; margin: 0 auto; }
|
|
#header {
|
|
background: linear-gradient(135deg, #0f0f23, #1a1a2e);
|
|
color: #e0e0e0;
|
|
padding: 20px 32px;
|
|
border-bottom: 1px solid #333;
|
|
font-family: system-ui, -apple-system, sans-serif;
|
|
}
|
|
#header h1 { margin: 0 0 4px; font-size: 1.4rem; }
|
|
#header p { margin: 0; font-size: 0.85rem; color: #888; }
|
|
#auth-bar {
|
|
background: #0f0f23;
|
|
padding: 12px 32px;
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: center;
|
|
border-bottom: 1px solid #222;
|
|
font-family: monospace;
|
|
}
|
|
#auth-bar label { color: #aaa; font-size: 0.8rem; }
|
|
#auth-bar input {
|
|
flex: 1;
|
|
max-width: 500px;
|
|
padding: 6px 10px;
|
|
background: #1a1a2e;
|
|
border: 1px solid #444;
|
|
border-radius: 4px;
|
|
color: #e0e0e0;
|
|
font-family: monospace;
|
|
font-size: 0.8rem;
|
|
}
|
|
#auth-bar button {
|
|
padding: 6px 16px;
|
|
background: #4a6cf7;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 0.8rem;
|
|
}
|
|
#auth-bar button:hover { background: #3a5ce5; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="header">
|
|
<h1>D3RO-VOICE Admin API</h1>
|
|
<p>Admin CRM Edge Functions — User management, Subscription CRUD, Payments, Audit logs</p>
|
|
</div>
|
|
<div id="auth-bar">
|
|
<label for="token">Bearer Token:</label>
|
|
<input id="token" type="text" placeholder="Paste your Supabase access_token here..." />
|
|
<button onclick="applyToken()">Apply</button>
|
|
</div>
|
|
<div id="swagger-ui"></div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
|
|
<script>
|
|
let swaggerUI;
|
|
|
|
window.onload = function () {
|
|
swaggerUI = SwaggerUIBundle({
|
|
url: './openapi.json',
|
|
dom_id: '#swagger-ui',
|
|
deepLinking: true,
|
|
presets: [SwaggerUIBundle.presets.apis],
|
|
layout: 'BaseLayout',
|
|
requestInterceptor: function (req) {
|
|
const token = document.getElementById('token').value.trim();
|
|
if (token) {
|
|
req.headers['Authorization'] = 'Bearer ' + token;
|
|
}
|
|
return req;
|
|
},
|
|
});
|
|
};
|
|
|
|
function applyToken() {
|
|
const token = document.getElementById('token').value.trim();
|
|
if (token) {
|
|
swaggerUI.preauthorizeApiKey('BearerAuth', token);
|
|
document.getElementById('token').style.borderColor = '#4a6cf7';
|
|
setTimeout(function () {
|
|
document.getElementById('token').style.borderColor = '#444';
|
|
}, 1000);
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|