@ccci/micro-server 1.0.71 → 1.0.73

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -14
  2. 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((model2) => {
113612
- console.log("Initializing Model :>> ", model2);
113613
- if (model2 && model2.default && model2.default.associate) {
113614
- model2.default.associate();
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
  }
@@ -113647,7 +113638,6 @@ class DatabaseConnector {
113647
113638
  return DatabaseConnector.connection.models[modelName];
113648
113639
  }
113649
113640
  static async sync(modelName, force = false) {
113650
- console.log("DatabaseConnector.connection.models :>> ", DatabaseConnector.connection.models);
113651
113641
  console.log("syncing model :>> ", modelName);
113652
113642
  try {
113653
113643
  await DatabaseConnector.connection.models[modelName].sync({ force });
@@ -119194,6 +119184,11 @@ class ApplicationServer {
119194
119184
  const mailer = Mailer.getInstance();
119195
119185
  mailer.connect(options);
119196
119186
  }
119187
+ if (sync) {
119188
+ sync.forEach(async (model) => {
119189
+ await DatabaseConnector.sync(model, true);
119190
+ });
119191
+ }
119197
119192
  });
119198
119193
  }
119199
119194
  getInstance() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",