From 3d53bf47020ebfcce024a6549dbc0142ba97b829 Mon Sep 17 00:00:00 2001 From: Muhammad Afif Date: Wed, 3 Jun 2026 15:08:55 +0700 Subject: [PATCH] fix: is_send & is_delivered in onNotificationReminder --- scheduler/reminder.json | 20 +------------------- services/notifikasi-wa.service.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/scheduler/reminder.json b/scheduler/reminder.json index 7f82023..0637a08 100644 --- a/scheduler/reminder.json +++ b/scheduler/reminder.json @@ -1,19 +1 @@ -[ - { - "notification_log": 851, - "error_code_id": 1, - "error_chanel": 2025, - "start_at": "02:10", - "interval": 1, - "max": 3, - "active": 1, - "count": 0, - "last_run": "2026-05-31T17:41:09.191Z", - "last_run_indo": "01-06-2026 00:41:09", - "next_run": "2026-05-31T18:41:09.191Z", - "next_run_indo": "01-06-2026 01:41:09", - "message": "Reminder untuk PLC Compressor B dengan reminder 1YEAR telah dijalankan pada 01-06-2026 00:41:09, hasil pengiriman: sukses", - "time": "00:41", - "created_at": "2026-05-31T17:41:18.802Z" - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/services/notifikasi-wa.service.js b/services/notifikasi-wa.service.js index f50183b..6f567c4 100644 --- a/services/notifikasi-wa.service.js +++ b/services/notifikasi-wa.service.js @@ -538,6 +538,18 @@ class NotifikasiWaService { param.bodyMessage ); + // await this.saveLogReminder({ + // message: `Reminder dijalankan`, + // resultSend + // }) + + await updateNotificationErrorUserDb( + resultNotificationErrorUser[0].notification_error_user_id, + { + is_send: resultSend.success, + } + ); + await this.saveReminder({ notification_log: resultNotificationError.notification_error_id, error_code_id: data['error_code_id'], @@ -554,18 +566,6 @@ class NotifikasiWaService { message: `Reminder untuk ${deviceName} dengan reminder ${chanel.value} telah dijalankan pada ${now.format('DD-MM-YYYY HH:mm:ss')}, hasil pengiriman: ${resultSend.success ? 'sukses' : 'gagal'}`, }, false); - // await this.saveLogReminder({ - // message: `Reminder dijalankan`, - // resultSend - // }) - - await updateNotificationErrorUserDb( - resultNotificationErrorUser[0].notification_error_user_id, - { - is_send: resultSend.success, - } - ); - if (resultSend.success) { isSendNotification = resultSend.success; }