Files
telegram-shop/src/admin/views/wallets.js
NW 4657b1dfb5 feat: web admin panel + better-sqlite3 migration + Docker fixes
- Added Express.js admin panel on port 3001 (ADMIN_PORT env)
  - Dashboard: stats (users, products, purchases, revenue)
  - Users: list, details, ban/unban toggle
  - Products: CRUD by category
  - Wallets: list with balances
  - Purchases: history with filters
  - Audit log: view audit trail
  - Auth: token-based login with ADMIN_SECRET env var
- Migrated sqlite3 → better-sqlite3
  - database.js: async adapter (runAsync/allAsync/getAsync)
  - purchaseService.js: lastID → lastInsertRowid
  - userService.js: lastID → lastInsertRowid
  - Removed sqlite3 from package.json
- Fixed: dotenv/config import added to index.js
- Fixed: ENCRYPTION_KEY validation (32+ char hex)
- Fixed: Dockerfile multi-stage build (no python needed)
- Fixed: Docker DNS (network: host in build)
- Fixed: docker-compose port 3001, healthcheck on 3001
- Added express, cookie-parser, pino-pretty, better-sqlite3 deps
2026-06-22 10:54:01 +01:00

18 lines
642 B
JavaScript

import { layout, table } from './layout.js';
export function renderWalletList(wallets) {
const headers = ['ID', 'User ID', 'Type', 'Address', 'Balance', 'Created'];
const rows = wallets.map(w => `<tr>
<td>${w.id}</td>
<td><a href="/users/${w.user_id}">${w.user_id}</a></td>
<td>${w.wallet_type}</td>
<td><code>${(w.address || '').slice(0, 16)}...</code></td>
<td>${(w.balance || 0).toFixed(8)}</td>
<td>${w.created_at || '-'}</td>
</tr>`).join('');
const content = table(headers, wallets, () => '')
.replace('<tbody></tbody>', `<tbody>${rows}</tbody>`);
return layout('Wallets', content, 'wallets');
}