status page pagination

This commit is contained in:
Alex Holliday committed 2025-12-11 18:41:38 +00:00
1 parent b6a3d1e34d
commit fe03451393
8 files changed
+222 -85

No files matched your search

+54
View File
@@ -672,3 +672,57 @@ export const updateRetentionPolicySchema = z.object({
.min(1, "Retention days must be at least 1")
.max(365, "Retention days cannot exceed 365 days"),
});
export const statusPageQuerySchema = z.object({
page: z
.string()
.optional()
.transform((val, ctx) => {
const num = Number(val);
if (!val) return;
if (Number.isNaN(num)) {
ctx.addIssue({
code: "custom",
message: "page must be a number",
});
return z.NEVER;
}
if (num < 0) {
ctx.addIssue({
code: "custom",
message: "page must greater than 0",
});
return z.NEVER;
}
return num;
}),
rowsPerPage: z
.string()
.optional()
.transform((val, ctx) => {
if (!val) return;
const num = Number(val);
if (Number.isNaN(num)) {
ctx.addIssue({
code: "custom",
message: "rowsPerPage must be a number",
});
return z.NEVER;
}
if (num < 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",
});
return z.NEVER;
}
return num;
}),
});