const {authJwt} = require("../middlewares");
module.exports = app => {
    const employees = require("../controllers/employee.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 employee
    router.get("/", employees.getAllEmployees);
    // Retrive employees across sites
    router.get("/all-sites", employees.getAllEmployeesAcrossSites);
    // Create a new employee
    router.post("/", employees.createEmployee);
    // Update an employee
    router.put("/:id",[authJwt.verifyToken], employees.updateEmployee );
    // Get one employee
    router.get("/:id",[authJwt.verifyToken], employees.getEmployee)
    app.use('/api/employees', router);
 };