Compare commits

..

2 Commits

View File

@@ -31,7 +31,7 @@ const filePathLog = path.join(process.cwd(), 'scheduler', 'log.json');
class NotifikasiWaService {
async saveReminder(data) {
async saveReminder(data, isReset = false) {
console.log(`Reminder proses dibuat`);
try {
@@ -64,7 +64,12 @@ class NotifikasiWaService {
created_at: now.toISOString() // opsional (full timestamp)
};
if (!isReset) {
existing.push(newData);
} else {
existing = newData;
}
await fs.writeFile(filePath, JSON.stringify(existing, null, 2), 'utf-8');
@@ -268,7 +273,7 @@ class NotifikasiWaService {
return false;
}
this.saveReminder(newData);
this.saveReminder(newData, true);
await this.saveLogReminder({
message: `Reminder ${id} berhasil dihapus`
@@ -344,7 +349,7 @@ class NotifikasiWaService {
return true;
});
await this.saveReminder(data);
await this.saveReminder(data, true);
}, 60 * 1000);
}