fix: players mrr_value parsing and audit log column names
FIXES: 1. Players: mrr_value is decimal type, needs parseFloat() before toFixed() 2. Audit Log: Use SELECT * to handle any column name variations Signed-off-by: Claude (Chronicler #57) <claude@firefrostgaming.com>
This commit is contained in:
@@ -248,7 +248,7 @@ router.get('/players/table', isAdmin, async (req, res) => {
|
||||
<td class="px-4 py-3">
|
||||
<span class="text-sm font-medium ${statusColor}">${row.status}</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm text-right dark:text-white">$${(row.mrr_value || 0).toFixed(2)}</td>
|
||||
<td class="px-4 py-3 text-sm text-right dark:text-white">$${parseFloat(row.mrr_value || 0).toFixed(2)}</td>
|
||||
<td class="px-4 py-3 text-sm text-right text-gray-500 dark:text-gray-400">${date.toLocaleDateString()}</td>
|
||||
</tr>
|
||||
`;
|
||||
@@ -327,7 +327,7 @@ router.get('/audit/feed', isAdmin, async (req, res) => {
|
||||
|
||||
try {
|
||||
const result = await pool.query(`
|
||||
SELECT event_id, event_type, processed_at
|
||||
SELECT *
|
||||
FROM webhook_events_processed
|
||||
ORDER BY processed_at DESC
|
||||
LIMIT 50
|
||||
@@ -344,16 +344,18 @@ router.get('/audit/feed', isAdmin, async (req, res) => {
|
||||
let html = '<div class="divide-y divide-gray-200 dark:divide-gray-700">';
|
||||
result.rows.forEach(row => {
|
||||
const timestamp = new Date(row.processed_at);
|
||||
const eventColor = row.event_type.includes('succeeded') ? 'text-green-600' :
|
||||
row.event_type.includes('failed') ? 'text-red-600' :
|
||||
row.event_type.includes('dispute') ? 'text-red-600' :
|
||||
const eventType = row.event_type || 'unknown';
|
||||
const eventId = row.stripe_event_id || row.id || 'unknown';
|
||||
const eventColor = eventType.includes('succeeded') ? 'text-green-600' :
|
||||
eventType.includes('failed') ? 'text-red-600' :
|
||||
eventType.includes('dispute') ? 'text-red-600' :
|
||||
'text-blue-600';
|
||||
html += `
|
||||
<div class="p-4 hover:bg-gray-50 dark:hover:bg-gray-800">
|
||||
<div class="flex justify-between items-start">
|
||||
<div class="flex-1">
|
||||
<div class="font-mono text-xs text-gray-500 mb-1">${row.event_id}</div>
|
||||
<div class="font-medium ${eventColor}">${row.event_type}</div>
|
||||
<div class="font-mono text-xs text-gray-500 mb-1">${eventId}</div>
|
||||
<div class="font-medium ${eventColor}">${eventType}</div>
|
||||
</div>
|
||||
<div class="text-right text-sm text-gray-500 dark:text-gray-400">
|
||||
${timestamp.toLocaleString()}
|
||||
|
||||
Reference in New Issue
Block a user