maintenance

This commit is contained in:
Alex Holliday committed 2025-12-28 19:12:35 +00:00
1 parent e55ae64222
commit 24cbcec2c9
10 files changed
+40 -51

No files matched your search

+1
View File
@@ -6,3 +6,4 @@ export * from "./pagespeed";
export * from "./infra";
export * from "./utils";
export * from "./notification-channel";
export * from "./maintenance";
+29
View File
@@ -0,0 +1,29 @@
import { z } from "zod";
import { MaintenanceRepeats } from "@/types/maintenance";
export const maintenanceSchema = z
.object({
name: z.string().min(1, "Maintenance name is required"),
repeat: z.enum(MaintenanceRepeats),
startTime: z.date(),
endTime: z.date(),
monitors: z.array(z.string()),
})
.superRefine((data, ctx) => {
if (data.endTime <= data.startTime) {
ctx.addIssue({
code: "custom",
path: ["endTime"],
message: "End time must be after start time",
});
}
if (data.startTime === data.endTime) {
ctx.addIssue({
code: "custom",
path: ["endTime"],
message: "Start time and end time cannot be the same",
});
}
});
-28
View File
@@ -39,34 +39,6 @@ export const inviteSchema = z.object({
orgRoleId: z.string().optional(),
});
// moved to client/src/validation/notification-channel.ts
export const maintenanceSchema = z
.object({
name: z.string().min(1, "Maintenance name is required"),
repeat: z.enum(MaintenanceRepeats),
startTime: z.date(),
endTime: z.date(),
monitors: z.array(z.string()),
})
.superRefine((data, ctx) => {
if (data.endTime <= data.startTime) {
ctx.addIssue({
code: "custom",
path: ["endTime"],
message: "End time must be after start time",
});
}
if (data.startTime === data.endTime) {
ctx.addIssue({
code: "custom",
path: ["endTime"],
message: "Start time and end time cannot be the same",
});
}
});
export const systemSettingsSchema = z.object({
systemEmailHost: optionalString(
z.string().trim().min(1, { message: "SMTP host is required" }).max(255, {