@ccci/micro-server 1.0.75 → 1.0.77
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
|
}
|
|
@@ -119165,7 +119173,6 @@ class ApplicationServer {
|
|
|
119165
119173
|
ApplicationServer.app.use(import_express_fileupload.default());
|
|
119166
119174
|
const db = new DatabaseConnector(process.cwd());
|
|
119167
119175
|
const conn = await DatabaseConnector.init();
|
|
119168
|
-
await db.connect(conn[0]);
|
|
119169
119176
|
await db.initializeModels();
|
|
119170
119177
|
ApplicationServer.app.get("/", (req, resp) => {
|
|
119171
119178
|
return resp.sendFile(path4.resolve("index.html"));
|
|
@@ -119184,9 +119191,13 @@ class ApplicationServer {
|
|
|
119184
119191
|
mailer.connect(options);
|
|
119185
119192
|
}
|
|
119186
119193
|
if (sync) {
|
|
119187
|
-
sync
|
|
119188
|
-
await DatabaseConnector.
|
|
119189
|
-
}
|
|
119194
|
+
if (sync instanceof Boolean) {
|
|
119195
|
+
await DatabaseConnector.syncAll(true);
|
|
119196
|
+
} else {
|
|
119197
|
+
sync.forEach(async (model) => {
|
|
119198
|
+
await DatabaseConnector.sync(model, true);
|
|
119199
|
+
});
|
|
119200
|
+
}
|
|
119190
119201
|
}
|
|
119191
119202
|
});
|
|
119192
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
|