From dcede1d6762c14737f519bdc1ddec62e9cbf8bcc Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Sat, 13 Jun 2026 12:11:37 +0700 Subject: [PATCH] chore(auto): task completed - unknown --- .../backend/src/modules/dashboard/dashboard.repository.ts | 7 +++++-- .../src/features/dashboard/components/DashboardStats.tsx | 4 ++-- services/frontend/src/shared/api/client.ts | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/services/backend/src/modules/dashboard/dashboard.repository.ts b/services/backend/src/modules/dashboard/dashboard.repository.ts index ef94079..229f9ef 100644 --- a/services/backend/src/modules/dashboard/dashboard.repository.ts +++ b/services/backend/src/modules/dashboard/dashboard.repository.ts @@ -42,9 +42,11 @@ export class DashboardRepository { // Top channels by message count const topChannels = await pool.query(` - SELECT channel_id, COUNT(*)::int AS message_count + SELECT channel_id, + (metadata::jsonb -> 'channel' ->> 'channelName') AS channel_name, + COUNT(*)::int AS message_count FROM messages - GROUP BY channel_id + GROUP BY channel_id, (metadata::jsonb -> 'channel' ->> 'channelName') ORDER BY COUNT(*) DESC LIMIT 10 `); @@ -63,6 +65,7 @@ export class DashboardRepository { active_users_24h: msgRow?.active_users_24h ?? 0, top_channels: topChannels.rows.map((r: Record) => ({ channel_id: String(r.channel_id), + channel_name: r.channel_name ? String(r.channel_name) : null, message_count: Number(r.message_count), })), moderation_overview: { diff --git a/services/frontend/src/features/dashboard/components/DashboardStats.tsx b/services/frontend/src/features/dashboard/components/DashboardStats.tsx index ff1518c..d4011f8 100644 --- a/services/frontend/src/features/dashboard/components/DashboardStats.tsx +++ b/services/frontend/src/features/dashboard/components/DashboardStats.tsx @@ -161,8 +161,8 @@ export function DashboardStatsContent() { key={ch.channel_id} className="flex items-center justify-between rounded-lg bg-muted/50 px-3 py-2 text-sm" > - - #{ch.channel_id} + + #{ch.channel_name ?? ch.channel_id} {ch.message_count.toLocaleString()} diff --git a/services/frontend/src/shared/api/client.ts b/services/frontend/src/shared/api/client.ts index f14ad6e..a0f8ce8 100644 --- a/services/frontend/src/shared/api/client.ts +++ b/services/frontend/src/shared/api/client.ts @@ -281,7 +281,7 @@ export interface DashboardStats { today_messages: number; today_flagged: number; active_users_24h: number; - top_channels: Array<{ channel_id: string; message_count: number }>; + top_channels: Array<{ channel_id: string; channel_name: string | null; message_count: number }>; moderation_overview: { pending: number; processing: number;