mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-04-25 02:18:21 -05:00
Implement inserting notifications when a monitor is created, update validation
This commit is contained in:
@@ -30,7 +30,6 @@ const getAllMonitors = async (req, res) => {
|
||||
*/
|
||||
const getMonitorById = async (req, res) => {
|
||||
try {
|
||||
|
||||
const { monitorId } = req.params;
|
||||
let { status, limit, sortOrder } = req.query;
|
||||
|
||||
@@ -140,6 +139,8 @@ const getMonitorsByUserId = async (req, res) => {
|
||||
const createMonitor = async (req, res) => {
|
||||
try {
|
||||
const monitor = new Monitor({ ...req.body });
|
||||
// Remove notifications fom monitor as they aren't needed here
|
||||
delete monitor.notifications;
|
||||
monitor.userId = req.user._id;
|
||||
await monitor.save();
|
||||
return monitor;
|
||||
|
||||
Reference in New Issue
Block a user