This commit is contained in:
yaoyanwei
2025-08-04 16:25:38 +08:00
parent 8d542ea201
commit 4b2bb35c20
46 changed files with 5128 additions and 0 deletions

34
matches/matches.routes.js Normal file
View File

@@ -0,0 +1,34 @@
const MatchesController = require('./matches.controller');
const MatchesTool = require('./matches.tool');
const AuthTool = require('../authorization/auth.tool');
const config = require('../config');
const ADMIN = config.permissions.ADMIN; //Highest permision, can read and write all users
const SERVER = config.permissions.SERVER; //Higher permission, can read all users
const USER = config.permissions.USER; //Lowest permision, can only do things on same user
exports.route = function (app) {
app.post('/matches/add', app.post_limiter, [
AuthTool.isValidJWT,
AuthTool.isPermissionLevel(SERVER),
MatchesController.addMatch
]);
app.post('/matches/complete', app.post_limiter, [
AuthTool.isValidJWT,
AuthTool.isPermissionLevel(SERVER),
MatchesController.completeMatch
]);
//-- Getter
app.get('/matches', [
AuthTool.isValidJWT,
AuthTool.isPermissionLevel(SERVER),
MatchesController.getAll
]);
app.get('/matches/:tid', [
AuthTool.isValidJWT,
AuthTool.isPermissionLevel(USER),
MatchesController.getByTid
]);
};