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

Setting up the controller module for speed check.
This commit is contained in:
Alexander Holliday
2024-07-16 10:56:42 -07:00
committed by GitHub

View File

@@ -0,0 +1,60 @@
const PageSpeedCheck = require("../models/PageSpeedCheck");
const { successMessages } = require("../utils/messages");
const SERVICE_NAME = "pagespeed";
/**
* Gets all PageSpeedChecks for a monitor
* @async
* @param {Express.Request} req - The request object
* @param {Express.Response} res - The response object
* @param {Function} next - The next middleware function
* @returns {Promise<Express.Response>}
*/
const getPageSpeedChecks = async (req, res, next) => {
try {
return res.status(200).json({ msg: "Hit getPageSpeedChecks" });
} catch (error) {
error.service = SERVICE_NAME;
next(error);
}
};
/**
* Creates a new PageSpeedCheck for a monitor
* @async
* @param {Express.Request} req - The request object
* @param {Express.Response} res - The response object
* @param {Function} next - The next middleware function
* @returns {Promise<Express.Response>}
*/
const createPageSpeedCheck = async (req, res, next) => {
try {
return res.status(200).json({ msg: "Hit createPageSpeedCheck" });
} catch (error) {
error.service = SERVICE_NAME;
next(error);
}
};
/**
* Deletes all PageSpeedChecks for a monitor
* @async
* @param {Express.Request} req - The request object
* @param {Express.Response} res - The response object
* @param {Function} next - The next middleware function
* @returns {Promise<Express.Response>}
*/
const deletePageSpeedCheck = async (req, res, next) => {
try {
return res.status(200).json({ msg: "Hit deletePageSpeedCheck" });
} catch (error) {
error.service = SERVICE_NAME;
next(error);
}
};
module.exports = {
getPageSpeedChecks,
createPageSpeedCheck,
deletePageSpeedCheck,
};