/**
 * Created by CSL on 2017/5/19.
 */
var coeList = require("../models/coe");

var callback = function(req,res,err,message, data){
    res.json({error: err, message: message, data: data});
}

module.exports ={
    getCoeList: function(req,res){
        coeList.getCoesByLibID(req.body.libID, function(err,data){
            callback(req, res, err, 'Get coes', data);
        });
    },

    saveCoeList: function(req, res) {
        coeList.saveToCoeList(JSON.parse(req.body.data), function(isErr, msg, data){
            callback(req, res, isErr, msg, data);
        });
    },

    getCoeItemsByIDs: function(req,res){
        coeList.getCoeItemsByIDs(JSON.parse(req.body.data), function(err,data){
            callback(req, res, err, 'Get coe', data);
        });
    }

}