remove old notificaiton code
This commit is contained in:
1 parent
b825e0fef4
commit
a0de1e3c72
1 file changed
+2
-14
@@ -500,14 +500,6 @@ const getMonitorById = async (monitorId) => {
|
|||||||
error.status = 404;
|
error.status = 404;
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
// Get notifications
|
|
||||||
const notifications = await Notification.find({
|
|
||||||
monitorId: monitorId,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update monitor with notifications and save
|
|
||||||
monitor.notifications = notifications;
|
|
||||||
await monitor.save();
|
|
||||||
|
|
||||||
return monitor;
|
return monitor;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -664,10 +656,8 @@ const getMonitorsWithChecksByTeamId = async (req) => {
|
|||||||
const createMonitor = async (req, res) => {
|
const createMonitor = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const monitor = new Monitor({ ...req.body });
|
const monitor = new Monitor({ ...req.body });
|
||||||
// Remove notifications fom monitor as they aren't needed here
|
const saved = await monitor.save();
|
||||||
monitor.notifications = undefined;
|
return saved;
|
||||||
await monitor.save();
|
|
||||||
return monitor;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.service = SERVICE_NAME;
|
error.service = SERVICE_NAME;
|
||||||
error.method = "createMonitor";
|
error.method = "createMonitor";
|
||||||
@@ -764,8 +754,6 @@ const deleteMonitorsByUserId = async (userId) => {
|
|||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
*/
|
*/
|
||||||
const editMonitor = async (candidateId, candidateMonitor) => {
|
const editMonitor = async (candidateId, candidateMonitor) => {
|
||||||
candidateMonitor.notifications = undefined;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const editedMonitor = await Monitor.findByIdAndUpdate(candidateId, candidateMonitor, {
|
const editedMonitor = await Monitor.findByIdAndUpdate(candidateId, candidateMonitor, {
|
||||||
new: true,
|
new: true,
|
||||||
|
|||||||
Reference in new issue
Block a user