feat: implement reminder functionality and enhance notification service with logging
This commit is contained in:
@@ -69,6 +69,7 @@ const getDeviceByIdDb = async (id) => {
|
||||
SELECT
|
||||
a.*,
|
||||
b.brand_name,
|
||||
a.reminder_at AT TIME ZONE 'UTC' AT TIME ZONE 'SE Asia Standard Time' AS reminder_at_local,
|
||||
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
|
||||
@@ -124,10 +125,25 @@ const deleteDeviceDb = async (id, deletedBy) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
const getDeviceReminderChanelDb = async (id) => {
|
||||
const queryText = `
|
||||
SELECT
|
||||
a.*,
|
||||
b.brand_name,
|
||||
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.listen_channel_reminder = $1 AND a.deleted_at IS NULL
|
||||
`;
|
||||
const result = await pool.query(queryText, [id]);
|
||||
return result.recordset;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getAllDevicesDb,
|
||||
getDeviceByIdDb,
|
||||
createDeviceDb,
|
||||
updateDeviceDb,
|
||||
deleteDeviceDb,
|
||||
getDeviceReminderChanelDb
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user