Files
Checkmate/Server/controllers/alertController.js
T

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-05-28 11:34:25 -07:00
const express = require("express");
const {} = require("../validation/joi");
const logger = require("../utils/logger");
require("dotenv").config();
2024-05-28 11:39:55 -07:00
const { createAlertParamValidation } = require("../validation/joi");
2024-05-28 11:34:25 -07:00
const SERVICE_NAME = "alerts";
2024-05-28 11:39:55 -07:00
const createAlert = async (req, res, next) => {
try {
await createAlertParamValidation.validateAsync(req.params);
res
.status(200)
.json({ success: true, msg: "Create Alert", data: req.params.monitorId });
} catch (error) {
error.service = SERVICE_NAME;
next(error);
}
2024-05-28 11:34:25 -07:00
};
const getAlertsByUserId = (req, res, next) => {
2024-05-28 11:39:55 -07:00
res.status(200).json({
success: true,
msg: "Get Alerts By UserID",
data: req.params.userId,
});
2024-05-28 11:34:25 -07:00
};
const getAlertsByMonitorId = (req, res, next) => {
res.status(200).json({ success: true, msg: "Get Alerts By MonitorID" });
};
const getAlertById = (req, res, next) => {
res.status(200).json({ success: true, msg: "Get Alert By alertID" });
};
const editAlert = (req, res, next) => {
res.status(200).json({ success: true, msg: "Edit alert" });
};
const deleteAlert = (req, res, next) => {
res.status(200).json({ success: true, msg: "Delete alert" });
};
2024-05-28 11:17:03 -07:00
module.exports = {
createAlert,
getAlertsByUserId,
getAlertsByMonitorId,
getAlertById,
editAlert,
deleteAlert,
};