/**
 * Created by Tony on 2017/8/9.
 */
import mongoose from "mongoose";
let rpt_tpl_mdl = mongoose.model("rpt_templates");
let rpt_tpl_ext_code_mdl = mongoose.model("rpt_ext_code_tpl");

module.exports = {
    getRptTemplate: getRptTemplate,
    getExtCodeTpl: getExtCodeTpl
};

async function getRptTemplate(tplId) {
    //console.log('templateId: ' + parseInt(tplId));
    return await  rpt_tpl_mdl.findOne({"ID": parseInt(tplId)}, '-_id');
}

async function getExtCodeTpl() {
    return await  rpt_tpl_ext_code_mdl.find({});
}
