@simitgroup/simpleapp-generator 2.0.0-s-alpha → 2.0.0-t-alpha
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/ReleaseNote.md
CHANGED
package/package.json
CHANGED
|
@@ -6,14 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { BadRequestException, Injectable, InternalServerErrorException } from '@nestjs/common';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { InjectConnection, InjectModel } from '@nestjs/mongoose';
|
|
10
|
+
import { Connection, Model } from 'mongoose';
|
|
11
|
+
import { UserContext } from 'src/simple-app/_core/features/user-context/user.context';
|
|
11
12
|
import * as dbupdate from 'src/simple-app/config/db-update';
|
|
12
13
|
import * as schemas from './schemas';
|
|
13
|
-
import { UserContext } from 'src/simple-app/_core/features/user-context/user.context';
|
|
14
14
|
@Injectable()
|
|
15
15
|
export class MaintenanceService {
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(
|
|
17
|
+
@InjectModel('Environment') private sysEnvdoc: Model<schemas.Environment>,
|
|
18
|
+
@InjectConnection() private readonly connection: Connection,
|
|
19
|
+
) {
|
|
17
20
|
this.initEnv();
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -50,7 +53,7 @@ export class MaintenanceService {
|
|
|
50
53
|
async runUpdates(appuser: UserContext, versionId: string) {
|
|
51
54
|
try {
|
|
52
55
|
if (dbupdate[versionId]) {
|
|
53
|
-
const result = await dbupdate[versionId]().execute();
|
|
56
|
+
const result = await dbupdate[versionId]().execute(this.connection);
|
|
54
57
|
return Promise.resolve(result);
|
|
55
58
|
} else {
|
|
56
59
|
throw new BadRequestException(`invalid update script ${versionId}`);
|