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.
2.4 kB ยท 59 lines
TypeScript
at incident-api
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import { z } from "zod";
/** * `ListMaintenancesInput.period` mirrors the periods supported by the * existing tRPC router. Duplicated from status-report/schemas โ a single * shared `periods` constant is a worthwhile follow-up once a third domain * needs it. */export const maintenanceListPeriods = ["1d", "7d", "14d"] as const;export type MaintenanceListPeriod = (typeof maintenanceListPeriods)[number];export const maintenanceListPeriodSchema = z.enum(maintenanceListPeriods);
export const CreateMaintenanceInput = z .object({ title: z.string().trim().min(1).max(256), message: z.string().min(1), from: z.coerce.date(), to: z.coerce.date(), pageId: z.number().int(), pageComponentIds: z.array(z.number().int()).default([]), }) .refine((v) => v.from < v.to, { path: ["to"], error: "End date must be after start date.", });export type CreateMaintenanceInput = z.infer<typeof CreateMaintenanceInput>;
export const UpdateMaintenanceInput = z.object({ id: z.number().int(), title: z.string().trim().min(1).max(256).optional(), message: z.string().min(1).optional(), from: z.coerce.date().optional(), to: z.coerce.date().optional(), /** When provided, replaces the full association set (empty array clears). */ pageComponentIds: z.array(z.number().int()).optional(),});export type UpdateMaintenanceInput = z.infer<typeof UpdateMaintenanceInput>;
export const DeleteMaintenanceInput = z.object({ id: z.number().int() });export type DeleteMaintenanceInput = z.infer<typeof DeleteMaintenanceInput>;
export const GetMaintenanceInput = z.object({ id: z.number().int() });export type GetMaintenanceInput = z.infer<typeof GetMaintenanceInput>;
// `limit` is intentionally unbounded at the schema level โ matches the// status-report convention. Connect caps externally; tRPC passes a sentinel.export const ListMaintenancesInput = z.object({ limit: z.number().int().min(1).default(50), offset: z.number().int().min(0).default(0), pageId: z.number().int().optional(), period: maintenanceListPeriodSchema.optional(), order: z.enum(["asc", "desc"]).default("desc"),});export type ListMaintenancesInput = z.infer<typeof ListMaintenancesInput>;
export const NotifyMaintenanceInput = z.object({ maintenanceId: z.number().int(),});export type NotifyMaintenanceInput = z.infer<typeof NotifyMaintenanceInput>;