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.5 kB ยท 49 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import { createInsertSchema, createSelectSchema } from "drizzle-zod";import { z } from "zod";
import { pageComponentImpact } from "./constants";import { pageComponent, statusReportUpdateToPageComponents,} from "./page_components";
export const selectPageComponentSchema = createSelectSchema(pageComponent);
export const insertPageComponentSchema = createInsertSchema(pageComponent, { name: z.string().min(1),}).refine( (data) => { // monitorId must be set when type='monitor' if (data.type === "monitor" && !data.monitorId) { return false; } // monitorId must be null when type='static' if (data.type === "static" && data.monitorId) { return false; } return true; }, { message: "monitorId must be set when type is 'monitor' and must be null when type is 'static'", },);
export type InsertPageComponent = z.infer<typeof insertPageComponentSchema>;export type PageComponent = z.infer<typeof selectPageComponentSchema>;
export const pageComponentImpactSchema = z.enum(pageComponentImpact);
export const selectStatusReportUpdateToPageComponentSchema = createSelectSchema( statusReportUpdateToPageComponents, { impact: pageComponentImpactSchema },);
export const insertStatusReportUpdateToPageComponentSchema = createInsertSchema( statusReportUpdateToPageComponents, { impact: pageComponentImpactSchema },);
export type StatusReportUpdateToPageComponent = z.infer< typeof selectStatusReportUpdateToPageComponentSchema>;