wisdom #48
@@ -32,6 +32,7 @@ const {
|
||||
|
||||
const { ErrorHandler } = require("../helpers/error");
|
||||
const { deleteReminder } = require("./notifikasi-wa.service");
|
||||
const { getSparepartsByYearlyDb } = require("../db/sparepart.db");
|
||||
|
||||
class NotificationService {
|
||||
static async getAllNotification(param) {
|
||||
@@ -135,6 +136,16 @@ class NotificationService {
|
||||
|
||||
notification.activity_logs = notificationLogs;
|
||||
|
||||
notification.is_reminder = false;
|
||||
notification.spareparts_reminder = [];
|
||||
if (notification.message_error_issue) {
|
||||
const sparepartsReminder = await getSparepartsByYearlyDb(notification.error_code_id);
|
||||
|
||||
notification.spareparts_reminder = sparepartsReminder ?? [];
|
||||
notification.is_reminder = true;
|
||||
|
||||
}
|
||||
|
||||
return notification;
|
||||
} catch (error) {
|
||||
throw new ErrorHandler(error.statusCode, error.message);
|
||||
|
||||
Reference in New Issue
Block a user