add notifs
This commit is contained in:
parent
8c00723e16
commit
729a7b8c56
9 changed files with 158 additions and 5 deletions
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue