chore(auto): task completed - unknown
This commit is contained in:
@@ -42,9 +42,11 @@ export class DashboardRepository {
|
|||||||
|
|
||||||
// Top channels by message count
|
// Top channels by message count
|
||||||
const topChannels = await pool.query(`
|
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
|
FROM messages
|
||||||
GROUP BY channel_id
|
GROUP BY channel_id, (metadata::jsonb -> 'channel' ->> 'channelName')
|
||||||
ORDER BY COUNT(*) DESC
|
ORDER BY COUNT(*) DESC
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
`);
|
`);
|
||||||
@@ -63,6 +65,7 @@ export class DashboardRepository {
|
|||||||
active_users_24h: msgRow?.active_users_24h ?? 0,
|
active_users_24h: msgRow?.active_users_24h ?? 0,
|
||||||
top_channels: topChannels.rows.map((r: Record<string, unknown>) => ({
|
top_channels: topChannels.rows.map((r: Record<string, unknown>) => ({
|
||||||
channel_id: String(r.channel_id),
|
channel_id: String(r.channel_id),
|
||||||
|
channel_name: r.channel_name ? String(r.channel_name) : null,
|
||||||
message_count: Number(r.message_count),
|
message_count: Number(r.message_count),
|
||||||
})),
|
})),
|
||||||
moderation_overview: {
|
moderation_overview: {
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ export function DashboardStatsContent() {
|
|||||||
key={ch.channel_id}
|
key={ch.channel_id}
|
||||||
className="flex items-center justify-between rounded-lg bg-muted/50 px-3 py-2 text-sm"
|
className="flex items-center justify-between rounded-lg bg-muted/50 px-3 py-2 text-sm"
|
||||||
>
|
>
|
||||||
<span className="truncate font-mono text-xs text-muted-foreground">
|
<span className="truncate text-xs text-muted-foreground">
|
||||||
#{ch.channel_id}
|
#{ch.channel_name ?? ch.channel_id}
|
||||||
</span>
|
</span>
|
||||||
<span className="ml-2 shrink-0 font-medium">
|
<span className="ml-2 shrink-0 font-medium">
|
||||||
{ch.message_count.toLocaleString()}
|
{ch.message_count.toLocaleString()}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ export interface DashboardStats {
|
|||||||
today_messages: number;
|
today_messages: number;
|
||||||
today_flagged: number;
|
today_flagged: number;
|
||||||
active_users_24h: 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: {
|
moderation_overview: {
|
||||||
pending: number;
|
pending: number;
|
||||||
processing: number;
|
processing: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user