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.
1.2 kB ยท 40 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041import { eq } from "@openstatus/db";import { pageComponentGroup } from "@openstatus/db/src/schema";
import { emitAudit } from "../audit";import { requireScope } from "../auth";import { type ServiceContext, withTransaction } from "../context";import { getGroupInWorkspace } from "./internal";import { DeletePageComponentGroupInput } from "./schemas";
/** * Hard-delete a group. Member components survive with `group_id` reset to * NULL (FK `ON DELETE SET NULL`) โ they fall back to the ungrouped list. */export async function deletePageComponentGroup(args: { ctx: ServiceContext; input: DeletePageComponentGroupInput;}): Promise<void> { const { ctx } = args; requireScope(ctx, "write"); const input = DeletePageComponentGroupInput.parse(args.input);
await withTransaction(ctx, async (tx) => { const existing = await getGroupInWorkspace({ tx, id: input.id, workspaceId: ctx.workspace.id, });
await tx .delete(pageComponentGroup) .where(eq(pageComponentGroup.id, existing.id));
await emitAudit(tx, ctx, { action: "page_component_group.delete", entityType: "page_component_group", entityId: existing.id, before: existing, }); });}