fix: migration query changes
This commit is contained in:
1 parent
a9e9097a1f
commit
78f5ce180b
3 files changed
+9
-5
No files matched your search
@@ -337,14 +337,14 @@ const CreateMonitorPage = () => {
|
||||
/>
|
||||
<RadioWithDescription
|
||||
value="grpc"
|
||||
label={t("pages.createMonitor.form.type.optionGrpc")}
|
||||
label={t("pages.common.monitors.monitorTypes.optionGrpc")}
|
||||
description={t(
|
||||
"pages.createMonitor.form.type.optionGrpcDescription"
|
||||
)}
|
||||
/>
|
||||
<RadioWithDescription
|
||||
value="websocket"
|
||||
label={t("pages.createMonitor.form.type.optionWebSocket")}
|
||||
label={t("pages.common.monitors.monitorTypes.optionWebSocket")}
|
||||
description={t(
|
||||
"pages.createMonitor.form.type.optionWebSocketDescription"
|
||||
)}
|
||||
|
||||
@@ -20,7 +20,11 @@ export async function migrateStatusPageTypeToArray(): Promise<void> {
|
||||
}
|
||||
|
||||
// Find all status pages where `type` is a string (not yet migrated)
|
||||
const result = await StatusPageModel.updateMany({ type: { $type: "string" } }, [
|
||||
const result = await StatusPageModel.updateMany({
|
||||
$expr: {
|
||||
$eq: [{ $type: "$type" }, "string"], // only scalar string, not existing array
|
||||
}
|
||||
}, [
|
||||
{
|
||||
$set: {
|
||||
type: ["$type"],
|
||||
|
||||
@@ -10,13 +10,13 @@ export const getStatusPageParamValidation = z.object({
|
||||
});
|
||||
|
||||
export const getStatusPageQueryValidation = z.object({
|
||||
type: z.literal("uptime"),
|
||||
type: z.array(z.enum(["uptime", "infrastructure"])),
|
||||
timeFrame: z.coerce.number().optional(),
|
||||
});
|
||||
|
||||
export const createStatusPageBodyValidation = z
|
||||
.object({
|
||||
type: z.literal("uptime"),
|
||||
type: z.array(z.enum(["uptime", "infrastructure"])),
|
||||
companyName: z.string().min(1, "Company name is required"),
|
||||
url: z.string().regex(/^[a-zA-Z0-9_-]+$/, {
|
||||
message: "URL can only contain letters, numbers, underscores, and hyphens",
|
||||
|
||||
Reference in new issue
Block a user