feat: integrate spareparts reminder functionality into notification service
This commit is contained in:
@@ -32,6 +32,7 @@ const {
|
|||||||
|
|
||||||
const { ErrorHandler } = require("../helpers/error");
|
const { ErrorHandler } = require("../helpers/error");
|
||||||
const { deleteReminder } = require("./notifikasi-wa.service");
|
const { deleteReminder } = require("./notifikasi-wa.service");
|
||||||
|
const { getSparepartsByYearlyDb } = require("../db/sparepart.db");
|
||||||
|
|
||||||
class NotificationService {
|
class NotificationService {
|
||||||
static async getAllNotification(param) {
|
static async getAllNotification(param) {
|
||||||
@@ -135,6 +136,16 @@ class NotificationService {
|
|||||||
|
|
||||||
notification.activity_logs = notificationLogs;
|
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;
|
return notification;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new ErrorHandler(error.statusCode, error.message);
|
throw new ErrorHandler(error.statusCode, error.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user