@simitgroup/simpleapp-generator 2.0.1-m-alpha → 2.0.1-o-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 +13 -2
- package/package.json +1 -1
- package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.service.ts.eta +4 -4
- package/templates/nest/src/simple-app/_core/features/simple-app-core-features.module.ts.eta +4 -0
- package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +14 -18
- package/templates/nest/src/simple-app/cron/cron.module.ts.eta +10 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +3 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +25 -0
package/ReleaseNote.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
[2.0.1o-alpha]
|
|
2
|
+
|
|
3
|
+
1. fetch branch image url, and fix maintenance mode data
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[2.0.1n-alpha]
|
|
7
|
+
|
|
8
|
+
1. Add debug for invalid xorg
|
|
9
|
+
|
|
1
10
|
[2.0.1m-alpha]
|
|
2
|
-
|
|
11
|
+
|
|
12
|
+
1. remove s from environment collection name
|
|
3
13
|
2. return maintenanceMessage when system under maintenance
|
|
4
14
|
3. fix maintenanceMode cannot set in api
|
|
5
|
-
4.
|
|
6
15
|
|
|
7
16
|
[2.0.1l-alpha]
|
|
17
|
+
|
|
8
18
|
1. documentevent collection remove 's'
|
|
9
19
|
|
|
10
20
|
[2.0.1k-alpha]
|
|
21
|
+
|
|
11
22
|
1. apilog and documentevent collection remove 's'
|
|
12
23
|
|
|
13
24
|
[2.0.1j-alpha]
|
package/package.json
CHANGED
|
@@ -63,7 +63,7 @@ export class MaintenanceService {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
async runGetEnvironment(appUser: UserContext) {
|
|
66
|
-
const res = await this.sysEnvdoc.findOne();
|
|
66
|
+
const res = await this.sysEnvdoc.findOne();
|
|
67
67
|
return res;
|
|
68
68
|
}
|
|
69
69
|
async runUpdateEnvironment(appUser: UserContext, data: Environment) {
|
|
@@ -71,9 +71,9 @@ export class MaintenanceService {
|
|
|
71
71
|
systemEnable: data.systemEnable !== undefined ? data.systemEnable : true,
|
|
72
72
|
stopUntil: data.stopUntil ?? '',
|
|
73
73
|
maintenanceMessage: data.maintenanceMessage ?? '',
|
|
74
|
-
adminEmails: data.adminEmails.map((item) => item.replace(' ', ''))
|
|
75
|
-
billingEmails: data.billingEmails.map((item) => item.replace(' ', ''))
|
|
76
|
-
supportEmails: data.supportEmails.map((item) => item.replace(' ', ''))
|
|
74
|
+
adminEmails: (data.adminEmails ?? []).map((item) => item.replace(' ', '')),
|
|
75
|
+
billingEmails: (data.billingEmails ?? []).map((item) => item.replace(' ', '')),
|
|
76
|
+
supportEmails: (data.supportEmails ?? []).map((item) => item.replace(' ', '')),
|
|
77
77
|
taxRate: data.taxRate ?? 0.0,
|
|
78
78
|
taxName: data.taxName ?? '',
|
|
79
79
|
updated: new Date().toISOString(),
|
|
@@ -18,6 +18,8 @@ import { ProfileModule } from './profile/profile.module';
|
|
|
18
18
|
import { SimpleAppUserContextModule } from './user-context/user-context.module';
|
|
19
19
|
import { SimpleAppWebhookModule } from './webhook/webhook.module';
|
|
20
20
|
import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
|
|
21
|
+
import { SimpleAppCronModule } from './cron/cron.module';
|
|
22
|
+
|
|
21
23
|
@Module({
|
|
22
24
|
imports: [
|
|
23
25
|
AutoIncreamentModule,
|
|
@@ -31,6 +33,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
|
|
|
31
33
|
SimpleAppWebhookModule,
|
|
32
34
|
SimpleAppMiniAppModule,
|
|
33
35
|
SimpleAppSoftwarePolicyModule,
|
|
36
|
+
SimpleAppCronModule
|
|
34
37
|
],
|
|
35
38
|
controllers: [],
|
|
36
39
|
providers: [],
|
|
@@ -46,6 +49,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
|
|
|
46
49
|
SimpleAppWebhookModule,
|
|
47
50
|
SimpleAppMiniAppModule,
|
|
48
51
|
SimpleAppSoftwarePolicyModule,
|
|
52
|
+
SimpleAppCronModule
|
|
49
53
|
],
|
|
50
54
|
})
|
|
51
55
|
export class SimpleAppCoreFeaturesModule {}
|
|
@@ -432,7 +432,7 @@ export class UserContext extends UserContextInfo {
|
|
|
432
432
|
foreignField: 'orgId',
|
|
433
433
|
},
|
|
434
434
|
},
|
|
435
|
-
{ $unwind: '$org' },
|
|
435
|
+
{ $unwind: { path: '$org', preserveNullAndEmptyArrays: true } },
|
|
436
436
|
],
|
|
437
437
|
},
|
|
438
438
|
},
|
|
@@ -447,6 +447,7 @@ export class UserContext extends UserContextInfo {
|
|
|
447
447
|
branchCode: '$b.branchCode',
|
|
448
448
|
branchName: '$b.branchName',
|
|
449
449
|
branchId: '$b.branchId',
|
|
450
|
+
imageUrl: '$b.imageUrl',
|
|
450
451
|
},
|
|
451
452
|
|
|
452
453
|
groups: 1,
|
|
@@ -672,7 +673,7 @@ export class UserContext extends UserContextInfo {
|
|
|
672
673
|
this.orgId = value2;
|
|
673
674
|
this.branchId = value3;
|
|
674
675
|
} else {
|
|
675
|
-
throw new BadRequestException(
|
|
676
|
+
throw new BadRequestException(`Failed to set xorg, invalidXorg: ${xOrg}`);
|
|
676
677
|
}
|
|
677
678
|
} catch (err) {
|
|
678
679
|
throw new BadRequestException(err);
|
|
@@ -694,7 +695,7 @@ export class UserContext extends UserContextInfo {
|
|
|
694
695
|
branchId,
|
|
695
696
|
};
|
|
696
697
|
} else {
|
|
697
|
-
throw new BadRequestException(
|
|
698
|
+
throw new BadRequestException(`Failed to decode xorg, invalidXorg: ${xOrg}`);
|
|
698
699
|
}
|
|
699
700
|
} catch (err) {
|
|
700
701
|
throw new BadRequestException(err);
|
|
@@ -761,12 +762,12 @@ export class UserContext extends UserContextInfo {
|
|
|
761
762
|
const result = await res.save({ session: this.dbsession });
|
|
762
763
|
this.logger.log(result, 'accept invitation 1');
|
|
763
764
|
// Set permission of all user under this.user_id
|
|
764
|
-
const updateresult = await this.permModel.updateMany({ uid: '',
|
|
765
|
+
const updateresult = await this.permModel.updateMany({ uid: '', userId: res._id }, { uid: this.getUid() }).session(this.dbsession);
|
|
765
766
|
this.logger.log(updateresult, 'update all permission');
|
|
766
767
|
return true;
|
|
767
768
|
} else {
|
|
768
769
|
await this.userModel.deleteOne({ _id: id }).session(this.dbsession);
|
|
769
|
-
await this.permModel.deleteMany({ uid: '',
|
|
770
|
+
await this.permModel.deleteMany({ uid: '', userId: res._id }).session(this.dbsession);
|
|
770
771
|
return true;
|
|
771
772
|
}
|
|
772
773
|
} else {
|
|
@@ -986,23 +987,18 @@ export class UserContext extends UserContextInfo {
|
|
|
986
987
|
this.ssoACL = {};
|
|
987
988
|
this.roles = [Role.Everyone, Role.User, Role.SuperUser];
|
|
988
989
|
this.setXOrg(xorg);
|
|
989
|
-
const pipeLine:PipelineStage[] = [
|
|
990
|
-
{$match:{ tenantId : -1 }},
|
|
991
|
-
{$unionWith: { coll: "organization", pipeline: [ {$match:{orgId: this.orgId}}] } },
|
|
992
|
-
{$limit:1}
|
|
993
|
-
]
|
|
990
|
+
const pipeLine: PipelineStage[] = [{ $match: { tenantId: -1 } }, { $unionWith: { coll: 'organization', pipeline: [{ $match: { orgId: this.orgId } }] } }, { $limit: 1 }];
|
|
994
991
|
|
|
995
992
|
// console.log("set as static user", pipeLine)
|
|
996
|
-
const result:Organization[] = await this.userModel.aggregate(pipeLine).exec();
|
|
993
|
+
const result: Organization[] = await this.userModel.aggregate(pipeLine).exec();
|
|
997
994
|
// console.log("result",result)
|
|
998
|
-
if(result && result.length>0){
|
|
999
|
-
const res = result[0]
|
|
1000
|
-
this.currency = res.currency
|
|
1001
|
-
this.country = res.country
|
|
1002
|
-
this.timeZone = res.timeZone
|
|
1003
|
-
this.offsetMinute = res.offsetMinute
|
|
995
|
+
if (result && result.length > 0) {
|
|
996
|
+
const res = result[0];
|
|
997
|
+
this.currency = res.currency;
|
|
998
|
+
this.country = res.country;
|
|
999
|
+
this.timeZone = res.timeZone;
|
|
1000
|
+
this.offsetMinute = res.offsetMinute;
|
|
1004
1001
|
}
|
|
1005
|
-
|
|
1006
1002
|
};
|
|
1007
1003
|
|
|
1008
1004
|
setGuestToken(tokenStr: string) {
|
|
@@ -13,6 +13,7 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
13
13
|
import { SimpleAppMiniAppsModule } from './mini-apps/mini-apps.module';
|
|
14
14
|
import { SimpleAppQueueConsumersModule } from './queues/queues.module';
|
|
15
15
|
import { SimpleAppMiniAppScopeModule } from '@core-features/mini-app/mini-app-scope/mini-app-scope.module';
|
|
16
|
+
import { CronModule } from './crons/cron.module';
|
|
16
17
|
|
|
17
18
|
@Module({
|
|
18
19
|
imports: [
|
|
@@ -24,6 +25,7 @@ import { SimpleAppMiniAppScopeModule } from '@core-features/mini-app/mini-app-sc
|
|
|
24
25
|
SimpleAppMiniAppsModule,
|
|
25
26
|
SimpleAppQueueConsumersModule,
|
|
26
27
|
SimpleAppMiniAppScopeModule,
|
|
28
|
+
CronModule
|
|
27
29
|
],
|
|
28
30
|
controllers: [],
|
|
29
31
|
providers: [],
|
|
@@ -36,6 +38,7 @@ import { SimpleAppMiniAppScopeModule } from '@core-features/mini-app/mini-app-sc
|
|
|
36
38
|
SimpleAppMiniAppsModule,
|
|
37
39
|
SimpleAppQueueConsumersModule,
|
|
38
40
|
SimpleAppMiniAppScopeModule,
|
|
41
|
+
CronModule
|
|
39
42
|
]
|
|
40
43
|
})
|
|
41
44
|
export class SimpleAppModule {}
|
|
@@ -103,6 +103,31 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
103
103
|
|
|
104
104
|
this.invites = res.invites;
|
|
105
105
|
this.moreProps = res.moreProps;
|
|
106
|
+
|
|
107
|
+
if (res.branches && Array.isArray(res.branches)) {
|
|
108
|
+
const currentBranch = res.branches.find(
|
|
109
|
+
(b: any) => b.branchId === res.branchId
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (currentBranch) {
|
|
113
|
+
this.branchCode = currentBranch.branchCode;
|
|
114
|
+
this.branchName = currentBranch.branchName;
|
|
115
|
+
this.branchRecordId = currentBranch.branch?._id || currentBranch.branchRecordId;
|
|
116
|
+
this.orgCode = currentBranch.orgCode;
|
|
117
|
+
this.orgName = currentBranch.orgName;
|
|
118
|
+
|
|
119
|
+
if (currentBranch.branch) {
|
|
120
|
+
this.branchInfo = {
|
|
121
|
+
...this.branchInfo,
|
|
122
|
+
_id: currentBranch.branch._id,
|
|
123
|
+
branchId: currentBranch.branchId,
|
|
124
|
+
branchCode: currentBranch.branchCode,
|
|
125
|
+
branchName: currentBranch.branchName,
|
|
126
|
+
imageUrl: currentBranch.branch.imageUrl,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
106
131
|
// this.package = res.moreProps.package;
|
|
107
132
|
// this.appintegration.einvoice = res.appintegration.einvoice;
|
|
108
133
|
// this.appintegration.simbiz6 = res.appintegration.simbiz6;
|