Introduces a new addPlayerAction method in adminRepository and logPlayerAction in adminService to record admin actions on player accounts. Updates relevant admin routes to log actions such as bans, unbans, forced name changes, and skin resets. Also improves error messages in adminService for consistency and clarity.
13 lines
538 B
JavaScript
13 lines
538 B
JavaScript
const express = require("express")
|
|
const router = express.Router()
|
|
const userService = require("../../../services/userService")
|
|
const adminService = require("../../../services/adminService")
|
|
|
|
router.patch("/:uuid", adminService.hasPermission("CHANGE_PLAYER_USERNAME"), async (req, res) => {
|
|
const { newUsername } = req.body
|
|
const result = await userService.changeUsername(req.params.uuid, newUsername)
|
|
await adminService.logPlayerAction("FORCED_NAME_CHANGE")
|
|
return res.status(200).json(result)
|
|
})
|
|
|
|
module.exports = router |