add: feature reminder custom device with cron-job

This commit is contained in:
2026-06-23 21:59:02 +07:00
parent da8cdcb705
commit 8fd317083b
5 changed files with 692 additions and 137 deletions

View File

@@ -269,6 +269,22 @@ const getReminderNotificationErrorByMonthlyDb = async (errorCode, monthly, devic
const result = await pool.query(queryText, [errorCode, monthly, deviceId]);
return result.recordset[0];
};
const getReminderNotificationErrorByCustomDb = async (errorCode, custom, deviceId) => {
const queryText = `
SELECT a.*
FROM notification_error a
WHERE a.error_code_id = $1
AND a.created_at = $2
AND a.message_error_issue LIKE '%device_id: ' + CAST($3 AS VARCHAR) + '%'
AND a.is_active = 1
AND a.deleted_at IS NULL
`;
const result = await pool.query(queryText, [errorCode, custom, deviceId]);
return result.recordset[0];
};
module.exports = {
getNotificationByIdDb,
getDeviceNotificationByIdDb,
@@ -279,6 +295,7 @@ module.exports = {
getDeviceChannelReminder,
getReminderNotificationErrorByYearlyDb,
getReminderNotificationErrorByMonthlyDb,
getReminderNotificationErrorByCustomDb,
updateNotificationErrorByChanelReminderDb
};