From e1228a01430413e9f87d6dd0c3b86701277a8035 Mon Sep 17 00:00:00 2001 From: M M Date: Fri, 19 Jul 2024 12:52:16 -0700 Subject: [PATCH] updated validation schema for the controller. --- Server/controllers/pageSpeedCheckController.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Server/controllers/pageSpeedCheckController.js b/Server/controllers/pageSpeedCheckController.js index 937b63ebf..c9f5873bc 100644 --- a/Server/controllers/pageSpeedCheckController.js +++ b/Server/controllers/pageSpeedCheckController.js @@ -4,6 +4,7 @@ const SERVICE_NAME = "pagespeed"; const { getPageSpeedCheckParamValidation, createPageSpeedCheckParamValidation, + createPageSpeedCheckBodyValidation, deletePageSpeedCheckParamValidation, } = require("../validation/joi"); @@ -39,11 +40,14 @@ const getPageSpeedChecks = async (req, res, next) => { */ const createPageSpeedCheck = async (req, res, next) => { try { - // Validate monitorId parameter and request body + // Validate monitorId parameter + await createPageSpeedCheckParamValidation.validateAsync(req.params); + + // Validate request body + await createPageSpeedCheckBodyValidation.validateAsync(req.body); + const { monitorId } = req.params; const { accessibility, bestPractices, seo, performance } = req.body; - - await createPageSpeedCheckParamValidation.validateAsync({ monitorId, accessibility, bestPractices, seo, performance }); const newPageSpeedCheck = new PageSpeedCheck({ monitorId,