Add bans, user cache, auth routes & token changes

Introduce user bans and caching, extend schemas, and add auth/user endpoints. Adds bans DDL and banRepo plus adminService to manage bans; introduces modules/cache for in-memory user caching used by authService and userService. Updates users and credentials DDLs (role, isDisabled, shouldReset). Changes tokensService to include role in access tokens and store refresh tokens as SHA-256 hashes. Updates repos (credentials create RETURNING, usersRepo.updateProfile positional params), enhances authService with isLogged/isNotLogged middleware, ban checks, and refreshed token flow. Adds auth routes (login, logout, refresh, register) and user routes (/me).
This commit is contained in:
2026-09-16 01:45:44 +02:00
parent 22542243f6
commit 38882d7b87
17 changed files with 272 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
const usersCache = new Map()
function putUser(userId, userObject) {
return usersCache.set(userId, userObject)
}
function getUser(userId) {
return usersCache.get(userId)
}
function deleteUser(userId) {
return usersCache.delete(userId)
}
module.exports = {
users: {
put: putUser,
get: getUser,
delete: deleteUser
}
}