feat: implement reminder functionality and enhance notification service with logging
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user