feat(api): expose external_url in monitors POST and PATCH endpoints

The field was already stored in the DB, mapped through the controller,
and present on MonitorRecordTyped — but missing from CreateMonitorRequest
and UpdateMonitorRequest, so the API silently dropped it.
This commit is contained in:
Jorge Hermes
2026-06-24 09:19:22 -03:00
parent 6764b470a9
commit 1889f86e01
4 changed files with 17 additions and 0 deletions
+2
View File
@@ -121,6 +121,7 @@ export interface CreateMonitorRequest {
is_hidden?: string;
confirmation_threshold?: number | null;
monitor_settings_json?: MonitorSettings | null;
external_url?: string | null;
}
export interface CreateMonitorResponse {
@@ -141,6 +142,7 @@ export interface UpdateMonitorRequest {
is_hidden?: string;
confirmation_threshold?: number | null;
monitor_settings_json?: MonitorSettings | null;
external_url?: string | null;
}
export interface UpdateMonitorResponse {
@@ -130,6 +130,7 @@ export const POST: RequestHandler = async ({ request }) => {
is_hidden: body.is_hidden ?? "NO",
confirmation_threshold: confirmationThreshold,
monitor_settings_json: body.monitor_settings_json ? JSON.stringify(body.monitor_settings_json) : null,
external_url: body.external_url ?? null,
};
await db.insertMonitor(monitorData);
@@ -79,6 +79,7 @@ export const PATCH: RequestHandler = async ({ locals, request }) => {
updateData.monitor_type = body.monitor_type !== undefined ? body.monitor_type : existingMonitor.monitor_type;
updateData.is_hidden = body.is_hidden !== undefined ? body.is_hidden : existingMonitor.is_hidden;
updateData.external_url = body.external_url !== undefined ? body.external_url : existingMonitor.external_url;
if (body.confirmation_threshold === null) {
// Explicit null resets the grace period to the default (1 = off); undefined keeps the existing value.
+13
View File
@@ -1834,6 +1834,9 @@
"monitor_settings_json": {
"type": "object",
"additionalProperties": true
},
"external_url": {
"type": "string"
}
},
"additionalProperties": false
@@ -1892,6 +1895,16 @@
"type": "null"
}
]
},
"external_url": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false