Multiple changes, basic rental CRUD backend implemented.
All responses are now in their own object with context name. Added limit to user based recent results for matches. Moved all code in endpoints inside try and catch. Renamed authentication guard function.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import express from "express";
|
||||
import { authenticationGuard } from "../middleware/authority.js";
|
||||
import { requireAuthenticated } from "../middleware/authority.js";
|
||||
import { needDatabase } from "../middleware/database.js";
|
||||
import sportModel from "../schemas/sportModel.js";
|
||||
import userModel from "../schemas/userModel.js";
|
||||
|
||||
const SportController = express.Router();
|
||||
|
||||
SportController.post("/", needDatabase, authenticationGuard, async (req, res) => {
|
||||
SportController.post("/", needDatabase, requireAuthenticated, async (req, res) => {
|
||||
const user = await userModel.findById(req.session.userId);
|
||||
try {
|
||||
if (user.accessLevel <= 2) {
|
||||
|
||||
Reference in New Issue
Block a user