diff --git a/config/index.js b/config/index.js index 116d59e..c110f4e 100644 --- a/config/index.js +++ b/config/index.js @@ -297,7 +297,7 @@ const mqttOptions = { }; const mqttUrl = 'ws://localhost:1884'; // Ganti dengan broker kamu -const topic = 'morek'; +const topic = process.env.TOPIC_COD ?? 'morek'; const mqttClient = mqtt.connect(mqttUrl, mqttOptions); diff --git a/routes/notification_error.route.js b/routes/notification_error.route.js index 110cd3d..ccd02d0 100644 --- a/routes/notification_error.route.js +++ b/routes/notification_error.route.js @@ -26,7 +26,7 @@ router .get(verifyToken.verifyAccessToken, NotificationErrorController.getById) .put( verifyToken.verifyAccessToken, - verifyAccess(), + // verifyAccess(), NotificationErrorController.update ); diff --git a/routes/notification_error_log.route.js b/routes/notification_error_log.route.js index ce5e0f1..9b746da 100644 --- a/routes/notification_error_log.route.js +++ b/routes/notification_error_log.route.js @@ -7,7 +7,10 @@ const router = express.Router(); router.route("/") .get(verifyToken.verifyAccessToken, NotificationErrorLogController.getAll) - .post(verifyToken.verifyAccessToken, verifyAccess(), NotificationErrorLogController.create); + .post( + verifyToken.verifyAccessToken, + // verifyAccess(), + NotificationErrorLogController.create); router.route("/:id") .get(verifyToken.verifyAccessToken, NotificationErrorLogController.getById); diff --git a/services/notifikasi-wa.service.js b/services/notifikasi-wa.service.js index ee94491..28976f6 100644 --- a/services/notifikasi-wa.service.js +++ b/services/notifikasi-wa.service.js @@ -29,7 +29,7 @@ class NotifikasiWaService { // "c_6501": 0 // } - if (topic === "morek") { + if (topic === process.env.TOPIC_COD ?? "morek") { const dataMqtt = JSON.parse(message); const resultChanel = []; @@ -78,11 +78,9 @@ class NotifikasiWaService { const bodyMessage = `Hai ${dataUser.contact_name || "-"}\n` + - `Terjadi peringatan dengan kode error ${ - errorCode?.error_code || "-" + `Terjadi peringatan dengan kode error ${errorCode?.error_code || "-" } - ${errorCode?.error_code_name || "-"} ` + - `pada device ${ - deviceNotification?.device_name || "-" + `pada device ${deviceNotification?.device_name || "-" }, silahkan cek detail pada link berikut:\n` + `${shortUrl}`;