Replaces custom logger instantiation with a shared logger import across modules and routes. Moves player property and privilege management from authRepository to a new userRepository, expanding userRepository with additional user management functions (ban, unban, preferences, privileges, bans). Updates service and route files to use userRepository where appropriate. Adds new session join route and schema, and utility for UUID formatting.
23 lines
725 B
JavaScript
23 lines
725 B
JavaScript
const express = require("express")
|
|
const router = express.Router()
|
|
const logger = require("../modules/logger")
|
|
const authService = require("../services/authService")
|
|
|
|
router.post("/", async (req, res) => {
|
|
const { username, password, email, registrationCountry, preferredLanguage } = req.body
|
|
const clientIp = req.headers["x-forwarded-for"] || req.connection.remoteAddress
|
|
|
|
const result = await authService.registerUser({
|
|
username,
|
|
password,
|
|
email,
|
|
registrationCountry,
|
|
preferredLanguage,
|
|
clientIp
|
|
})
|
|
|
|
logger.log(`New user registered: ${username}`, ["Web", "yellow", "AUTH", "green"])
|
|
return res.status(200).json(result)
|
|
})
|
|
|
|
module.exports = router |