generated from azures04/Base-REST-API
Introduce bootstrap entrypoint and prestartup to ping DB and generate/manage RSA keypair. Add security module for key IO. Implement JWT-based access and refresh tokens (tokensService) with refresh_tokens table and repo. Add auth, provider and user services, and refresh-token management. Update repositories (users, credentials, providers, servers) with SQL fixes and new helper methods. Move DDL execution to bootstrap (remove from server). Update package.json main and add dependencies (bcryptjs, jsonwebtoken). Update .env.example and .gitignore accordingly.
12 lines
496 B
SQL
12 lines
496 B
SQL
CREATE TABLE IF NOT EXISTS `users` (
|
|
`id` UUID PRIMARY KEY DEFAULT UUID(),
|
|
`serverId` UUID NULL,
|
|
`identifier` VARCHAR(255) NOT NULL UNIQUE,
|
|
`remoteId` VARCHAR(255) NULL,
|
|
`displayName` VARCHAR(512) NOT NULL,
|
|
`avatarUrl` TEXT NULL,
|
|
`createdAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT `fk_users_serverId` FOREIGN KEY (`serverId`) REFERENCES `servers` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `uq_users_server_remote` UNIQUE (`serverId`, `remoteId`)
|
|
) |