- discord-gateway: 74 lint errors -> 0 (format, import sorting, unused imports/vars, dead breath var) - backend: format + sort imports (11 warnings left: noExplicitAny) - frontend: remove unused imports, drop dead breathing var, fix useExhaustiveDependencies (scroll keyed on messages), a11y biome-ignore for drag surface + stopPropagation container (mouse-only gestures) - remaining warnings are false positives: index keys on static lists, <img> in static export (next/image unsupported), noExplicitAny tsc --noEmit clean on all 3 services; vitest green (60+36).
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import type { Request, Response } from "express";
|
|
import { createChildLogger } from "@/shared/logger/index";
|
|
import { asyncHandler } from "../../shared/middlewares/index.js";
|
|
import { publishCommandNoReply } from "../../shared/redis/index.js";
|
|
import type { ConnectVoiceInput, VoiceCommandInput } from "./voice.schema.js";
|
|
import {
|
|
connectVoice,
|
|
disconnectVoice,
|
|
getVoiceStatus,
|
|
} from "./voice.service.js";
|
|
|
|
const logger = createChildLogger("voice.controller");
|
|
|
|
export const handleGetVoiceStatus = asyncHandler(
|
|
async (_req: Request, res: Response) => {
|
|
const status = await getVoiceStatus();
|
|
res.json(status);
|
|
},
|
|
);
|
|
|
|
export const handleConnectVoice = asyncHandler(
|
|
async (req: Request, res: Response) => {
|
|
const { guildId, channelId } = req.body as ConnectVoiceInput;
|
|
logger.debug({ guildId, channelId }, "Connecting to voice channel");
|
|
const status = await connectVoice(guildId, channelId);
|
|
res.json(status);
|
|
},
|
|
);
|
|
|
|
export const handleDisconnectVoice = asyncHandler(
|
|
async (_req: Request, res: Response) => {
|
|
logger.debug("Disconnecting from voice");
|
|
const status = await disconnectVoice();
|
|
res.json(status);
|
|
},
|
|
);
|
|
|
|
export const handleVoiceCommand = asyncHandler(
|
|
async (req: Request, res: Response) => {
|
|
const { command } = req.body as VoiceCommandInput;
|
|
logger.debug({ command }, "Publishing voice command");
|
|
await publishCommandNoReply(command);
|
|
res.json({ success: true, command });
|
|
},
|
|
);
|