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.
24 lines
976 B
JavaScript
24 lines
976 B
JavaScript
const express = require("express")
|
|
const router = express.Router()
|
|
const userService = require("../../../services/userService")
|
|
const adminService = require("../../../services/adminService")
|
|
|
|
router.delete("/skin/:uuid", adminService.hasPermission("RESET_PLAYER_SKIN"), async (req, res) => {
|
|
const result = await userService.resetSkin(req.params.uuid)
|
|
await adminService.logPlayerAction("USING_BANNED_SKIN")
|
|
return res.status(200).json(result)
|
|
})
|
|
|
|
router.put("/cape/:uuid/:hash", adminService.hasPermission("GRANT_PLAYER_CAPE"), async (req, res) => {
|
|
const { uuid, hash } = req.params
|
|
const result = await userService.grantCape(uuid, hash)
|
|
return res.status(200).json(result)
|
|
})
|
|
|
|
router.delete("/cape/:uuid/:hash", adminService.hasPermission("REMOVE_PLAYER_CAPE"), async (req, res) => {
|
|
const { uuid, hash } = req.params
|
|
const result = await userService.removeCape(uuid, hash)
|
|
return res.status(200).json(result)
|
|
})
|
|
|
|
module.exports = router |