feat(backend): implement all missing endpoints, real analytics queries, and WebSocket server
- Replace stub analytics.repository.ts with real PostgreSQL queries using pg.Pool - Add /api/guilds, /api/config, /api/auth/login, /api/ui-state (GET/POST) - Add /api/review, /api/recordings, /api/analysis/search - Add /api/messages/:id/reanalyze endpoint - Add /api/analytics/heatmap and /api/analytics/topics - Implement media routes (stub responses, backend has no Discord voice client) - Add WebSocket server at /ws with heartbeat and broadcast functions - Fix analytics route paths to match frontend contract (dual paths for backward compat) - Export getPool() from database module for raw SQL queries - Register all new routers in app.ts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
5a094c926a
commit
9b41eb9c12
@@ -0,0 +1,42 @@
|
||||
import type { Request, Response } from "express";
|
||||
import {
|
||||
connectVoice,
|
||||
disconnectVoice,
|
||||
getVoiceChannels,
|
||||
getVoiceStatus,
|
||||
} from "./voice.service.js";
|
||||
|
||||
export async function handleGetVoiceStatus(_req: Request, res: Response) {
|
||||
const status = getVoiceStatus();
|
||||
res.json(status);
|
||||
}
|
||||
|
||||
export async function handleConnectVoice(req: Request, res: Response) {
|
||||
const guildId = Array.isArray(req.body.guildId)
|
||||
? req.body.guildId[0]
|
||||
: req.body.guildId;
|
||||
const channelId = Array.isArray(req.body.channelId)
|
||||
? req.body.channelId[0]
|
||||
: req.body.channelId;
|
||||
if (!guildId || !channelId) {
|
||||
return res.status(400).json({
|
||||
error: "VALIDATION_ERROR",
|
||||
message: "guildId and channelId are required",
|
||||
});
|
||||
}
|
||||
const status = await connectVoice(guildId, channelId);
|
||||
res.json(status);
|
||||
}
|
||||
|
||||
export async function handleDisconnectVoice(_req: Request, res: Response) {
|
||||
const status = await disconnectVoice();
|
||||
res.json(status);
|
||||
}
|
||||
|
||||
export async function handleGetVoiceChannels(req: Request, res: Response) {
|
||||
const guildId = Array.isArray(req.params.guildId)
|
||||
? req.params.guildId[0]
|
||||
: req.params.guildId;
|
||||
const channels = await getVoiceChannels(guildId);
|
||||
res.json(channels);
|
||||
}
|
||||
Reference in New Issue
Block a user