@simitgroup/simpleapp-generator 2.0.2-k-alpha → 2.0.2-m-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/package.json +2 -2
- package/templates/miniApi/src/constants/api-scopes.ts.eta +27 -0
- package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +51 -9
- package/templates/nest/src/simple-app/_core/utils/string-utils.ts.eta +4 -1
- package/templates/nuxt/app.vue.eta +6 -4
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -0
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +3 -1
- package/templates/nuxt/composables/date.generate.ts.eta +5 -5
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +11 -0
package/ReleaseNote.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
[2.0.2m-alpha]
|
|
2
|
+
|
|
3
|
+
1. Change date format follow DD/MM/YYYY instead of user laptop
|
|
4
|
+
2. Define isBillingUser, isInternalUser and isDevSupport for easy to called role
|
|
5
|
+
3. Add escapeRegExp for search student list
|
|
6
|
+
|
|
7
|
+
[2.0.2l-alpha]
|
|
8
|
+
|
|
9
|
+
1. Add direct debit mini api scope
|
|
10
|
+
|
|
1
11
|
[2.0.2k-alpha]
|
|
2
12
|
|
|
3
13
|
1. add permission devbilling can access tenant invoice page
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simitgroup/simpleapp-generator",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "frontend nuxtjs and backend nests code generator using jsonschema",
|
|
3
|
+
"version": "2.0.2m-alpha",
|
|
4
|
+
"description": "frontend nuxtjs and backend nests code generator using jsonschema.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"generate": "ts-node src/index.ts -c ./sampleconfig.json; pnpm exec prettier ./backend --write;pnpm exec prettier ./frontend --write",
|
|
@@ -117,6 +117,33 @@ const scopes = {
|
|
|
117
117
|
description: "Check online payment status",
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
|
+
|
|
121
|
+
directDebit: {
|
|
122
|
+
createDda: {
|
|
123
|
+
method: "post",
|
|
124
|
+
description: "Create direct debit authorization",
|
|
125
|
+
},
|
|
126
|
+
cancelDda: {
|
|
127
|
+
method: "post",
|
|
128
|
+
description: "Cancel direct debit authorization",
|
|
129
|
+
},
|
|
130
|
+
enquiryDdaByDdaRefNo: {
|
|
131
|
+
method: "get",
|
|
132
|
+
description: "Enquiry direct debit authorization by ref no",
|
|
133
|
+
},
|
|
134
|
+
createDdi: {
|
|
135
|
+
method: "post",
|
|
136
|
+
description: "Create direct debit instruction",
|
|
137
|
+
},
|
|
138
|
+
cancelDdi: {
|
|
139
|
+
method: "post",
|
|
140
|
+
description: "Cancel direct debit instruction",
|
|
141
|
+
},
|
|
142
|
+
enquiryDdiByDdiOrderNo: {
|
|
143
|
+
method: "get",
|
|
144
|
+
description: "Enquiry direct debit instruction by order no",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
120
147
|
};
|
|
121
148
|
|
|
122
149
|
export default scopes;
|
|
@@ -578,15 +578,9 @@ export class UserContext extends UserContextInfo {
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
// Tenant permissions for DevSupport
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
Role.Tenant_access,
|
|
585
|
-
Role.Tenant_search,
|
|
586
|
-
Role.Tenant_create,
|
|
587
|
-
Role.Tenant_update,
|
|
588
|
-
Role.Tenant_delete,
|
|
589
|
-
];
|
|
581
|
+
// Tenant permissions for DevSupport and DevBilling roles
|
|
582
|
+
const tenantRoles = [Role.Tenant_access, Role.Tenant_search, Role.Tenant_create, Role.Tenant_update, Role.Tenant_delete];
|
|
583
|
+
if (this.roles.includes(Role.DevSupport) || this.roles.includes(Role.DevBilling)) {
|
|
590
584
|
for (let r = 0; r < tenantRoles.length; r++) {
|
|
591
585
|
if (!this.roles.includes(tenantRoles[r])) {
|
|
592
586
|
this.roles.push(tenantRoles[r]);
|
|
@@ -614,6 +608,20 @@ export class UserContext extends UserContextInfo {
|
|
|
614
608
|
}
|
|
615
609
|
}
|
|
616
610
|
|
|
611
|
+
// Grant Admin role to DevSupport and DevBilling for e-invoice
|
|
612
|
+
if (this.roles.includes(Role.DevSupport) || this.roles.includes(Role.DevBilling)) {
|
|
613
|
+
if (!this.roles.includes(Role.Admin)) {
|
|
614
|
+
this.roles.push(Role.Admin);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Grant Billing role to DevBilling for tenant billing operations
|
|
619
|
+
if (this.roles.includes(Role.DevBilling)) {
|
|
620
|
+
if (!this.roles.includes(Role.Billing)) {
|
|
621
|
+
this.roles.push(Role.Billing);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
617
625
|
this.moreProps = this.setMoreProps(userProfile);
|
|
618
626
|
// this.package = userProfile['package'];
|
|
619
627
|
// this.appintegration = await this.setAppIntegration();
|
|
@@ -1159,6 +1167,40 @@ export class UserContext extends UserContextInfo {
|
|
|
1159
1167
|
}
|
|
1160
1168
|
}
|
|
1161
1169
|
|
|
1170
|
+
if (this.roles.includes(Role.DevSupport)) {
|
|
1171
|
+
const tenantRoles = [
|
|
1172
|
+
Role.Tenant_access,
|
|
1173
|
+
Role.Tenant_search,
|
|
1174
|
+
Role.Tenant_create,
|
|
1175
|
+
Role.Tenant_update,
|
|
1176
|
+
Role.Tenant_delete,
|
|
1177
|
+
];
|
|
1178
|
+
for (let r = 0; r < tenantRoles.length; r++) {
|
|
1179
|
+
if (!this.roles.includes(tenantRoles[r])) {
|
|
1180
|
+
this.roles.push(tenantRoles[r]);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
if (this.roles.includes(Role.DevBilling)) {
|
|
1186
|
+
const tenantInvoiceRoles = [
|
|
1187
|
+
Role.TenantInvoice_access,
|
|
1188
|
+
Role.TenantInvoice_search,
|
|
1189
|
+
Role.TenantInvoice_create,
|
|
1190
|
+
Role.TenantInvoice_update,
|
|
1191
|
+
Role.TenantInvoice_delete,
|
|
1192
|
+
Role.TenantInvoice_draft,
|
|
1193
|
+
Role.TenantInvoice_void,
|
|
1194
|
+
Role.TenantInvoice_confirm,
|
|
1195
|
+
Role.TenantInvoice_print,
|
|
1196
|
+
];
|
|
1197
|
+
for (let r = 0; r < tenantInvoiceRoles.length; r++) {
|
|
1198
|
+
if (!this.roles.includes(tenantInvoiceRoles[r])) {
|
|
1199
|
+
this.roles.push(tenantInvoiceRoles[r]);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1162
1204
|
this.moreProps = this.setMoreProps(userProfile);
|
|
1163
1205
|
} else {
|
|
1164
1206
|
this.logger.debug(`User ${this.uid} not exists in tenant (${this.tenantId})`);
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export const camelToKebab = (value) => value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
1
|
+
export const camelToKebab = (value) => value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
2
|
+
|
|
3
|
+
export const escapeRegExp = (value: string): string =>
|
|
4
|
+
value.replace(/[\\^$.*+?()\[\]{}|]/g, '\\$&');
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
<EventDocumentViewer></EventDocumentViewer>
|
|
10
10
|
<EventDecision/>
|
|
11
11
|
<EventNotification/>
|
|
12
|
+
<SubscriptionExpirationWarning/>
|
|
13
|
+
<SubscriptionFreeBanner/>
|
|
12
14
|
<NuxtPage/>
|
|
13
15
|
</NuxtLayout>
|
|
14
16
|
</template>
|
|
@@ -29,9 +31,9 @@ watch(()=>useRoute().fullPath,async (newval,oldvalue)=>{
|
|
|
29
31
|
if(getPathPara('xorg','')!=''){
|
|
30
32
|
|
|
31
33
|
if(getCurrentXorg()===''){
|
|
32
|
-
|
|
34
|
+
goTo('/picktenant')
|
|
33
35
|
}else if(!getUserProfile()?.currentGroup){
|
|
34
|
-
|
|
36
|
+
navigateTo('pickgroup')
|
|
35
37
|
}
|
|
36
38
|
setGraphqlServer()
|
|
37
39
|
}
|
|
@@ -54,9 +56,9 @@ onMounted(async()=>{
|
|
|
54
56
|
const currentgroup = useCookie('currentGroup').value
|
|
55
57
|
//if no xorg, no enforce pick group
|
|
56
58
|
if(getCurrentXorg()===''){
|
|
57
|
-
|
|
59
|
+
goTo('/picktenant')
|
|
58
60
|
}else if(!currentgroup){
|
|
59
|
-
|
|
61
|
+
navigateTo('/pickgroup')
|
|
60
62
|
}
|
|
61
63
|
setGraphqlServer()
|
|
62
64
|
}else{
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
getDocument(setting.fieldsetting['x-foreignkey']).viewer,
|
|
161
161
|
)
|
|
162
162
|
"
|
|
163
|
+
:paras="props.paras"
|
|
163
164
|
@after="
|
|
164
165
|
async (eventType: FormCrudEvent, data: any, result: any) =>
|
|
165
166
|
await afterRenderMobileForm(eventType, data)
|
|
@@ -206,6 +207,7 @@ const props = withDefaults(
|
|
|
206
207
|
componentProps?: AutoCompleteProps;
|
|
207
208
|
autocompleteFilter?: any;
|
|
208
209
|
pt?: any;
|
|
210
|
+
paras?: any;
|
|
209
211
|
}>(),
|
|
210
212
|
{
|
|
211
213
|
allowAddNew: true,
|
|
@@ -358,6 +360,7 @@ const openViewer = (readonly: boolean) => {
|
|
|
358
360
|
readonly: readonly,
|
|
359
361
|
viewer: getDocument(docname)?.viewer,
|
|
360
362
|
documentName: docname,
|
|
363
|
+
paras: props.paras,
|
|
361
364
|
|
|
362
365
|
//after create, auto copy value into auto complete
|
|
363
366
|
after: async (eventType: FormCrudEvent, data: any) => {
|
|
@@ -179,6 +179,7 @@
|
|
|
179
179
|
:readonly="isReadonly"
|
|
180
180
|
:placeholder="placeholder"
|
|
181
181
|
:autocomplete-filter="autocompleteFilter"
|
|
182
|
+
:paras="paras"
|
|
182
183
|
@change="onChange"
|
|
183
184
|
>
|
|
184
185
|
<template #header>
|
|
@@ -419,13 +420,14 @@ const props = withDefaults(
|
|
|
419
420
|
setting: any;
|
|
420
421
|
type?: string;
|
|
421
422
|
instancepath?: string;
|
|
422
|
-
options?: string[];
|
|
423
|
+
options?: string[] | Array<{ value: string; label: string }>;
|
|
423
424
|
hidelabel?: boolean;
|
|
424
425
|
readonly?: boolean;
|
|
425
426
|
autofocus?: boolean;
|
|
426
427
|
pt?: any;
|
|
427
428
|
placeholder?: string;
|
|
428
429
|
autocompleteFilter?: any;
|
|
430
|
+
paras?: any;
|
|
429
431
|
componentProps?:
|
|
430
432
|
| InputNumberProps
|
|
431
433
|
| InputSwitchProps
|
|
@@ -16,24 +16,24 @@ export const today = () => useDayjs()().format('YYYY-MM-DD')
|
|
|
16
16
|
/**
|
|
17
17
|
* convert date object or ISO8601 date become local datetime string
|
|
18
18
|
* @param date date|string
|
|
19
|
-
* @returns local shortform date-time
|
|
19
|
+
* @returns local shortform date-time (DD/MM/YYYY HH:mm)
|
|
20
20
|
*/
|
|
21
21
|
export const dateRenderToDateTimeStr = (date:Date|string) =>
|
|
22
|
-
|
|
22
|
+
useDayjs()(date).format('DD/MM/YYYY HH:mm')
|
|
23
23
|
/**
|
|
24
24
|
* convert date object or ISO datestring become local date string
|
|
25
25
|
* @param date date|string
|
|
26
|
-
* @returns local short form date
|
|
26
|
+
* @returns local short form date (DD/MM/YYYY)
|
|
27
27
|
*/
|
|
28
28
|
export const dateRenderToDateStr = (date:Date|string) =>
|
|
29
|
-
|
|
29
|
+
useDayjs()(date).format('DD/MM/YYYY')
|
|
30
30
|
/**
|
|
31
31
|
* convert date object or ISO datestring become time string (without seconds)
|
|
32
32
|
* @param date date|string
|
|
33
33
|
* @returns
|
|
34
34
|
*/
|
|
35
35
|
export const dateRenderToTimeStr = (date:Date|string) =>
|
|
36
|
-
|
|
36
|
+
useDayjs()(date).format('HH:mm')
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -327,6 +327,17 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
327
327
|
isExecutive() {
|
|
328
328
|
return this.currentGroup == "executive";
|
|
329
329
|
},
|
|
330
|
+
isBillingUser() {
|
|
331
|
+
const roles = this.roles;
|
|
332
|
+
return roles.includes("tenantowner") || roles.includes("billing") || roles.includes("superadmin") || roles.includes("devbilling") || roles.includes("devsupport");
|
|
333
|
+
},
|
|
334
|
+
isInternalUser() {
|
|
335
|
+
const roles = this.roles;
|
|
336
|
+
return roles.includes("superadmin") || roles.includes("devbilling") || roles.includes("devsupport");
|
|
337
|
+
},
|
|
338
|
+
isDevSupport() {
|
|
339
|
+
return this.roles.includes("devsupport");
|
|
340
|
+
},
|
|
330
341
|
},
|
|
331
342
|
});
|
|
332
343
|
|