@simitgroup/simpleapp-generator 2.0.0-e-alpha → 2.0.0-f-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 +10 -0
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -3
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/webhook.js +1 -1
- package/dist/generate.js +1 -1
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/index.ts +2 -2
- package/src/buildinschemas/{webhook.ts.backup → webhook.ts} +1 -1
- package/src/generate.ts +1 -1
- package/templates/basic/nest/module.ts.eta +2 -2
- package/templates/basic/nest/service.ts.eta +2 -2
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +15 -7
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +41 -42
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +11 -11
- package/templates/nest/src/simple-app/.core/features/log/log.controller.ts.eta +42 -0
- package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +11 -8
- package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +42 -12
- package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +23 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +13 -6
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +5 -2
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +6 -5
- package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +3 -3
- package/templates/nest/src/simple-app/.core/features/user-context/user.context.ts.eta +11 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +36 -36
- package/templates/nest/src/simple-app/.core/framework/base/simple-app.service.ts.eta +3 -3
- package/templates/nest/src/simple-app/mini-apps/mini-apps.module.ts._eta +14 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +5 -1
- package/templates/nuxt/components/form/FormDocnoformat.vue._eta +78 -17
- package/templates/nuxt/components/renderer/RendererDocHistories.vue._eta +90 -50
- package/templates/nuxt/composables/docformat.generate.ts.eta +2 -2
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +2 -2
- /package/src/buildinschemas/{documentnoformat.ts.backup → documentnoformat.ts} +0 -0
|
@@ -17,6 +17,36 @@ export class SimpleAppLogService {
|
|
|
17
17
|
// addEvent(data: any) {
|
|
18
18
|
// console.log('Add event into db:', data);
|
|
19
19
|
// }
|
|
20
|
+
//
|
|
21
|
+
async searchDocumentEvent(appUser: UserContext, documentName: string, id: string) {
|
|
22
|
+
const data = await this.doc.aggregate([
|
|
23
|
+
{ $match: { documentName: documentName, documentId: id } },
|
|
24
|
+
{
|
|
25
|
+
$lookup: {
|
|
26
|
+
from: 'user',
|
|
27
|
+
as: 'user',
|
|
28
|
+
localField: 'createdBy',
|
|
29
|
+
foreignField: 'uid',
|
|
30
|
+
pipeline: [{$match:{tenantId:appUser.getTenantId()}},{ $project: { fullName: 1 } }],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{ $unwind: '$user' },
|
|
34
|
+
{
|
|
35
|
+
$project: {
|
|
36
|
+
_id: 1,
|
|
37
|
+
fullName: '$user.fullName',
|
|
38
|
+
eventType:1,
|
|
39
|
+
createdBy: 1,
|
|
40
|
+
created: 1,
|
|
41
|
+
eventData: 1
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{$sort:{created:1}}
|
|
45
|
+
]);
|
|
46
|
+
// find({documentName:documentName,documentId:id},null,{session:appUser.getDBSession()})
|
|
47
|
+
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
20
50
|
async addEvent(appUser: UserContext, documentName: string, id: string, eventType: string, data: any) {
|
|
21
51
|
const eventdata: DocumentEvent = {
|
|
22
52
|
_id: crypto.randomUUID(),
|
|
@@ -24,13 +54,13 @@ export class SimpleAppLogService {
|
|
|
24
54
|
documentId: id,
|
|
25
55
|
eventType: eventType,
|
|
26
56
|
eventData: data,
|
|
27
|
-
created:'',
|
|
28
|
-
createdBy:'',
|
|
57
|
+
created: '',
|
|
58
|
+
createdBy: '',
|
|
29
59
|
updated: '',
|
|
30
|
-
updatedBy:'',
|
|
31
|
-
tenantId:0,
|
|
32
|
-
orgId:0,
|
|
33
|
-
branchId:0,
|
|
60
|
+
updatedBy: '',
|
|
61
|
+
tenantId: 0,
|
|
62
|
+
orgId: 0,
|
|
63
|
+
branchId: 0,
|
|
34
64
|
};
|
|
35
65
|
Object.assign(eventdata, appUser.getCreateFilter());
|
|
36
66
|
// console.log('add event', documentName, id, eventType);
|
|
@@ -51,13 +81,13 @@ export class SimpleAppLogService {
|
|
|
51
81
|
documentId: data.id,
|
|
52
82
|
eventType: eventType,
|
|
53
83
|
eventData: data,
|
|
54
|
-
created:'',
|
|
55
|
-
createdBy:'',
|
|
84
|
+
created: '',
|
|
85
|
+
createdBy: '',
|
|
56
86
|
updated: '',
|
|
57
|
-
updatedBy:'',
|
|
58
|
-
tenantId:0,
|
|
59
|
-
orgId:0,
|
|
60
|
-
branchId:0,
|
|
87
|
+
updatedBy: '',
|
|
88
|
+
tenantId: 0,
|
|
89
|
+
orgId: 0,
|
|
90
|
+
branchId: 0,
|
|
61
91
|
};
|
|
62
92
|
Object.assign(eventdata, appUser.getCreateFilter());
|
|
63
93
|
alldata.push(eventdata);
|
package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta
CHANGED
|
@@ -3,6 +3,28 @@ import { Field, ObjectType, ID } from '@nestjs/graphql';
|
|
|
3
3
|
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
|
|
4
4
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
5
5
|
|
|
6
|
+
@ObjectType()
|
|
7
|
+
export class DocumentEventListItem {
|
|
8
|
+
@Field()
|
|
9
|
+
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
10
|
+
_id: string;
|
|
11
|
+
@Field()
|
|
12
|
+
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
13
|
+
eventType: string;
|
|
14
|
+
@Field()
|
|
15
|
+
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
16
|
+
created: string;
|
|
17
|
+
@Field()
|
|
18
|
+
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
19
|
+
createdBy: string;
|
|
20
|
+
@Field()
|
|
21
|
+
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
22
|
+
fullName: string;
|
|
23
|
+
@Field(()=>GraphQLJSON)
|
|
24
|
+
@ApiProperty({ type: ()=>Object, required: false, format: 'uuid', default: '' })
|
|
25
|
+
eventData: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
6
28
|
@ObjectType()
|
|
7
29
|
@Schema()
|
|
8
30
|
export class DocumentEvent {
|
|
@@ -50,7 +72,7 @@ export class DocumentEvent {
|
|
|
50
72
|
@Field()
|
|
51
73
|
@ApiProperty({ type: 'string', required: false, example: ['create', 'delete'], default: '' })
|
|
52
74
|
eventType: string;
|
|
53
|
-
@Prop({type: ()=>Object})
|
|
75
|
+
@Prop({ type: () => Object })
|
|
54
76
|
@Field(() => GraphQLJSON)
|
|
55
77
|
@ApiProperty({ type: () => Object, required: false, default: {} })
|
|
56
78
|
eventData: Object;
|
|
@@ -5,7 +5,7 @@ import { PolicyService } from 'src/simple-app/.core/features/policy/policy.servi
|
|
|
5
5
|
import { Role } from 'src/simple-app/.core/features/auth/role-guard/roles.enum';
|
|
6
6
|
import { UserContext } from 'src/simple-app/.core/features/user-context/user.context';
|
|
7
7
|
import { MiniApp } from '../dto';
|
|
8
|
-
|
|
8
|
+
import * as plans from 'src/simple-app/features/subscription/license/plans'
|
|
9
9
|
@Injectable()
|
|
10
10
|
export class MiniAppManagerPolicyService {
|
|
11
11
|
readonly _RELEASED_STATUSES = [MiniAppStatusEnum.PUBLISHED];
|
|
@@ -30,11 +30,18 @@ export class MiniAppManagerPolicyService {
|
|
|
30
30
|
|
|
31
31
|
hasRequiredPlan(appUser: UserContext, miniApp: MiniApp) {
|
|
32
32
|
const currentPlan = appUser.tenantInfo.package;
|
|
33
|
-
const requiredPlans = miniApp.access.requiredPlans ?? [];
|
|
34
|
-
|
|
35
|
-
if
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// const requiredPlans = miniApp.access.requiredPlans ?? [];
|
|
34
|
+
|
|
35
|
+
if(plans[currentPlan]){
|
|
36
|
+
const plansetting = plans[currentPlan]()
|
|
37
|
+
return plansetting?.features?.advance?.features?.miniApp ?? false
|
|
38
|
+
|
|
39
|
+
}else{
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
42
|
+
// if (_.isEmpty(requiredPlans)) return true;
|
|
43
|
+
|
|
44
|
+
// return requiredPlans.includes(currentPlan);
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
isMiniAppRealeased(status: MiniAppStatusEnum) {
|
|
@@ -9,7 +9,7 @@ import { MiniAppInstallationService } from 'src/simple-app/.core/resources/mini-
|
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
import { MiniAppManagerPolicyService } from './mini-app-manager-policy.service';
|
|
11
11
|
import { MiniAppError } from './mini-app-manager.error';
|
|
12
|
-
|
|
12
|
+
import * as plans from 'src/simple-app/features/subscription/license/plans'
|
|
13
13
|
@Injectable()
|
|
14
14
|
export class MiniAppManagerService {
|
|
15
15
|
constructor(
|
|
@@ -82,7 +82,7 @@ export class MiniAppManagerService {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const permissions = this.getMiniAppActionAccess(appUser);
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
const installedMiniApps = miniAppInstallations.map((installation) => {
|
|
87
87
|
const miniApp = miniApps.find((miniApp) => miniApp._id === installation.miniApp._id);
|
|
88
88
|
if (!miniApp) {
|
|
@@ -176,6 +176,9 @@ export class MiniAppManagerService {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
private getMiniAppActionAccess(appUser: UserContext) {
|
|
179
|
+
const currentPlan = appUser.tenantInfo.package;
|
|
180
|
+
const planSetting = plans[currentPlan]()
|
|
181
|
+
|
|
179
182
|
return {
|
|
180
183
|
hasMiniAppFeature: this.policyService.hasFeature(appUser),
|
|
181
184
|
canInstall: this.policyService.canInstall(appUser),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { Role } from 'src/simple-app/.core/features/auth/role-guard/roles.enum';
|
|
3
3
|
import { UserContext } from 'src/simple-app/.core/features/user-context/user.context';
|
|
4
|
-
|
|
4
|
+
import * as plans from 'src/simple-app/features/subscription/license/plans'
|
|
5
5
|
@Injectable()
|
|
6
6
|
export class PolicyService {
|
|
7
7
|
private readonly _HIGH_PRIVILEGE_ROLES = [Role.SuperAdmin, Role.SuperUser, Role.TenantOwner];
|
|
@@ -27,11 +27,12 @@ export class PolicyService {
|
|
|
27
27
|
* - plans/pro.ts
|
|
28
28
|
* - plans/enterprise.ts
|
|
29
29
|
*/
|
|
30
|
-
hasFeature(appUser: UserContext, feature: keyof typeof this._FEATURES): boolean {
|
|
31
|
-
const appPackage = appUser.tenantInfo.package
|
|
30
|
+
hasFeature(appUser: UserContext, feature: keyof typeof this._FEATURES): boolean {
|
|
31
|
+
const appPackage = appUser.tenantInfo.package;
|
|
32
32
|
const allowedPlans = this._FEATURES[feature];
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const planSetting = plans[appPackage]();
|
|
34
|
+
const allowed = planSetting.features?.advance?.features[feature] ?? false;
|
|
35
|
+
return allowed
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
can(appUser: UserContext, role: Role) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Module } from '@nestjs/common';
|
|
8
8
|
|
|
9
9
|
import { SimpleAppAuthModule } from './auth/auth.module';
|
|
10
|
-
import {
|
|
10
|
+
import { SimpleAppDocumentNoFormatModule } from './document-no-format/document-no-format.module';
|
|
11
11
|
import { SimpleAppForeignKeyModule } from './foreign-key/foreign-key.module';
|
|
12
12
|
import { SimpleAppLogModule } from './log/log.module';
|
|
13
13
|
import { MaintenanceModule } from './maintenance/maintenance.module';
|
|
@@ -22,7 +22,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
|
|
|
22
22
|
imports: [
|
|
23
23
|
AutoIncreamentModule,
|
|
24
24
|
SimpleAppAuthModule,
|
|
25
|
-
|
|
25
|
+
SimpleAppDocumentNoFormatModule,
|
|
26
26
|
SimpleAppForeignKeyModule,
|
|
27
27
|
SimpleAppLogModule,
|
|
28
28
|
MaintenanceModule,
|
|
@@ -37,7 +37,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
|
|
|
37
37
|
exports: [
|
|
38
38
|
AutoIncreamentModule,
|
|
39
39
|
SimpleAppAuthModule,
|
|
40
|
-
|
|
40
|
+
SimpleAppDocumentNoFormatModule,
|
|
41
41
|
SimpleAppForeignKeyModule,
|
|
42
42
|
SimpleAppLogModule,
|
|
43
43
|
MaintenanceModule,
|
|
@@ -1000,6 +1000,17 @@ export class UserContext extends UserContextInfo {
|
|
|
1000
1000
|
return miniAppInstallation;
|
|
1001
1001
|
}
|
|
1002
1002
|
|
|
1003
|
+
async findInstalledMiniAppCode(miniAppCode: string) {
|
|
1004
|
+
const miniAppInstallation = await this.miniAppInstallationModel.findOne({
|
|
1005
|
+
'miniApp.code': miniAppCode,
|
|
1006
|
+
isActive: true,
|
|
1007
|
+
tenantId: this.tenantId,
|
|
1008
|
+
orgId: this.orgId,
|
|
1009
|
+
branchId: this.branchId,
|
|
1010
|
+
});
|
|
1011
|
+
return miniAppInstallation.miniApp;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1003
1014
|
async setUserProfileFromDB() {
|
|
1004
1015
|
// const userProfile = await this.obtainProfileFromDB();
|
|
1005
1016
|
// if (userProfile) {
|
|
@@ -9,132 +9,132 @@ import { Field, ObjectType, ID } from '@nestjs/graphql';
|
|
|
9
9
|
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
|
|
10
10
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
11
11
|
|
|
12
|
-
@ObjectType()
|
|
12
|
+
// @ObjectType()
|
|
13
13
|
@Schema({ collection: 'webhook' })
|
|
14
14
|
export class WebhookBasicAuth {
|
|
15
15
|
@Prop()
|
|
16
|
-
@Field()
|
|
16
|
+
// @Field()
|
|
17
17
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
18
18
|
user: string;
|
|
19
19
|
@Prop()
|
|
20
|
-
@Field()
|
|
20
|
+
// @Field()
|
|
21
21
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
22
22
|
password: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
@ObjectType()
|
|
25
|
+
// @ObjectType()
|
|
26
26
|
@Schema()
|
|
27
27
|
export class WebhookHeaders {
|
|
28
28
|
@Prop()
|
|
29
|
-
@Field()
|
|
29
|
+
// @Field()
|
|
30
30
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
31
31
|
name: string;
|
|
32
32
|
@Prop()
|
|
33
|
-
@Field()
|
|
33
|
+
// @Field()
|
|
34
34
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
35
35
|
value: string;
|
|
36
36
|
@Prop()
|
|
37
|
-
@Field()
|
|
37
|
+
// @Field()
|
|
38
38
|
@ApiProperty({ type: 'string', required: false, description: 'iso8601 dataempty mean new record', default: '' })
|
|
39
39
|
created: string;
|
|
40
40
|
@Prop()
|
|
41
|
-
@Field()
|
|
41
|
+
// @Field()
|
|
42
42
|
@ApiProperty({ type: 'string', required: false, description: 'iso8601 or empty', default: '' })
|
|
43
43
|
updated: string;
|
|
44
44
|
@Prop()
|
|
45
|
-
@Field()
|
|
45
|
+
// @Field()
|
|
46
46
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
47
47
|
createdBy: string;
|
|
48
48
|
@Prop()
|
|
49
|
-
@Field()
|
|
49
|
+
// @Field()
|
|
50
50
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
51
51
|
updatedBy: string;
|
|
52
52
|
@Prop()
|
|
53
|
-
@Field()
|
|
53
|
+
// @Field()
|
|
54
54
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
55
55
|
_id: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
@ObjectType()
|
|
58
|
+
// @ObjectType()
|
|
59
59
|
@Schema()
|
|
60
60
|
export class Webhook {
|
|
61
61
|
@Prop()
|
|
62
|
-
@Field()
|
|
62
|
+
// @Field()
|
|
63
63
|
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
64
64
|
_id?: string;
|
|
65
65
|
@Prop()
|
|
66
|
-
@Field()
|
|
66
|
+
// @Field()
|
|
67
67
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
68
68
|
created?: string;
|
|
69
69
|
@Prop()
|
|
70
|
-
@Field()
|
|
70
|
+
// @Field()
|
|
71
71
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
72
72
|
updated?: string;
|
|
73
73
|
@Prop()
|
|
74
|
-
@Field()
|
|
74
|
+
// @Field()
|
|
75
75
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
76
76
|
createdBy?: string;
|
|
77
77
|
@Prop()
|
|
78
|
-
@Field()
|
|
78
|
+
// @Field()
|
|
79
79
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
80
80
|
updatedBy?: string;
|
|
81
81
|
@Prop()
|
|
82
|
-
@Field()
|
|
82
|
+
// @Field()
|
|
83
83
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
84
84
|
tenantId?: number;
|
|
85
85
|
@Prop()
|
|
86
|
-
@Field()
|
|
86
|
+
// @Field()
|
|
87
87
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
88
88
|
orgId?: number;
|
|
89
89
|
@Prop()
|
|
90
|
-
@Field()
|
|
90
|
+
// @Field()
|
|
91
91
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
92
92
|
branchId?: number;
|
|
93
93
|
@Prop()
|
|
94
|
-
@Field()
|
|
94
|
+
// @Field()
|
|
95
95
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
96
96
|
title: string;
|
|
97
97
|
@Prop()
|
|
98
|
-
@Field()
|
|
98
|
+
// @Field()
|
|
99
99
|
@ApiProperty({ type: 'string', required: true, format: 'uri', default: '' })
|
|
100
100
|
url: string;
|
|
101
101
|
@Prop()
|
|
102
|
-
@Field()
|
|
102
|
+
// @Field()
|
|
103
103
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
104
104
|
requestMethod: string;
|
|
105
105
|
@Prop()
|
|
106
|
-
@Field()
|
|
106
|
+
// @Field()
|
|
107
107
|
@ApiProperty({ type: 'string', required: false, description: 'apikey authentication use none + headers props', default: '' })
|
|
108
108
|
authentication?: string;
|
|
109
109
|
@Prop()
|
|
110
|
-
@Field()
|
|
110
|
+
// @Field()
|
|
111
111
|
@ApiProperty({ type: 'string', required: false, format: 'text', default: '' })
|
|
112
112
|
description?: string;
|
|
113
113
|
@Prop()
|
|
114
|
-
@Field()
|
|
114
|
+
// @Field()
|
|
115
115
|
@ApiProperty({ type: 'string', required: false, description: 'POST,PUT body template', format: 'text', default: '*' })
|
|
116
116
|
body: string;
|
|
117
117
|
@Prop()
|
|
118
|
-
@Field()
|
|
118
|
+
// @Field()
|
|
119
119
|
@ApiProperty({ type: 'boolean', required: false, default: true })
|
|
120
120
|
active: boolean;
|
|
121
121
|
@Prop()
|
|
122
|
-
@Field()
|
|
122
|
+
// @Field()
|
|
123
123
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
124
124
|
resourceName: string;
|
|
125
125
|
@Prop()
|
|
126
|
-
@Field()
|
|
126
|
+
// @Field()
|
|
127
127
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
128
128
|
eventType: string;
|
|
129
129
|
@Prop()
|
|
130
|
-
@Field()
|
|
130
|
+
// @Field()
|
|
131
131
|
@ApiProperty({ type: 'string', required: false, description: 'temporary support realtime and roll-back-when-failed, 2nd way way throw error and roll back data if webhook failed.)', default: '' })
|
|
132
132
|
jobType: string;
|
|
133
133
|
@Prop()
|
|
134
|
-
@Field()
|
|
134
|
+
// @Field()
|
|
135
135
|
@ApiProperty({ type: 'number', required: false, description: 'retries how many time when webhook failed', default: 0 })
|
|
136
136
|
retryAttemps: number;
|
|
137
|
-
@Field()
|
|
137
|
+
// @Field()
|
|
138
138
|
@ApiProperty({ type: () => WebhookBasicAuth, required: false })
|
|
139
139
|
basicAuth?: WebhookBasicAuth;
|
|
140
140
|
@Prop()
|
|
@@ -144,21 +144,21 @@ export class Webhook {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/***************************************** Start Auto Complete *****************************************/
|
|
147
|
-
@ObjectType()
|
|
147
|
+
// @ObjectType()
|
|
148
148
|
@Schema()
|
|
149
149
|
export class WebhookAutoComplete {
|
|
150
150
|
@Prop()
|
|
151
|
-
@Field()
|
|
151
|
+
// @Field()
|
|
152
152
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
153
153
|
_id: string;
|
|
154
154
|
|
|
155
155
|
@Prop()
|
|
156
|
-
@Field()
|
|
156
|
+
// @Field()
|
|
157
157
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
158
158
|
code: string;
|
|
159
159
|
|
|
160
160
|
@Prop()
|
|
161
|
-
@Field()
|
|
161
|
+
// @Field()
|
|
162
162
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
163
163
|
label: string;
|
|
164
164
|
}
|
|
@@ -19,7 +19,7 @@ import { foreignkeys } from '../../features/foreign-key/foreignkeys.dict';
|
|
|
19
19
|
import { CustomException } from '../custom-exception';
|
|
20
20
|
|
|
21
21
|
import { camelToKebab } from 'src/simple-app/.core/utils/string-utils';
|
|
22
|
-
import {
|
|
22
|
+
import { SimpleAppDocumentNoFormatService } from '../../features/document-no-format/document-no-format.service';
|
|
23
23
|
import { UserContext } from '../../features/user-context/user.context';
|
|
24
24
|
import { RunWebhookService } from '../../features/webhook/run-webhook.service';
|
|
25
25
|
import { UniqueKeyExistResponse, DeleteResultType, IsolationType, MoreProjectionType, SchemaFields, TextSearchBody, PatchManyRequest } from '../schemas';
|
|
@@ -38,7 +38,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
38
38
|
// @Inject(AuditTrail)
|
|
39
39
|
// protected audittrail: AuditTrail;
|
|
40
40
|
// @Inject(DocNumberFormatGenerator)
|
|
41
|
-
protected docnogenerator:
|
|
41
|
+
protected docnogenerator: SimpleAppDocumentNoFormatService;
|
|
42
42
|
protected logger = new Logger();
|
|
43
43
|
protected strictIsolation = true;
|
|
44
44
|
protected jsonschema: any = {
|
|
@@ -65,7 +65,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
65
65
|
private logSvc:SimpleAppLogService;
|
|
66
66
|
// protected userprovider = new UserContext() ;
|
|
67
67
|
|
|
68
|
-
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org, eventEmitter: EventEmitter2, docnogenerator:
|
|
68
|
+
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org, eventEmitter: EventEmitter2, docnogenerator: SimpleAppDocumentNoFormatService,logSvc: SimpleAppLogService,runWebHook: RunWebhookService) {
|
|
69
69
|
// console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
|
|
70
70
|
this.eventEmitter = eventEmitter;
|
|
71
71
|
this.documentType = doctype.toUpperCase();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator.
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2025-09-01
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
import { Module } from '@nestjs/common';
|
|
8
|
+
@Module({
|
|
9
|
+
// QueueTuitionClassModule
|
|
10
|
+
imports: [],
|
|
11
|
+
providers: [],
|
|
12
|
+
exports: [],
|
|
13
|
+
})
|
|
14
|
+
export class SimpleAppMiniAppsModule {}
|
|
@@ -11,7 +11,7 @@ import {SimpleAppEventsModule} from './events/events.module'
|
|
|
11
11
|
import {SimpleAppFeaturesModule} from './features/features.module'
|
|
12
12
|
|
|
13
13
|
import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
14
|
-
|
|
14
|
+
import { SimpleAppMiniAppsModule } from './mini-apps/mini-apps.module';
|
|
15
15
|
|
|
16
16
|
@Module({
|
|
17
17
|
imports: [
|
|
@@ -19,6 +19,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
19
19
|
SimpleAppResourcesModule,
|
|
20
20
|
SimpleAppEventsModule,
|
|
21
21
|
SimpleAppResourceApiModule,
|
|
22
|
+
SimpleAppFeaturesModule,
|
|
23
|
+
SimpleAppMiniAppsModule
|
|
22
24
|
],
|
|
23
25
|
controllers: [],
|
|
24
26
|
providers: [],
|
|
@@ -27,6 +29,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
27
29
|
SimpleAppResourcesModule,
|
|
28
30
|
SimpleAppEventsModule,
|
|
29
31
|
SimpleAppResourceApiModule,
|
|
32
|
+
SimpleAppFeaturesModule,
|
|
33
|
+
SimpleAppMiniAppsModule
|
|
30
34
|
]
|
|
31
35
|
})
|
|
32
36
|
export class SimpleAppModule {}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
:document="doc"
|
|
8
8
|
@on="actionListener"
|
|
9
9
|
></SimpleAppFormToolBar>
|
|
10
|
-
<div
|
|
11
|
-
class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2"
|
|
12
|
-
>
|
|
10
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
13
11
|
<SimpleAppInput
|
|
14
12
|
:input-type="SimpleAppInputType.autocomplete"
|
|
15
13
|
:setting="o.getField('#/properties/branch')"
|
|
@@ -19,11 +17,15 @@
|
|
|
19
17
|
:readonly="!doc.isNew()"
|
|
20
18
|
:input-type="SimpleAppInputType.select"
|
|
21
19
|
:setting="o.getField('#/properties/docNoType')"
|
|
22
|
-
:options="
|
|
20
|
+
:options="
|
|
21
|
+
getAllDocFormats().map((item) => ({
|
|
22
|
+
label: docNoTypeMapping[item.docType] || item.docType,
|
|
23
|
+
value: item.docType,
|
|
24
|
+
}))
|
|
25
|
+
"
|
|
23
26
|
v-model="data.docNoType"
|
|
24
27
|
/>
|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
<SimpleAppInput
|
|
28
30
|
:input-type="SimpleAppInputType.text"
|
|
29
31
|
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
v-model="data.default"
|
|
48
50
|
/>
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
<SimpleAppInput
|
|
52
53
|
:input-type="SimpleAppInputType.text"
|
|
53
54
|
:setting="o.getField('#/properties/docNoPattern')"
|
|
@@ -65,27 +66,43 @@
|
|
|
65
66
|
</div>
|
|
66
67
|
</SimpleAppForm>
|
|
67
68
|
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
69
|
+
<DataTable
|
|
70
|
+
:value="formatParams"
|
|
71
|
+
class="p-datatable-sm mt-6"
|
|
72
|
+
stripedRows
|
|
73
|
+
responsiveLayout="scroll"
|
|
74
|
+
>
|
|
75
|
+
<template #header>
|
|
76
|
+
<div class="text-sm font-semibold">Format Parameters</div>
|
|
77
|
+
</template>
|
|
78
|
+
<Column
|
|
79
|
+
field="placeholder"
|
|
80
|
+
header="Placeholder"
|
|
81
|
+
style="width: 30%"
|
|
82
|
+
class="text-xs"
|
|
83
|
+
/>
|
|
84
|
+
<Column field="description" header="Description" class="text-xs" />
|
|
85
|
+
</DataTable>
|
|
68
86
|
</div>
|
|
69
87
|
</template>
|
|
70
88
|
|
|
71
89
|
<script setup lang="ts">
|
|
72
90
|
/**
|
|
73
|
-
* This file was automatically generated by simpleapp generator
|
|
74
|
-
* --remove-this-line-to-prevent-override--
|
|
91
|
+
* This file was automatically generated by simpleapp generator.
|
|
75
92
|
* last change 2024-02-16
|
|
76
93
|
* Author: Ks Tan
|
|
77
94
|
*/
|
|
78
95
|
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
96
|
+
import { DocumentNoFormat } from "~/simpleapp/generate/openapi";
|
|
97
|
+
import { DocumentnoformatDoc } from "~/simpleapp/docs/DocumentnoformatDoc";
|
|
81
98
|
|
|
82
99
|
const props = defineProps<{
|
|
83
100
|
_id?: string;
|
|
84
|
-
doc?:
|
|
85
|
-
paras?:
|
|
101
|
+
doc?: DocumentnoformatDoc;
|
|
102
|
+
paras?: Partial<DocumentNoFormat>;
|
|
86
103
|
}>();
|
|
87
104
|
|
|
88
|
-
const doc = props.doc ?? useNuxtApp().$
|
|
105
|
+
const doc = props.doc ?? useNuxtApp().$DocumentnoformatDoc()
|
|
89
106
|
const data = doc.getReactiveData();
|
|
90
107
|
const sample = ref("");
|
|
91
108
|
const emits = defineEmits(["after"]);
|
|
@@ -94,9 +111,41 @@ const id = computed(() => props._id ?? "");
|
|
|
94
111
|
/************ start default methods ****************/
|
|
95
112
|
|
|
96
113
|
const newData = () => {
|
|
97
|
-
doc.setNew()
|
|
98
|
-
delete data.value.branch
|
|
99
|
-
}
|
|
114
|
+
doc.setNew();
|
|
115
|
+
delete data.value.branch;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const formatParams = [
|
|
119
|
+
{
|
|
120
|
+
placeholder: "[0000]",
|
|
121
|
+
description: "0001 displays the transaction numbering.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
placeholder: "{YYYY}",
|
|
125
|
+
description: "Displays 4-digit current year (e.g., 2025-9999).",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
placeholder: "{YY}",
|
|
129
|
+
description: "Displays 2-digit current year (e.g., 25).",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
placeholder: "{MM}",
|
|
133
|
+
description: "Displays 2-digit current month (e.g., 01-12).",
|
|
134
|
+
},
|
|
135
|
+
{ placeholder: "{ddd}", description: "Displays current day (e.g., Tue)." },
|
|
136
|
+
{
|
|
137
|
+
placeholder: "{DD}",
|
|
138
|
+
description: "Displays 2-digit day of the month (e.g., 01-31).",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
placeholder: "{YYMM}",
|
|
142
|
+
description: "Displays 2-digit year and 2-digit month (e.g., 2504).",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
placeholder: "{YYYYMM}",
|
|
146
|
+
description: "Displays 4-digit year and 2-digit month (e.g., 202504).",
|
|
147
|
+
},
|
|
148
|
+
];
|
|
100
149
|
|
|
101
150
|
const getRecord = async () => {
|
|
102
151
|
if (id.value && id.value != "new") {
|
|
@@ -106,6 +155,18 @@ const getRecord = async () => {
|
|
|
106
155
|
}
|
|
107
156
|
};
|
|
108
157
|
|
|
158
|
+
const docNoTypeMapping: Record<string, string> = {
|
|
159
|
+
CN: "Credit Note",
|
|
160
|
+
ANNOUNCEMENT: "Announcement",
|
|
161
|
+
ENROLL: "Enrolment",
|
|
162
|
+
INV: "Invoice",
|
|
163
|
+
PAY: "Payment",
|
|
164
|
+
REFUND: "Refund",
|
|
165
|
+
STU: "Student",
|
|
166
|
+
TEACHER: "Teacher",
|
|
167
|
+
TUITION: "Tuition Class",
|
|
168
|
+
};
|
|
169
|
+
|
|
109
170
|
getRecord();
|
|
110
171
|
watch(id, async () => await getRecord());
|
|
111
172
|
/************ end default methods ****************/
|
|
@@ -134,7 +195,7 @@ onMounted(async () => {
|
|
|
134
195
|
// };
|
|
135
196
|
/************ end api methods ****************/
|
|
136
197
|
const updateSample = () => {
|
|
137
|
-
sample.value = "
|
|
198
|
+
sample.value = "Format Sample: " + previewDocNo();
|
|
138
199
|
};
|
|
139
200
|
|
|
140
201
|
const previewDocNo = (): string => {
|