@ccci/micro-server 1.0.76 → 1.0.78
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
CHANGED
|
@@ -113644,6 +113644,14 @@ class DatabaseConnector {
|
|
|
113644
113644
|
console.log("ERROR in syncing :>> ", error);
|
|
113645
113645
|
}
|
|
113646
113646
|
}
|
|
113647
|
+
static async syncAll(force = false) {
|
|
113648
|
+
console.log("syncing ALL models :>> ");
|
|
113649
|
+
try {
|
|
113650
|
+
await DatabaseConnector.connection.sync({ force });
|
|
113651
|
+
} catch (error) {
|
|
113652
|
+
console.log("ERROR in syncing :>> ", error);
|
|
113653
|
+
}
|
|
113654
|
+
}
|
|
113647
113655
|
static disconnect() {
|
|
113648
113656
|
DatabaseConnector.connection.close();
|
|
113649
113657
|
}
|
|
@@ -119183,9 +119191,13 @@ class ApplicationServer {
|
|
|
119183
119191
|
mailer.connect(options);
|
|
119184
119192
|
}
|
|
119185
119193
|
if (sync) {
|
|
119186
|
-
|
|
119187
|
-
|
|
119188
|
-
|
|
119194
|
+
if (Array.isArray(sync)) {
|
|
119195
|
+
sync.forEach(async (model) => {
|
|
119196
|
+
await DatabaseConnector.sync(model, true);
|
|
119197
|
+
});
|
|
119198
|
+
} else {
|
|
119199
|
+
await DatabaseConnector.syncAll(true);
|
|
119200
|
+
}
|
|
119189
119201
|
}
|
|
119190
119202
|
});
|
|
119191
119203
|
}
|
|
@@ -12,7 +12,7 @@ export default class ApplicationServer {
|
|
|
12
12
|
* @param {Array<String>} sync models to be sync to the database
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
|
-
static bootstrap(port: number, options?: ApplicationOptionType, sync?: Array<string>): Promise<void>;
|
|
15
|
+
static bootstrap(port: number, options?: ApplicationOptionType, sync?: Array<string> | Boolean): Promise<void>;
|
|
16
16
|
getInstance(): express.Application;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=ApplicationServer.d.ts.map
|
|
@@ -19,6 +19,7 @@ export default class DatabaseConnector {
|
|
|
19
19
|
connect(connection: Sequelize): Promise<void>;
|
|
20
20
|
static getModel(modelName: string): ModelStatic<Model>;
|
|
21
21
|
static sync(modelName: string, force?: boolean): Promise<void>;
|
|
22
|
+
static syncAll(force?: boolean): Promise<void>;
|
|
22
23
|
static disconnect(): void;
|
|
23
24
|
}
|
|
24
25
|
//# sourceMappingURL=DatabaseConnector.d.ts.map
|