From f27f85b41831376a940d32d48bef984eeb4b0748 Mon Sep 17 00:00:00 2001 From: siiky Date: Wed, 14 Feb 2024 14:23:17 +0000 Subject: [PATCH] feat: show only notifications of the past week --- lib/notifier/queries.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/notifier/queries.js b/lib/notifier/queries.js index 60b8e0d8..e6fa0844 100644 --- a/lib/notifier/queries.js +++ b/lib/notifier/queries.js @@ -54,7 +54,11 @@ const getValidNotifications = (type, detail) => { } const getNotifications = () => { - const sql = `SELECT * FROM notifications WHERE valid ORDER BY created DESC` + const sql = ` + SELECT * FROM notifications + WHERE valid AND created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY) + ORDER BY created DESC + ` return db.any(sql).catch(logger.error) } const setRead = (id, read) => {