fix(api): handle score monitors in name-based lookups
Score monitors have type='score' and ip_version=NULL, but the GetMonitorByNameAndIPVersion query required ip_version to match. This broke monitor lookups by name for score monitors. Modified query to match either: - Regular monitors with specified ip_version - Score monitors with NULL ip_version Fixes issue reported by Ben Harris at: https://community.ntppool.org/t/monitor-recentmedian-no-longer-works/4002
This commit is contained in:
@@ -16,7 +16,7 @@ const getMonitorByNameAndIPVersion = `-- name: GetMonitorByNameAndIPVersion :one
|
||||
select id, id_token, type, user_id, account_id, hostname, location, ip, ip_version, tls_name, api_key, status, config, client_version, last_seen, last_submit, created_on, deleted_on, is_current from monitors
|
||||
where
|
||||
tls_name like ? AND
|
||||
ip_version = ? AND
|
||||
(ip_version = ? OR (type = 'score' AND ip_version IS NULL)) AND
|
||||
is_current = 1 AND
|
||||
status != 'deleted'
|
||||
order by id
|
||||
|
||||
Reference in New Issue
Block a user