- Added `vendor/discord-video-stream` to pnpm workspace. - Refactored `llmModerationClient.ts` for better readability and consistency. - Adjusted imports in `recordingsRoutes.ts` for clarity. - Updated `webserver.ts` to correctly import `createRecordingsRoutes`. - Enhanced test cases in `llmModerationClient.test.ts` for improved readability. - Updated submodule references for `better-sqlite3`, `discord-video-stream`, `discord.js-selfbot-v13`, `drizzle-orm`, and `node-datachannel`. - Created documentation for deprecated dependency removal plan and design.
40 lines
955 B
TypeScript
40 lines
955 B
TypeScript
import {
|
|
type NextFunction,
|
|
type Request,
|
|
type Response,
|
|
Router,
|
|
} from "express";
|
|
import { listVoiceRecordings } from "../database/voiceRecordingRepo";
|
|
import { AppError } from "../errors";
|
|
import { createChildLogger } from "../logger";
|
|
|
|
const logger = createChildLogger("recordings-routes");
|
|
|
|
export function createRecordingsRoutes(): Router {
|
|
const router = Router();
|
|
|
|
router.get(
|
|
"/recordings",
|
|
async (_req: Request, res: Response, next: NextFunction) => {
|
|
try {
|
|
const recordings = await listVoiceRecordings(100);
|
|
res.json(recordings);
|
|
} catch (error) {
|
|
logger.error(
|
|
{ error: error instanceof Error ? error.message : String(error) },
|
|
"Failed to list recordings",
|
|
);
|
|
next(
|
|
new AppError(
|
|
"DATABASE_ERROR",
|
|
"Failed to retrieve voice recordings",
|
|
500,
|
|
),
|
|
);
|
|
}
|
|
},
|
|
);
|
|
|
|
return router;
|
|
}
|