feat: implement reminder functionality and enhance notification service with logging

This commit is contained in:
2026-04-29 15:32:03 +07:00
parent 51f4ea2bff
commit a2a64a972f
8 changed files with 443 additions and 9 deletions

7
app.js
View File

@@ -9,7 +9,7 @@ const compression = require("compression");
const unknownEndpoint = require("./middleware/unKnownEndpoint");
const { handleError } = require("./helpers/error");
const { checkConnection, mqttClient } = require("./config");
const { onNotification } = require("./services/notifikasi-wa.service");
const notifikasiWaService = require("./services/notifikasi-wa.service");
const app = express();
@@ -51,7 +51,10 @@ app.use(handleError);
// Saat pesan diterima
mqttClient.on('message', (topic, message) => {
console.log(`Received message on topic "${topic}":`, message.toString());
onNotification(topic, message);
notifikasiWaService.onNotification(topic, message);
notifikasiWaService.onNotificationReminder(topic, message);
});
notifikasiWaService.runReminder();
module.exports = app;