add notifs

This commit is contained in:
biglyderv 2025-03-02 04:09:17 -05:00
parent 8c00723e16
commit 729a7b8c56
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
9 changed files with 158 additions and 5 deletions

View file

@ -49,6 +49,29 @@ router.post('/', async (req, res, next) => {
(+new Date)
]);
if (type == 'users') {
await db.run('INSERT INTO messages (username, date, content, link, status) VALUES(?,?,?,?,?)', [
id,
(+new Date),
`A user responded to your wall.`,
`/walls/get/users/${id}/0`,
'unread'
]);
} else if (type == 'comment') {
let commenter = await db.all('SELECT * FROM comment WHERE id = ?', [
id
]);
if (commenter[0]) {
await db.run('INSERT INTO messages (username, date, content, link, status) VALUES(?,?,?,?,?)', [
commenter[0].username,
(+new Date),
`A user responded to your post.`,
`/walls/get/comment/${id}/0`,
'unread'
]);
}
}
apiStat(res, next, `Comment submitted.`, '/comment/' + token)
})