style: fix Biome dead-code warnings from oRPC migration (CI lint gate)

This commit is contained in:
asepharyana
2026-08-16 14:51:47 +07:00
parent 726a8e116b
commit 38bda66933
7 changed files with 37 additions and 31 deletions
+26 -21
View File
@@ -5,8 +5,17 @@ import { chatRequestSchema } from "../modules/chatbot/chatbot.schema";
import { chatbotService } from "../modules/chatbot/chatbot.service";
// ── Service imports ──────────────────────────────────────────────
import { dashboardService } from "../modules/dashboard/dashboard.service";
import { mediaLoopSchema, mediaQueueSchema } from "../modules/media/media.schema";
import { getStatus, queue, setLoop, skip, stop } from "../modules/media/media.service";
import {
mediaLoopSchema,
mediaQueueSchema,
} from "../modules/media/media.schema";
import {
getStatus,
queue,
setLoop,
skip,
stop,
} from "../modules/media/media.service";
import { messageQuerySchema } from "../modules/messages/messages.schema";
import { messagesService } from "../modules/messages/messages.service";
import { moderationService } from "../modules/moderation/moderation.service";
@@ -27,7 +36,9 @@ import { publishCommandNoReply } from "../shared/redis/index";
const dashboardRouter = {
stats: os.handler(() => dashboardService.getStats()),
activity: os
.input(z.object({ days: z.coerce.number().int().min(1).max(90).default(14) }))
.input(
z.object({ days: z.coerce.number().int().min(1).max(90).default(14) }),
)
.handler(({ input }) => dashboardService.getActivity(input.days)),
users: os
.input(
@@ -152,12 +163,10 @@ const moderationRouter = {
// ── Media ────────────────────────────────────────────────────────
const mediaRouter = {
status: os.handler(() => getStatus()),
queue: os
.input(mediaQueueSchema)
.handler(async ({ input }) => {
await queue(input.source, input.mode);
return getStatus();
}),
queue: os.input(mediaQueueSchema).handler(async ({ input }) => {
await queue(input.source, input.mode);
return getStatus();
}),
skip: os.handler(async () => {
await skip();
return getStatus();
@@ -166,12 +175,10 @@ const mediaRouter = {
await stop();
return getStatus();
}),
loop: os
.input(mediaLoopSchema)
.handler(async ({ input }) => {
await setLoop(input.loop);
return getStatus();
}),
loop: os.input(mediaLoopSchema).handler(async ({ input }) => {
await setLoop(input.loop);
return getStatus();
}),
};
// ── Voice ─────────────────────────────────────────────────────────
@@ -220,12 +227,10 @@ const recordingsRouter = {
cursor: input.cursor,
}),
),
delete: os
.input(z.object({ id: z.string() }))
.handler(async ({ input }) => {
await recordingsService.deleteById(input.id);
return { ok: true };
}),
delete: os.input(z.object({ id: z.string() })).handler(async ({ input }) => {
await recordingsService.deleteById(input.id);
return { ok: true };
}),
};
// ── Analysis (search) ──────────────────────────────────────────────
+4 -2
View File
@@ -1,7 +1,7 @@
import type { IncomingMessage, Server } from "node:http";
import type { Duplex } from "node:stream";
import { RPCHandler } from "@orpc/server/ws";
import { onError } from "@orpc/server";
import { RPCHandler } from "@orpc/server/ws";
import { WebSocketServer } from "ws";
import { createChildLogger } from "@/shared/logger/index";
import { appRouter } from "./router";
@@ -24,7 +24,9 @@ const logger = createChildLogger("orpc.ws");
*/
export function createORPCWebSocketServer(server: Server): WebSocketServer {
const handler = new RPCHandler(appRouter, {
interceptors: [onError((error) => logger.error({ error }, "oRPC WS error"))],
interceptors: [
onError((error) => logger.error({ error }, "oRPC WS error")),
],
});
const wss = new WebSocketServer({ noServer: true, perMessageDeflate: false });