fix: reminder monthly, and cron in reminder reminder monthly
This commit is contained in:
@@ -149,12 +149,23 @@ const getDeviceReminderMonthlyDb = async (id) => {
|
||||
COALESCE(a.device_code, '') + ' - ' + COALESCE(a.device_name, '') AS device_code_name
|
||||
FROM m_device a
|
||||
LEFT JOIN m_brands b ON a.brand_id = b.brand_id
|
||||
WHERE a.device_id = $1 AND a.deleted_at IS NULL AND a.reminder_at_monthly IS NOT NULL
|
||||
WHERE a.device_id = $1 AND a.deleted_at IS NULL
|
||||
`;
|
||||
const result = await pool.query(queryText, [id]);
|
||||
return result.recordset;
|
||||
};
|
||||
|
||||
const updateDeviceReminderMonthlyDb = async (deviceId, reminderMonthly) => {
|
||||
const queryText = `
|
||||
UPDATE m_device
|
||||
SET reminder_at_monthly = $1,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE device_id = $2 AND deleted_at IS NULL
|
||||
`;
|
||||
await pool.query(queryText, [reminderMonthly, deviceId]);
|
||||
return getDeviceByIdDb(deviceId);
|
||||
};
|
||||
|
||||
const getDeviceReminderCustomDb = async (id) => {
|
||||
const queryText = `
|
||||
SELECT
|
||||
@@ -193,4 +204,5 @@ module.exports = {
|
||||
getDeviceReminderMonthlyDb,
|
||||
getDeviceReminderCustomDb,
|
||||
updateDeviceReminderCustomDb,
|
||||
updateDeviceReminderMonthlyDb
|
||||
};
|
||||
Reference in New Issue
Block a user