repair: change message wa notification

This commit is contained in:
2026-01-05 16:10:29 +07:00
parent 0c16b2a3fd
commit 71c5e94f42
3 changed files with 97 additions and 72 deletions

View File

@@ -92,14 +92,10 @@ class NotificationErrorUserService {
}
static async resendNotificationByUser(id, contact_phone) {
try {
const dataExist = await getNotificationErrorUserByIdDb(id);
if (!dataExist || dataExist.length < 1) {
throw new ErrorHandler(
404,
"Data Notification Error User not found"
);
throw new ErrorHandler(404, "Data Notification Error User not found");
}
const data = dataExist[0];
@@ -127,11 +123,15 @@ class NotificationErrorUserService {
const encodedToken = encodeURIComponent(tokenRedirect);
const shortUrl = await shortUrltiny(encodedToken);
const bodyBase =
`Hai Operator\n` +
`Terjadi peringatan pada device, silahkan cek detail pada link berikut :\n`;
const bodyWithUrl = `${bodyBase}\n🔗 ${shortUrl}`;
const bodyWithUrl =
`Hai ${data.contact_name || "-"}\n` +
`Terjadi peringatan dengan kode error ${data.error_code || "-"} - ${
data.error_code_name || "-"
} ` +
`pada device ${
data.device_name || "-"
}, silahkan cek detail pada link berikut:\n` +
`${shortUrl}`;
const resultSend = await sendNotifikasi(data.contact_phone, bodyWithUrl);
@@ -155,8 +155,12 @@ class NotificationErrorUserService {
return {
notification_error_user_id: id,
notification_error_id: data.notification_error_id,
is_send: isSuccess,
short_url: shortUrl,
device_name: data.device_name,
error_code: data.error_code,
error_code_name: data.error_code_name,
message: "Berhasil mengirim ulang notifikasi",
};
} catch (error) {