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.
123456789101112131415161718192021222324252627282930313233343536373839404142import type { IncidentEvent } from "@openstatus/db/src/schema";
import { requireScope } from "../auth";import { type ServiceContext, withTransaction } from "../context";import { appendIncidentEvent, assertMember, assertNotClosed, getIncidentInWorkspace,} from "./internal";import { AddIncidentNoteInput } from "./schemas";
// The audit row is `incident_event.create`, written by `appendIncidentEvent`.// oxlint-disable-next-line openstatus/services-mutation-guardsexport async function addIncidentNote(args: { ctx: ServiceContext; input: AddIncidentNoteInput;}): Promise<IncidentEvent> { const { ctx } = args; requireScope(ctx, "write"); const input = AddIncidentNoteInput.parse(args.input);
return withTransaction(ctx, async (tx) => { const existing = await getIncidentInWorkspace( tx, ctx.workspace.id, input.id, ); assertNotClosed(existing); if (input.createdBy != null) { await assertMember(tx, ctx.workspace.id, input.createdBy); } return appendIncidentEvent(tx, ctx, { incidentId: existing.id, type: "note", message: input.message, createdAt: input.createdAt ?? undefined, createdBy: input.createdBy, }); });}