add: reminder whatsapp sparepart monthly

This commit is contained in:
Muhammad Afif
2026-06-05 09:17:45 +07:00
parent 3d53bf4702
commit 40de826da9
6 changed files with 249 additions and 13 deletions

View File

@@ -139,11 +139,26 @@ const getDeviceReminderChanelDb = async (id) => {
return result.recordset;
};
const getDeviceReminderMonthlyDb = 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.device_id = $1 AND a.deleted_at IS NULL AND a.reminder_at_monthly IS NOT NULL
`;
const result = await pool.query(queryText, [id]);
return result.recordset;
};
module.exports = {
getAllDevicesDb,
getDeviceByIdDb,
createDeviceDb,
updateDeviceDb,
deleteDeviceDb,
getDeviceReminderChanelDb
getDeviceReminderChanelDb,
getDeviceReminderMonthlyDb
};