From 2055943876a8ea870c85d91c654bd0859312b08d Mon Sep 17 00:00:00 2001 From: gorkem-bwl Date: Fri, 16 Jan 2026 13:10:45 -0500 Subject: [PATCH] fix: make dateRange optional for hardware details endpoint The Joi validation marks dateRange as optional, but the controller was using requireString() which throws a 400 error when dateRange is missing. Changed to optionalString() with "recent" as the default value, matching the behavior of other similar endpoints and the Joi validation schema. --- server/src/controllers/monitorController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/controllers/monitorController.ts b/server/src/controllers/monitorController.ts index d46845026..56a18b6b3 100644 --- a/server/src/controllers/monitorController.ts +++ b/server/src/controllers/monitorController.ts @@ -97,7 +97,7 @@ class MonitorController { await getHardwareDetailsByIdQueryValidation.validateAsync(req.query); const monitorId = requireString(req?.params?.monitorId, "Monitor ID"); - const dateRange = requireString(req?.query?.dateRange, "dateRange"); + const dateRange = optionalString(req?.query?.dateRange, "dateRange") || "recent"; const teamId = requireTeamId(req?.user?.teamId); const monitor = await this.monitorService.getHardwareDetailsById({