feat: implement reminder functionality and enhance notification service with logging

This commit is contained in:
2026-04-29 15:32:03 +07:00
parent 51f4ea2bff
commit a2a64a972f
8 changed files with 443 additions and 9 deletions

View File

@@ -179,6 +179,24 @@ const getSparepartsByIdsDb = async (sparepartIds) => {
return result.recordset;
};
const getSparepartsByYearlyDb = async (yearly) => {
const queryText = `
SELECT *
FROM m_sparepart
WHERE deleted_at IS NULL
AND EXISTS (
SELECT 1
FROM OPENJSON(sparepart_yearly)
WHERE value = $1
)
`;
const result = await pool.query(queryText, [yearly]);
return result.recordset;
};
module.exports = {
getAllSparepartDb,
getSparepartByIdDb,
@@ -187,4 +205,5 @@ module.exports = {
createSparepartDb,
updateSparepartDb,
deleteSparepartDb,
getSparepartsByYearlyDb
};