|
@@ -3,7 +3,7 @@
|
|
|
*/
|
|
|
let mongoose = require('mongoose');
|
|
|
let dbm = require("../../../config/db/db_manager");
|
|
|
-let smartcostdb = dbm.getCfgConnection("Reports");
|
|
|
+let smartcostdb = dbm.getCfgConnection("scConstruct");
|
|
|
let Schema = mongoose.Schema;
|
|
|
let FormatSchema = new Schema({
|
|
|
"ID" : String,
|
|
@@ -46,27 +46,4 @@ let RptCfgSchema = new Schema({
|
|
|
|
|
|
let Rpt_Cfg_Mdl = smartcostdb.model("rpt_cfg", RptCfgSchema, "rpt_cfg");
|
|
|
|
|
|
-class RptCfgDAO {
|
|
|
- getByUserId(userId, callback){
|
|
|
- Rpt_Cfg_Mdl.find({userId: userId}, '-_id', function(err, templates){
|
|
|
- if(templates.length){
|
|
|
- callback(false, templates[0]);
|
|
|
- }
|
|
|
- else{
|
|
|
- callback('no record was found!');
|
|
|
- }
|
|
|
- })
|
|
|
- };
|
|
|
- getAll(id, callback){
|
|
|
- Rpt_Cfg_Mdl.find({}, '-_id', function(err, templates){
|
|
|
- if(templates.length){
|
|
|
- callback(false, templates);
|
|
|
- }
|
|
|
- else{
|
|
|
- callback('no record was found!');
|
|
|
- }
|
|
|
- })
|
|
|
- };
|
|
|
-};
|
|
|
-
|
|
|
-module.exports = new RptCfgDAO();
|
|
|
+module.exports = Rpt_Cfg_Mdl;
|