const {authJwt} = require("../middlewares");
module.exports = app => {
	const eventRequest = require("../controllers/event-request.controller.js");
	app.use((req, res, next) => {
		res.header(
			"Access-Control-Allow-Headers",
			"x-access-token, Origin, Content-Type, Accept"
		);
		next();
	});
	var router = require("express").Router();
	// Retrieve all event Request
	router.get("/", [authJwt.verifyToken], eventRequest.getAllEventRequests);
	// Create a new event Request
	router.post("/", [authJwt.verifyToken], eventRequest.createEventRequest);
	router.put('/:id', [authJwt.verifyToken], eventRequest.updateRequestItem);
	router.delete('/:id', [authJwt.verifyToken], eventRequest.deleteEventRequest)
	app.use('/api/event-requests', router);
};