feat: add request data to user_tokens and token filtering

This commit is contained in:
Sérgio Salgado 2020-10-26 09:57:31 +00:00 committed by Josh Harvey
parent c4e7547c45
commit 791b275cdf
9 changed files with 61 additions and 16 deletions

View file

@ -1,8 +1,8 @@
const db = require('./db')
function getTokenList () {
const sql = `select * from user_tokens`
return db.any(sql)
function getTokenList (browser, os) {
const sql = `select * from user_tokens where browser_version=$1 and os_version=$2`
return db.any(sql, [browser, os])
}
function revokeToken (token) {
@ -10,4 +10,4 @@ function revokeToken (token) {
return db.none(sql, [token])
}
module.exports = { getTokenList, revokeToken }
module.exports = { getTokenList, revokeToken }