Chore: post-rebase fixes

This commit is contained in:
csrapr 2021-02-05 00:05:50 +00:00 committed by Josh Harvey
parent c0106592eb
commit ef60b15d82
29 changed files with 224 additions and 470 deletions

View file

@ -46,27 +46,27 @@ const getValidNotifications = (type, detail) => {
return db.any(sql, [type, detail])
}
const getNotificationsGql = () => {
const getNotifications = () => {
const sql = `SELECT * FROM notifications ORDER BY created DESC`
return db.any(sql)
}
const markAsReadGql = (id) => {
const markAsRead = (id) => {
const sql = `UPDATE notifications SET read = 't' WHERE id = $1`
return db.none(sql, [id])
}
const markAllAsReadGql = () => {
const markAllAsRead = () => {
const sql = `UPDATE notifications SET read = 't'`
return db.none(sql)
}
const hasUnreadNotificationsGql = () => {
const hasUnreadNotifications = () => {
const sql = `SELECT EXISTS (SELECT 1 FROM notifications WHERE read = 'f' LIMIT 1)`
return db.oneOrNone(sql).then(res => res.exists)
}
const getAlertsGql = () => {
const getAlerts = () => {
const types = ['fiatBalance', 'cryptoBalance', 'error']
const sql = `SELECT * FROM notifications WHERE valid = 't' AND type IN ($1:list) ORDER BY created DESC`
return db.any(sql, [types])
@ -80,9 +80,9 @@ module.exports = {
batchInvalidate,
clearBlacklistNotification,
getValidNotifications,
getNotificationsGql,
markAsReadGql,
markAllAsReadGql,
hasUnreadNotificationsGql,
getAlertsGql
getNotifications,
markAsRead,
markAllAsRead,
hasUnreadNotifications,
getAlerts
}