agusnavce
10/1/2018 - 1:11 PM

employeeRouter.js

var express = require('express');
var router = express.Router();
var Employee = require('../models/Employee');
...
// The same as the other routers
...

/**
 * Get the confidential info of an employee.
 */
router.get(
  '/conf/:id',
  wrapErrors(async (req, res) => {
    var id = req.params.id;
    var data = await Employee.getConfidential(id);
    res.status(200).json({ data});
  })
);

/**
 * Creates a new item in confidential index.
 */
router.post(
  '/conf',
  wrapErrors(async (req, res) => {
    var data = await Employee.createConfidential(req.body);
    res.status(200).json({ data });
  })
);

/**
 * Updates the conf.
 */
router.put(
  '/conf',
  wrapErrors(async (req, res) => {
    var data = await Customer.updateConfidential(req.body);
    res.status(200).json({ data});
  })
);

module.exports = router;