This commit is contained in:
Alex Holliday committed 2026-01-05 17:58:47 +00:00
1 parent e62e4898b9
commit 36cdb20dfc
17 files changed
+159 -594

No files matched your search

+9 -4
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import mongoose from "mongoose";
import { MonitorStatuses } from "@/db/models/index.js";
import { MonitorStatuses } from "@/types/domain/index.js";
export const checksStatusIdQuerySchema = z.object({
status: z.enum(MonitorStatuses, { error: "Invalid status" }),
@@ -29,15 +29,20 @@ export const checksStatusIdQuerySchema = z.object({
return z.NEVER;
}
if (num < 0) {
ctx.addIssue({ code: "custom", message: "rowsPerPage must be greater than 0" });
ctx.addIssue({
code: "custom",
message: "rowsPerPage must be greater than 0",
});
return z.NEVER;
}
if (num > 100) {
ctx.addIssue({ code: "custom", message: "rowsPerPage must be less than or equal to 100" });
ctx.addIssue({
code: "custom",
message: "rowsPerPage must be less than or equal to 100",
});
return z.NEVER;
}
return num;
}),
range: z.string().min(1),
});
+5 -3
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { MonitorTypes } from "@/db/models/index.js";
import { MonitorTypes } from "@/types/domain/index.js";
import { urlRegex } from "./common.js";
export const monitorSchema = z
@@ -43,7 +43,10 @@ export const monitorSchema = z
});
}
if ((data.type === "infrastructure" || data.type === "docker") && !data.secret) {
if (
(data.type === "infrastructure" || data.type === "docker") &&
!data.secret
) {
ctx.addIssue({
code: "custom",
message: `Secret is required for ${data.type} monitors`,
@@ -118,4 +121,3 @@ export const monitorPatchSchema = monitorSchema
});
}
});