Files
MikrotikManager/backend/src/services/ping-probe-configuration.ts
T

10 lines
760 B
TypeScript

import { and, eq } from "drizzle-orm"
import { db } from "../db/index.js"
import { uptimeProbes } from "../db/schema.js"
/** Only configuration participates in a reviewed plan, not collector metadata. */
export async function readPingProbeConfiguration(probeId: string, serverId: number) {
return (await db.select({ id: uptimeProbes.id, srcServerId: uptimeProbes.srcServerId, srcInterface: uptimeProbes.srcInterface, name: uptimeProbes.name, target: uptimeProbes.target, probeFilter: uptimeProbes.probeFilter, enabled: uptimeProbes.enabled, intervalSec: uptimeProbes.intervalSec, showOnDashboard: uptimeProbes.showOnDashboard })
.from(uptimeProbes).where(and(eq(uptimeProbes.id, probeId), eq(uptimeProbes.srcServerId, serverId))).limit(1))[0] ?? null
}