Switch to postgres + promises

This commit is contained in:
Ajay Ramachandran
2021-03-01 20:40:31 -05:00
parent 9a9038d5e0
commit ff4af3786e
37 changed files with 424 additions and 291 deletions

View File

@@ -16,8 +16,8 @@ export function rateLimitMiddleware(limitConfig: RateLimitConfig, getUserID?: (r
keyGenerator: (req) => {
return getHash(getIP(req), 1);
},
handler: (req, res, next) => {
if (getUserID === undefined || !isUserVIP(getHash(getUserID(req)))) {
handler: async (req, res, next) => {
if (getUserID === undefined || !await isUserVIP(getHash(getUserID(req)))) {
return res.status(limitConfig.statusCode).send(limitConfig.message);
} else {
return next();