Initial project structure and core files
Add base project files including environment example, license, README, .gitignore, error classes, ESLint config, database modules, texture assets, repositories, routes, schemas, services, and server entry point. This establishes the foundational structure for a Yggdrasil-compatible REST API with modular error handling, database setup, and route organization.
This commit is contained in:
39
routes/minecraftservices/privacy/blocklist.js
Normal file
39
routes/minecraftservices/privacy/blocklist.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const express = require("express")
|
||||
const router = express.Router()
|
||||
const utils = require("../../../modules/utils") // Pour addDashesToUUID
|
||||
const authService = require("../../../services/authService")
|
||||
const userService = require("../../../services/userService")
|
||||
|
||||
router.get("/", async (req, res, next) => {
|
||||
const user = await authService.verifyUserFromHeader(req.headers.authorization)
|
||||
const result = await userService.getBlockedUuids(user.uuid)
|
||||
return res.status(200).json({
|
||||
blockedProfiles: result.data || []
|
||||
})
|
||||
})
|
||||
|
||||
router.put("/:uuid", async (req, res, next) => {
|
||||
const user = await authService.verifyUserFromHeader(req.headers.authorization)
|
||||
const targetUuid = utils.addDashesToUUID(req.params.uuid)
|
||||
|
||||
await userService.blockPlayer(user.uuid, targetUuid)
|
||||
|
||||
const result = await userService.getBlockedUuids(user.uuid)
|
||||
return res.status(200).json({
|
||||
blockedProfiles: result.data || []
|
||||
})
|
||||
})
|
||||
|
||||
router.delete("/:uuid", async (req, res, next) => {
|
||||
const user = await authService.verifyUserFromHeader(req.headers.authorization)
|
||||
const targetUuid = utils.addDashesToUUID(req.params.uuid)
|
||||
|
||||
await userService.unblockPlayer(user.uuid, targetUuid)
|
||||
|
||||
const result = await userService.getBlockedUuids(user.uuid)
|
||||
return res.status(200).json({
|
||||
blockedProfiles: result.data || []
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user