add: reminder whatsapp sparepart monthly
This commit is contained in:
@@ -197,6 +197,24 @@ const getSparepartsByYearlyDb = async (yearly) => {
|
||||
return result.recordset;
|
||||
};
|
||||
|
||||
const getSparepartsByMonthlyDb = async (monthly) => {
|
||||
|
||||
const queryText = `
|
||||
SELECT *
|
||||
FROM m_sparepart
|
||||
WHERE deleted_at IS NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM OPENJSON(sparepart_monthly)
|
||||
WHERE value = $1
|
||||
)
|
||||
`;
|
||||
|
||||
const result = await pool.query(queryText, [monthly]);
|
||||
|
||||
return result.recordset;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getAllSparepartDb,
|
||||
getSparepartByIdDb,
|
||||
@@ -205,5 +223,6 @@ module.exports = {
|
||||
createSparepartDb,
|
||||
updateSparepartDb,
|
||||
deleteSparepartDb,
|
||||
getSparepartsByYearlyDb
|
||||
getSparepartsByYearlyDb,
|
||||
getSparepartsByMonthlyDb
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user