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.
976 B ยท 29 lines
TypeScript
123456789101112131415161718192021222324252627282930import { createInsertSchema, createSelectSchema } from "drizzle-zod";import { z } from "zod";
import { maintenance } from "./maintenance";
export const insertMaintenanceSchema = createInsertSchema(maintenance) .extend({ // REMINDER: trick to make the react-hook-form controlled but not allow empty string title: z.string().min(1, { error: "Required", }), message: z.string().min(1, { error: "Required", }),
monitors: z.number().array().prefault([]).optional(), }) // REMINDER: validate that `from` date is before `to` date .refine((data) => data.from < data.to, { path: ["to"], error: "End date cannot be earlier than start date.", });
export const selectMaintenanceSchema = createSelectSchema(maintenance).extend({ monitors: z.number().array().prefault([]).optional(),});
export type InsertMaintenance = z.infer<typeof insertMaintenanceSchema>;export type Maintenance = z.infer<typeof selectMaintenanceSchema>;