fix(reminder_monthly): fix loop blocking issue by scoping validation to device_id
This commit is contained in:
@@ -255,23 +255,20 @@ const getReminderNotificationErrorByYearlyDb = async (errorCode, chanel, year) =
|
||||
return result.recordset[0];
|
||||
};
|
||||
|
||||
const getReminderNotificationErrorByMonthlyDb = async (errorCode, monthly) => {
|
||||
const getReminderNotificationErrorByMonthlyDb = async (errorCode, monthly, deviceId) => {
|
||||
const queryText = `
|
||||
SELECT a.*
|
||||
|
||||
FROM notification_error a
|
||||
|
||||
WHERE a.error_code_id = $1
|
||||
AND MONTH(a.created_at) = $2
|
||||
AND a.message_error_issue LIKE 'reminder%'
|
||||
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, monthly]);
|
||||
const result = await pool.query(queryText, [errorCode, monthly, deviceId]);
|
||||
return result.recordset[0];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getNotificationByIdDb,
|
||||
getDeviceNotificationByIdDb,
|
||||
|
||||
Reference in New Issue
Block a user