generated from azures04/Base-REST-API
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).
10 lines
378 B
SQL
10 lines
378 B
SQL
CREATE TABLE IF NOT EXISTS `bans` (
|
|
`id` UUID PRIMARY KEY DEFAULT UUID(),
|
|
`userId` UUID NOT NULL,
|
|
`message` TEXT NOT NULL,
|
|
`isActive` BOOLEAN NOT NULL DEFAULT TRUE,
|
|
`expiresAt` TIMESTAMP NOT NULL,
|
|
`createdAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT `fk_ban_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE
|
|
) |