Fix: missing $ and use defaultStore

This commit is contained in:
csrapr 2021-03-18 17:19:42 +00:00 committed by Josh Harvey
parent cbf0165893
commit f3f2bb01b0
6 changed files with 11 additions and 14 deletions

View file

@ -7,7 +7,7 @@ function createAuthToken (userID, type) {
const token = crypto.randomBytes(32).toString('hex')
const sql = `INSERT INTO auth_tokens (token, type, user_id) VALUES ($1, $2, $3) ON CONFLICT (user_id, type) DO UPDATE SET token=$1, expire=now() + interval '${constants.AUTH_TOKEN_EXPIRATION_TIME}' RETURNING *`
return db.one(sql, [token, type, userID])
return db.$one(sql, [token, type, userID])
}
module.exports = {