rsibot-utils 1.2.6 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/db.js +24 -10
- package/package.json +1 -1
package/db.js
CHANGED
@@ -58,14 +58,28 @@ mongoose
|
|
58
58
|
console.log(err);
|
59
59
|
});
|
60
60
|
|
61
|
-
const
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
const models = {
|
62
|
+
HotCoin:undefined,
|
63
|
+
ActiveCoin:undefined,
|
64
|
+
Queue:undefined,
|
65
|
+
Historical:undefined,
|
66
|
+
}
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
68
|
+
|
69
|
+
const dbArray = [
|
70
|
+
{ tableName:'hot_coins',name: 'HotCoin', schema: hotCoinsSchema },
|
71
|
+
{ tableName:'active_coins',name: 'ActiveCoin', schema: activeSchema },
|
72
|
+
{ tableName:'queue_coins',name: 'Queue', schema: queueSchema },
|
73
|
+
{ tableName:'historical_coins',name: 'Historical', schema: historicalSchema },
|
74
|
+
];
|
75
|
+
|
76
|
+
dbArray.forEach(({name,schema,tableName }) => {
|
77
|
+
if (mongoose.models[tableName]) {
|
78
|
+
models[name] = mongoose.model(tableName);
|
79
|
+
} else {
|
80
|
+
models[name] = mongoose.model(tableName, schema);
|
81
|
+
}
|
82
|
+
})
|
83
|
+
|
84
|
+
|
85
|
+
module.exports = models;
|