Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
703 B ยท 26 lines
TypeScript
at main
123456789101112131415161718192021222324252627import { and, eq } from "@openstatus/db";import { monitorIncidentTable } from "@openstatus/db/src/schema";
import type { DB } from "../context";import { NotFoundError } from "../errors";
/** Load an incident by id, scoped to the workspace. Throws on miss. */export async function getMonitorIncidentInWorkspace(args: { tx: DB; id: number; workspaceId: number;}) { const { tx, id, workspaceId } = args; const row = await tx .select() .from(monitorIncidentTable) .where( and( eq(monitorIncidentTable.id, id), eq(monitorIncidentTable.workspaceId, workspaceId), ), ) .get(); if (!row) throw new NotFoundError("incident", id); return row;}