/**
 * Created by Mai on 2017/3/8.
 */

var express = require('express');
var pmRouter = express.Router();
var pmController = require('./../controllers/pm_controller');

pmRouter.use(function (req, res, next) {
    if (/\/getNewProjectID/.test(req.originalUrl) || pmController.checkRight(req, res)) {
        next();
    } else {
        res.json({error: 1, message: '对不起，您无权限操作。', data: null});
    }
});

pmRouter.post('/getProjects', pmController.getProjects);
pmRouter.post('/updateProjects', pmController.updateProjects);
pmRouter.post('/copyProjects', pmController.copyProjects);
pmRouter.post('/renameProject', pmController.rename);
pmRouter.post('/beforeOpenProject', pmController.beforeOpenProject);
pmRouter.post('/getProject', pmController.getProject);
pmRouter.post('/getNewProjectID', pmController.getNewProjectID);

module.exports = pmRouter;