mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-04 15:39:35 -05:00
Revert moving notification check to validation, FE always sends an empty notification array
This commit is contained in:
@@ -225,14 +225,15 @@ const createMonitor = async (req, res, next) => {
|
||||
const notifications = req.body.notifications;
|
||||
const monitor = await req.db.createMonitor(req, res);
|
||||
|
||||
monitor.notifications =
|
||||
notifications &&
|
||||
(await Promise.all(
|
||||
if (notifications && notifications.length > 0) {
|
||||
monitor.notifications = await Promise.all(
|
||||
notifications.map(async (notification) => {
|
||||
notification.monitorId = monitor._id;
|
||||
await req.db.createNotification(notification);
|
||||
return await req.db.createNotification(notification);
|
||||
})
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
await monitor.save();
|
||||
// Add monitor to job queue
|
||||
req.jobQueue.addJob(monitor._id, monitor);
|
||||
|
||||
Reference in New Issue
Block a user