Files
Checkmate/client/src/Validation/statusPage.ts
T

40 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-02-02 23:46:15 +00:00
import { z } from "zod";
import { STATUS_PAGE_THEMES, STATUS_PAGE_THEME_MODES } from "@/Types/StatusPage";
2026-02-02 23:46:15 +00:00
export const statusPageSchema = z.object({
companyName: z
.string()
.min(1, "Company name is required")
.max(100, "Company name must be at most 100 characters"),
url: z
.string()
.min(1, "URL is required")
.max(50, "URL must be at most 50 characters")
.regex(
/^[a-z0-9-]+$/,
"URL can only contain lowercase letters, numbers, and hyphens"
),
timezone: z.string().optional(),
2026-03-16 17:46:13 -04:00
type: z
.array(z.enum(["uptime", "infrastructure"]))
.min(1, "At least one type is required"),
2026-02-02 23:46:15 +00:00
color: z.string().min(1, "Color is required"),
2026-02-02 23:57:14 +00:00
monitors: z.array(z.string()).min(1, "At least one monitor is required"),
2026-02-02 23:46:15 +00:00
isPublished: z.boolean(),
showCharts: z.boolean(),
showUptimePercentage: z.boolean(),
showAdminLoginLink: z.boolean(),
2026-03-16 17:46:13 -04:00
showInfrastructure: z.boolean(),
2026-02-02 23:46:15 +00:00
customCSS: z.string().optional(),
theme: z.enum(STATUS_PAGE_THEMES).optional(),
themeMode: z.enum(STATUS_PAGE_THEME_MODES).optional(),
2026-02-02 23:46:15 +00:00
logo: z
.object({
data: z.string(),
contentType: z.string(),
})
.nullable()
.optional(),
});
export type StatusPageFormData = z.infer<typeof statusPageSchema>;