@ccci/micro-server 1.0.71 → 1.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113608,22 +113608,13 @@ class DatabaseConnector {
|
|
|
113608
113608
|
let files = fs.readdirSync(`${DatabaseConnector.rootDir}/models`).filter((file) => file.indexOf(".") !== 0 && file.slice(-3) === ".ts");
|
|
113609
113609
|
for (let i = 0;i < files.length; i++) {
|
|
113610
113610
|
let file = files[i];
|
|
113611
|
-
await import(`${DatabaseConnector.rootDir}/models/${file}`).then((
|
|
113612
|
-
console.log("Initializing Model :>> ",
|
|
113613
|
-
if (
|
|
113614
|
-
|
|
113611
|
+
await import(`${DatabaseConnector.rootDir}/models/${file}`).then((model) => {
|
|
113612
|
+
console.log("Initializing Model :>> ", model.default);
|
|
113613
|
+
if (model && model.default && model.default.associate) {
|
|
113614
|
+
model.default.associate();
|
|
113615
113615
|
}
|
|
113616
113616
|
});
|
|
113617
113617
|
}
|
|
113618
|
-
console.log("Sync STARTED :>> ");
|
|
113619
|
-
await DatabaseConnector.connection.sync({ force: true });
|
|
113620
|
-
let model = DatabaseConnector.connection.models["Chats"];
|
|
113621
|
-
model.sync({ force: true }).then((res) => {
|
|
113622
|
-
console.log("Sync Result:", res);
|
|
113623
|
-
}).catch((err) => {
|
|
113624
|
-
console.log("Sync Error:", err);
|
|
113625
|
-
});
|
|
113626
|
-
console.log("Sync ENDED :>> ");
|
|
113627
113618
|
} catch (error) {
|
|
113628
113619
|
console.log(error);
|
|
113629
113620
|
}
|
|
@@ -119194,6 +119185,11 @@ class ApplicationServer {
|
|
|
119194
119185
|
const mailer = Mailer.getInstance();
|
|
119195
119186
|
mailer.connect(options);
|
|
119196
119187
|
}
|
|
119188
|
+
if (sync) {
|
|
119189
|
+
sync.forEach(async (model) => {
|
|
119190
|
+
await DatabaseConnector.sync(model, true);
|
|
119191
|
+
});
|
|
119192
|
+
}
|
|
119197
119193
|
});
|
|
119198
119194
|
}
|
|
119199
119195
|
getInstance() {
|