Merge pull request #350 from bluewave-labs/feat/speedcheck-controller

Hook up routes to the controller methods.
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-16 15:10:28 -07:00
commit d574ed94d2
1 file changed
+25 -9
+25 -9
View File
@@ -1,6 +1,11 @@
const router = require("express").Router(); const router = require("express").Router();
const { verifyOwnership } = require("../middleware/verifyOwnership"); const { verifyOwnership } = require("../middleware/verifyOwnership");
const Monitor = require("../models/Monitor"); const Monitor = require("../models/Monitor");
const {
getPageSpeedChecks,
createPageSpeedCheck,
deletePageSpeedCheck,
} = require("../controllers/pageSpeedCheckController");
/** /**
* @route POST /:monitorId * @route POST /:monitorId
@@ -9,9 +14,13 @@ const Monitor = require("../models/Monitor");
* @param {string} monitorId - The ID of the monitor * @param {string} monitorId - The ID of the monitor
* @middleware verifyOwnership - Ensures the user owns the monitor * @middleware verifyOwnership - Ensures the user owns the monitor
*/ */
router.post("/:monitorId", verifyOwnership(Monitor, "monitorId"), () => {
console.log("Create check"); router.post(
}); "/:monitorId",
verifyOwnership(Monitor, "monitorId"),
createPageSpeedCheck
);
/** /**
* @route GET /:monitorId * @route GET /:monitorId
@@ -20,9 +29,12 @@ router.post("/:monitorId", verifyOwnership(Monitor, "monitorId"), () => {
* @param {string} monitorId - The ID of the monitor * @param {string} monitorId - The ID of the monitor
* @middleware verifyOwnership - Ensures the user owns the monitor * @middleware verifyOwnership - Ensures the user owns the monitor
*/ */
router.get("/:monitorId", verifyOwnership(Monitor, "monitorId"), () => {
console.log("Get checks"); router.get(
}); "/:monitorId",
verifyOwnership(Monitor, "monitorId"),
getPageSpeedChecks
);
/** /**
* @route POST /delete/:monitorId * @route POST /delete/:monitorId
@@ -31,8 +43,12 @@ router.get("/:monitorId", verifyOwnership(Monitor, "monitorId"), () => {
* @param {string} monitorId - The ID of the monitor * @param {string} monitorId - The ID of the monitor
* @middleware verifyOwnership - Ensures the user owns the monitor * @middleware verifyOwnership - Ensures the user owns the monitor
*/ */
router.delete("/:monitorId", verifyOwnership(Monitor, "monitorId"), () => {
console.log("Delete checks"); router.delete(
}); "/:monitorId",
verifyOwnership(Monitor, "monitorId"),
deletePageSpeedCheck
);
module.exports = router; module.exports = router;