@simitgroup/simpleapp-generator 2.0.0-l-alpha → 2.0.0-n-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.
Files changed (43) hide show
  1. package/ReleaseNote.md +10 -0
  2. package/dist/generate.d.ts.map +1 -1
  3. package/dist/generate.js +3 -1
  4. package/dist/generate.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/generate.ts +3 -1
  7. package/templates/basic/nest/controller.ts.eta +1 -1
  8. package/templates/basic/nest/service.ts.eta +3 -3
  9. package/templates/nest/src/main.ts._eta +12 -11
  10. package/templates/nest/src/simple-app/_core/features/auto-increament/auto-increament.service.ts.eta +1 -2
  11. package/templates/nest/src/simple-app/_core/features/cron/cron-system/cron-system.service.ts.eta +2 -2
  12. package/templates/nest/src/simple-app/_core/features/event/event.type.ts.eta +6 -0
  13. package/templates/nest/src/simple-app/_core/features/event/interface/event-after-patch.interface.ts.eta +5 -0
  14. package/templates/nest/src/simple-app/_core/features/event/interface/event-before-patch.interface.ts.eta +5 -0
  15. package/templates/nest/src/simple-app/_core/features/log/log.controller.ts.eta +3 -3
  16. package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.controller.ts.eta +6 -6
  17. package/templates/nest/src/simple-app/_core/features/profile/profile.controller.ts.eta +5 -4
  18. package/templates/nest/src/simple-app/_core/features/profile/profile.service.ts.eta +21 -22
  19. package/templates/nest/src/simple-app/_core/features/queue/queue-user-context/queue-user-context.service.ts.eta +2 -2
  20. package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +17 -5
  21. package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +18 -18
  22. package/templates/nest/src/simple-app/_core/framework/generator-version.ts.eta +1 -0
  23. package/templates/nest/src/simple-app/apis/additional-api.module.ts._eta +17 -0
  24. package/templates/nest/src/simple-app/apis/resource-api.module.ts.eta +2 -1
  25. package/templates/nest/src/simple-app/events/branch-event/branch-event.service.ts._eta +7 -7
  26. package/templates/nest/src/simple-app/events/organization-event/organization-event.service.ts._eta +5 -5
  27. package/templates/nest/src/simple-app/events/permission-event/permission-event.service.ts.eta +1 -1
  28. package/templates/nest/src/simple-app/events/tenant-event/tenant-event.service.ts_eta +3 -3
  29. package/templates/nuxt/components/image/ImageOrganization.vue._eta +39 -34
  30. package/templates/nuxt/composables/goTo.generate.ts.eta +56 -42
  31. package/templates/nuxt/composables/roles.generate.ts.eta +6 -6
  32. package/templates/nuxt/composables/stringHelper.generate.ts.eta +1 -1
  33. package/templates/nuxt/pages/profile.vue._eta +1 -0
  34. package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +1 -1
  35. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +44 -35
  36. package/templates/nuxt/server/api/profile/[...].ts.eta +1 -1
  37. package/templates/nuxt/simpleapp/generate/commons/generator-version.ts.eta +1 -0
  38. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +1 -1
  39. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +1 -1
  40. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +1 -1
  41. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta +7 -2
  42. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/bridge.type.ts.eta +2 -0
  43. package/templates/nest/src/simple-app/_core/utils/encryption.static.ts.eta +0 -73
@@ -214,10 +214,10 @@ export class UserContext extends UserContextInfo {
214
214
  this.setXOrg(xOrg);
215
215
  await this.setUserToken(tokenstr);
216
216
  this.setUserType('normal');
217
- // branchId: this.getBranchId(), active: true
217
+ // branchId: this.getBranchId(), active: true
218
218
  const wh = await webhookModel.find({});
219
219
  if (Array.isArray(wh) && wh.length > 0) {
220
- this.webhooks = this.webhooks.concat(wh);
220
+ this.webhooks = this.webhooks.concat(wh);
221
221
  }
222
222
  };
223
223
 
@@ -492,7 +492,7 @@ export class UserContext extends UserContextInfo {
492
492
  this.ssoACL = <Record<string, { roles: string[] }>>tokeninfo?.resource_access ?? {};
493
493
  this.logger.debug(`User found ${this.uid}`);
494
494
 
495
- const userProfile = await this.obtainProfileFromDB();
495
+ const userProfile = await this.obtainProfileFromDB();
496
496
  if (userProfile) {
497
497
  this.logger.debug(`User ${this.uid} exists in tenant (${this.tenantId})`);
498
498
 
@@ -523,6 +523,19 @@ export class UserContext extends UserContextInfo {
523
523
  support: false,
524
524
  };
525
525
  this.roles = userProfile['roles'] ?? [Role.Everyone, Role.User];
526
+
527
+ // console.log("rolegroups",rolegroups)
528
+ for (const group of this.groups) {
529
+ const roles: Role[] = rolegroups[group]()
530
+ //(<() => Role[]>rolegroups[group])();
531
+ for (let r = 0; r < roles.length; r++) {
532
+ if (!this.roles.includes(roles[r])) {
533
+ this.roles.push(roles[r]);
534
+ }
535
+ }
536
+ }
537
+
538
+
526
539
  this.moreProps = this.setMoreProps(userProfile);
527
540
  // this.package = userProfile['package'];
528
541
  // this.appintegration = await this.setAppIntegration();
@@ -534,7 +547,7 @@ export class UserContext extends UserContextInfo {
534
547
 
535
548
  if (this.isRealmAdmin() && !this.roles.includes(Role.SuperAdmin)) {
536
549
  this.roles.push(Role.SuperAdmin);
537
- }
550
+ }
538
551
  // this.logger.verbose(`User ${this.uid} have _id (${this.getId()}), groups (${this.groups.join(',')}) and roles (${this.getRoles().join(',')}).`);
539
552
  };
540
553
 
@@ -922,7 +935,6 @@ export class UserContext extends UserContextInfo {
922
935
  // }
923
936
  }
924
937
 
925
-
926
938
  return results;
927
939
  }
928
940
 
@@ -63,7 +63,7 @@ export class SimpleAppService<T extends SchemaFields> {
63
63
  protected withDocNumberFormat = false;
64
64
  protected foreignkeys = {};
65
65
  private eventEmitter: EventEmitter2;
66
- private logSvc: SimpleAppLogService;
66
+ private logService: SimpleAppLogService;
67
67
  // protected userprovider = new UserContext() ;
68
68
 
69
69
  constructor(
@@ -73,7 +73,7 @@ export class SimpleAppService<T extends SchemaFields> {
73
73
  isolationtype: IsolationType = IsolationType.org,
74
74
  eventEmitter: EventEmitter2,
75
75
  docnogenerator: SimpleAppDocumentNoFormatService,
76
- logSvc: SimpleAppLogService,
76
+ logService: SimpleAppLogService,
77
77
  runWebHook: RunWebhookService,
78
78
  ) {
79
79
  // console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
@@ -83,7 +83,7 @@ export class SimpleAppService<T extends SchemaFields> {
83
83
  this.doc = newdoc;
84
84
  this.docnogenerator = docnogenerator;
85
85
  this.isolationtype = isolationtype;
86
- this.logSvc = logSvc;
86
+ this.logService = logService;
87
87
  this.runWebHook = runWebHook;
88
88
  // this.tenantdoc = tenantdoc
89
89
  }
@@ -479,16 +479,14 @@ export class SimpleAppService<T extends SchemaFields> {
479
479
  if (dbsession && !dbsession.inTransaction()) {
480
480
  dbsession.startTransaction({ readPreference: 'primary' });
481
481
  }
482
-
483
- try{
482
+
483
+ try {
484
484
  const result = await this.doc.insertMany(datas, { session: dbsession });
485
- await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
485
+ await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
486
486
  return result;
487
- }catch(e){
488
- throw e
487
+ } catch (e) {
488
+ throw e;
489
489
  }
490
-
491
-
492
490
  } else {
493
491
  throw new BadRequestException(this.getDocumentType() + ': create many only support array');
494
492
  }
@@ -600,7 +598,7 @@ export class SimpleAppService<T extends SchemaFields> {
600
598
  appuser.addInsertedRecordId(this.documentName, result._id);
601
599
  } catch (err) {
602
600
  this.logger.error(err);
603
- throw err
601
+ throw err;
604
602
  }
605
603
 
606
604
  try {
@@ -786,7 +784,7 @@ export class SimpleAppService<T extends SchemaFields> {
786
784
  await this.identifyForeignKeys(appuser, data);
787
785
 
788
786
  //new way of hook
789
- await this.runEvent(appuser, `${this.documentName}.beforeUpdate`, { id: id, prevData: existingdata, newData: data }, false);
787
+ await this.runEvent(appuser, this.setHookName('beforeUpdate'), { id: id, prevData: existingdata, newData: data }, false);
790
788
 
791
789
  // if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
792
790
 
@@ -845,7 +843,7 @@ export class SimpleAppService<T extends SchemaFields> {
845
843
 
846
844
  await this.identifyForeignKeys(appuser, data);
847
845
 
848
- await this.runEvent(appuser, `${this.documentName}.beforeUpdate`, { data: data }, false);
846
+ await this.runEvent(appuser, this.setHookName('beforeUpdate'), { data: data }, false);
849
847
 
850
848
  // if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
851
849
 
@@ -904,7 +902,7 @@ export class SimpleAppService<T extends SchemaFields> {
904
902
 
905
903
  //patch not suitable trigger afterupdate
906
904
  // if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
907
-
905
+ await this.runEvent(appuser, this.setHookName('beforePatch'), { id: id, patchData: data,prevData:existingdata }, false);
908
906
  const dbsession = appuser.getDBSession();
909
907
  if (dbsession && !dbsession.inTransaction()) {
910
908
  dbsession.startTransaction({ readPreference: 'primary' });
@@ -937,7 +935,7 @@ export class SimpleAppService<T extends SchemaFields> {
937
935
  await this.addAuditEvent(appuser, this.documentName, id, 'patch', data);
938
936
  }
939
937
  appuser.addUpdatedRecordId(this.documentName, data._id);
940
-
938
+ await this.runEvent(appuser, this.setHookName('afterPatch'), { id: id, patchData: data, prevData:existingdata }, false);
941
939
  return result; //await this.findById(appuser, id);
942
940
  } catch (err) {
943
941
  this.logger.error(err.message, 'findIdThenPath error');
@@ -1092,11 +1090,13 @@ export class SimpleAppService<T extends SchemaFields> {
1092
1090
  * @param {any} data The data
1093
1091
  * @return {Promise} { description_of_the_return_value }
1094
1092
  */
1095
- async runEvent(appuser: UserContext, eventName: string, payloads: any, enforce: boolean = true) {
1093
+ async runEvent(appuser: UserContext, eventName: string, payloads: any, enforce: boolean = true) {
1096
1094
  try {
1097
1095
  if (enforce && !this.eventEmitter.hasListeners(eventName)) {
1098
1096
  throw new InternalServerErrorException(`${eventName} seems no listener`);
1099
1097
  } else if (this.eventEmitter.hasListeners(eventName)) {
1098
+
1099
+ console.log("run eventName",eventName)
1100
1100
  const res = await this.eventEmitter.emitAsync(eventName, appuser, payloads);
1101
1101
 
1102
1102
  if (!res) {
@@ -1298,9 +1298,9 @@ export class SimpleAppService<T extends SchemaFields> {
1298
1298
  }
1299
1299
 
1300
1300
  async addAuditEvent(appUser: UserContext, documentName: string, id: string, eventType: string, data: any) {
1301
- await this.logSvc.addEvent(appUser, documentName, id, eventType, data);
1301
+ await this.logService.addEvent(appUser, documentName, id, eventType, data);
1302
1302
  }
1303
1303
  async addManyAuditEvents(appUser: UserContext, documentName: string, eventType: string, datas: any) {
1304
- await this.logSvc.addManyEvents(appUser, documentName, eventType, datas);
1304
+ await this.logService.addManyEvents(appUser, documentName, eventType, datas);
1305
1305
  }
1306
1306
  }
@@ -0,0 +1 @@
1
+ export const generatorVersion='<%=it.version%>'
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. It is changable.
3
+ * last change 2025-09-023
4
+ * --remove-this-line-to-prevent-override--
5
+ * Author: Ks Tan
6
+ */
7
+ import { Module } from '@nestjs/common';
8
+ @Module({
9
+ imports: [
10
+
11
+ ],
12
+ controllers: [],
13
+ providers: [],
14
+ exports: [
15
+ ],
16
+ })
17
+ export class AdditionalApiModule { }
@@ -5,6 +5,7 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { Module } from '@nestjs/common';
8
+ import { AdditionalApiModule } from './additional-api.module';
8
9
  <% const loadapi = true; %>
9
10
  <% for(let i=0;i<it.modules.length; i++){ %>
10
11
  <% let obj = it.modules[i]%>
@@ -15,7 +16,7 @@ import { Module } from '@nestjs/common';
15
16
 
16
17
 
17
18
  @Module({
18
- imports: [
19
+ imports: [AdditionalApiModule,
19
20
  <% for(let i=0;i<it.modules.length; i++){ %>
20
21
  <% let obj = it.modules[i]%>
21
22
  <% if( loadapi && obj.api && obj.api.length>0 && !getSystemResources().includes(obj.docname)){%>
@@ -12,15 +12,15 @@ import { GenerateLogoService } from 'src/simple-app/features/generate-image/gene
12
12
  @Injectable()
13
13
  export class BranchEventService implements EventBeforeCreate<Branch>, EventAfterCreate<Branch> {
14
14
  constructor(
15
- private branchSvc: BranchService,
16
- private autoIncreamentSvc: AutoIncreamentService,
17
- private docNoGeneratorSvc: DocumentNoFormatService,
18
- private generateLogoSvc: GenerateLogoService,
15
+ private branchService: BranchService,
16
+ private autoIncreamentService: AutoIncreamentService,
17
+ private docNoGeneratorService: DocumentNoFormatService,
18
+ private generateLogoService: GenerateLogoService,
19
19
  ) {}
20
20
 
21
21
  @OnEvent('branch.before-create')
22
22
  async beforeCreate(appUser: UserContext, payload: CreatePayload<Branch>) {
23
- const searchresult = await this.autoIncreamentSvc.runGenerateNextNo(appUser, 'branch', 'branchId');
23
+ const searchresult = await this.autoIncreamentService.runGenerateNextNo(appUser, 'branch', 'branchId');
24
24
  payload.data.branchId = searchresult.nextNo;
25
25
  console.log('branch.before-create', payload);
26
26
  }
@@ -33,8 +33,8 @@ export class BranchEventService implements EventBeforeCreate<Branch>, EventAfter
33
33
  throw new BadRequestException('Create branch failed due to branchId=0')
34
34
  }
35
35
 
36
- await this.docNoGeneratorSvc.generateBranchDefaultDocNumbers(appUser, data);
37
- await this.generateLogoSvc.generateLogo(appUser, data.branchName, data._id, data.tenantId, data.orgId, data.branchId);
36
+ await this.docNoGeneratorService.generateBranchDefaultDocNumbers(appUser, data);
37
+ await this.generateLogoService.generateLogo(appUser, data.branchName, data._id, data.tenantId, data.orgId, data.branchId);
38
38
  }catch(e){
39
39
  return e
40
40
  }
@@ -17,14 +17,14 @@ export class OrganizationEventService implements
17
17
  EventBeforeUpdate<Organization>
18
18
  {
19
19
  constructor(
20
- private organizationSvc: OrganizationService,
21
- private autoIncreamentSvc: AutoIncreamentService,
22
- private generateLogoSvc: GenerateLogoService,
20
+ private organizationService: OrganizationService,
21
+ private autoIncreamentService: AutoIncreamentService,
22
+ private generateLogoService: GenerateLogoService,
23
23
  ) {}
24
24
 
25
25
  @OnEvent('organization.before-create',{suppressErrors:false})
26
26
  async beforeCreate(appUser: UserContext, payload: CreatePayload<Organization>) {
27
- const searchresult = await this.autoIncreamentSvc.runGenerateNextNo(appUser, 'organization', 'orgId');
27
+ const searchresult = await this.autoIncreamentService.runGenerateNextNo(appUser, 'organization', 'orgId');
28
28
  payload.data.orgId = searchresult.nextNo;
29
29
  console.log('organization.before-create', payload);
30
30
  }
@@ -35,7 +35,7 @@ export class OrganizationEventService implements
35
35
  if (data.orgId == 0) {
36
36
  throw new BadRequestException('Create branch failed due to orgId=0');
37
37
  }
38
- // await this.generateLogoSvc.generateLogo(appUser, data.orgName, data._id, data.tenantId, data.orgId, data.organizationId);
38
+ // await this.generateLogoService.generateLogo(appUser, data.orgName, data._id, data.tenantId, data.orgId, data.organizationId);
39
39
  }
40
40
 
41
41
  @OnEvent('organization.after-create',{suppressErrors:false})
@@ -9,7 +9,7 @@ import { CreatePayload } from 'src/simple-app/_core/features/event/event.type';
9
9
  @Injectable()
10
10
  export class PermissionEventService implements EventBeforeCreate<Permission>, EventAfterCreate<Permission> {
11
11
  constructor(
12
- private permissionSvc: PermissionService,
12
+ private permissionService: PermissionService,
13
13
  ) {}
14
14
 
15
15
  @OnEvent('permission.before-create')
@@ -10,13 +10,13 @@ import { AutoIncreamentService } from 'src/simple-app/_core/features/auto-increa
10
10
  @Injectable()
11
11
  export class TenantEventService implements EventBeforeCreate<Tenant>, EventAfterCreate<Tenant> {
12
12
  constructor(
13
- private tenantSvc: TenantService,
14
- private autoIncreamentSvc: AutoIncreamentService,
13
+ private tenantService: TenantService,
14
+ private autoIncreamentService: AutoIncreamentService,
15
15
  ) {}
16
16
 
17
17
  @OnEvent('tenant.before-create')
18
18
  async beforeCreate(appUser: UserContext, payload: CreatePayLoad<Tenant>) {
19
- const searchresult = await this.autoIncreamentSvc.runGenerateNextNo(appUser, 'tenant', 'tenantId');
19
+ const searchresult = await this.autoIncreamentService.runGenerateNextNo(appUser, 'tenant', 'tenantId');
20
20
  payload.data.tenantId = searchresult.nextNo;
21
21
  }
22
22
 
@@ -5,30 +5,25 @@
5
5
  #default
6
6
  :class="` place-content-center bg-white rounded-md`"
7
7
  @image-uploaded="handleBase64"
8
- :imagePath="imagepath"
8
+ :src="`${server}/organizations/${orgId}`"
9
9
  >
10
- <!-- {{console.log("imagepath",imagepath)}} -->
11
10
  <NuxtImg
12
- v-if="orgRecordId"
13
- class="w-full h-full rounded-md"
11
+ v-if="orgId"
12
+ class="w-full h-full rounded-lg"
14
13
  :key="imageKey"
15
- :src="imagepath"
16
- placeholder="/images/organization.png"
17
- @error="onError"
14
+ :src="`${server}/organizations/${orgId}`"
15
+ :placeholder="`/organizations/${props.orgId}`"
18
16
  />
19
17
  </ImageToBase64Uploader>
20
- <div
21
- v-else
22
- :class="` inline-block rounded-md bg-white text-black`"
23
- >
24
- <!-- {{console.log("imagepath",imagepath)}} -->
25
-
18
+ <div v-else :class="` inline-block rounded-md bg-white text-black`">
26
19
  <NuxtImg
27
- v-if="orgRecordId"
28
- class="rounded-md min-w-10 min-h-10 h-full"
29
- :src="imagepath"
30
- placeholder="/images/organization.png"
31
- @error="onError"
20
+ v-if="orgId"
21
+ class="w-full h-full rounded-lg"
22
+ :width="size"
23
+ :height="size"
24
+ :src="`${server}/organizations/${orgId}`"
25
+ :key="imageKey"
26
+ :placeholder="`/organizations/${props.orgId}`"
32
27
  />
33
28
  </div>
34
29
  </div>
@@ -36,42 +31,52 @@
36
31
  <script lang="ts" setup>
37
32
  import { PHOTOSIZE } from "~/types";
38
33
  // import {KeyValue} from ''
34
+ const server = useRuntimeConfig().public.imageUrl;
35
+ console.log("server", server);
36
+ const uploading = ref(false);
37
+ const emits = defineEmits(["upload"]);
39
38
  const props = defineProps<{
40
39
  changable?: boolean;
40
+ orgId: number;
41
41
  orgRecordId?: string;
42
42
  size: PHOTOSIZE;
43
43
  }>();
44
44
  const imageKey = ref(0);
45
- const orgRecordId = computed(
46
- () => props.orgRecordId ?? getUserProfile()?.orgRecordId,
47
- );
48
- const xorgpath = getCurrentXorg() ? `${getCurrentXorg()}/` : "MC0wLTA/";
49
- const size = props.size ?? PHOTOSIZE.S64;
50
- const path = useOrganizationInfo().getBranchPhotoUrl(orgRecordId.value, size);
51
- const imagepath = ref(path)
52
45
 
53
46
 
47
+ useNuxtApp().$listen("RefreshPhoto", (resource: string[]) => {
48
+ if (resource[0] == "organization" && resource[1] == props.orgRecordId) {
49
+ imageKey.value = new Date().getTime();
50
+ }
51
+ });
52
+
54
53
  watch(
55
- () => props.orgRecordId,
54
+ () => props.orgId,
56
55
  () => imageKey.value++,
57
56
  );
58
57
  const handleBase64 = async (data: string) => {
59
58
  const keyvalue = {
60
- key: "organizations/" + props.orgRecordId,
59
+ key: "organizations/" + props.orgId,
61
60
  value: data,
61
+ id: props.orgRecordId,
62
62
  };
63
+ uploading.value = true;
63
64
  // console.log("upload logo ", data);
64
65
  const uploadok = await useNuxtApp()
65
66
  .$OrganizationDoc()
66
67
  .getApi()
67
- .runUploadPhoto(orgRecordId.value,keyvalue)
68
+ .runUploadPhoto(<string>props.orgRecordId, keyvalue);
68
69
  if (uploadok) {
69
- const realpath = `/api/${imagepath}`;
70
- await fetch(realpath, { cache: "reload", credentials: "include" });
71
- imageKey.value++;
70
+ imageKey.value = new Date().getTime();
71
+ uploading.value = false;
72
+ emits("upload", keyvalue.key);
73
+ setTimeout(() => {
74
+ useNuxtApp().$event("RefreshPhoto", [
75
+ "organization",
76
+ <string>props.orgRecordId ,
77
+ keyvalue.key ?? "",
78
+ ]);
79
+ }, 1500);
72
80
  }
73
81
  };
74
- const onError = () => {
75
- imagepath.value = "/images/organization.png";
76
- };
77
82
  </script>
@@ -4,50 +4,64 @@
4
4
  * last change 2023-10-28
5
5
  * Author: Ks Tan
6
6
  */
7
- export const getDocumentUrl = (document:string,id?:string,querystr?:string)=>{
8
-
9
- let path = `/${getCurrentXorg()}/${document}`
10
- if(id){
11
- path = path + '/'+id
12
- }
13
- if(querystr){
14
- path=path+'?'+querystr
15
- }
16
- return path
17
- }
7
+ export const getDocumentUrl = (
8
+ document: string,
9
+ id?: string,
10
+ querystr?: string,
11
+ ) => {
12
+ let path = `/${getCurrentXorg()}/${document}`;
13
+ if (id) {
14
+ path = path + "/" + id;
15
+ }
16
+ if (querystr) {
17
+ path = path + "?" + querystr;
18
+ }
19
+ return path;
20
+ };
18
21
 
19
- export const getPathResource=()=>{
20
- return useRoute().path.toString().replace('/'+getCurrentXorg(),'')
21
- }
22
-
23
- export const goTo = (document:string,id?:string,querystr?:string)=>{
24
- navigateTo(getDocumentUrl(document,id,querystr))
25
- }
22
+ export const getPathResource = () => {
23
+ return useRoute()
24
+ .path.toString()
25
+ .replace("/" + getCurrentXorg(), "");
26
+ };
26
27
 
28
+ export const goTo = (
29
+ document: string,
30
+ id?: string,
31
+ querystr?: string,
32
+ options?: Parameters<typeof navigateTo>[1],
33
+ ) => {
34
+ navigateTo(getDocumentUrl(document, id, querystr), options);
35
+ };
27
36
 
28
37
  export const goBranch = (branchRecordId: string) => {
29
- const parenturl = getDocumentUrl("organization");
30
- const branchUrl = `${parenturl}/${branchRecordId}`;
31
- navigateTo(branchUrl);
32
- };
38
+ const parenturl = getDocumentUrl("organization");
39
+ const branchUrl = `${parenturl}/${branchRecordId}`;
40
+ navigateTo(branchUrl);
41
+ };
33
42
 
34
- export const getPathPara = (paraname:string,emptyvalue:string=''):string=>{
35
- const paravalue = useRoute().params[paraname]
36
- if(paravalue){
37
- return paravalue.toString()
38
- }else{
39
- return emptyvalue
40
- }
41
- }
42
- export const getPathQuery = (paraname:string,emptyvalue:string|string[]=''):string|string[]=>{
43
- const paravalue = useRoute().query[paraname]
44
- if( paraname.includes('[')){
45
- return (typeof paravalue == 'string'? [paravalue] : paravalue) as string[]
46
- }else if(typeof paravalue == 'string'){
47
- return paravalue.toString()
48
- }
49
- else{
50
- return emptyvalue
51
- }
52
- }
53
- export const setCurrentUrl = (path:string)=>useRouter().push({path:path})
43
+ export const getPathPara = (
44
+ paraname: string,
45
+ emptyvalue: string = "",
46
+ ): string => {
47
+ const paravalue = useRoute().params[paraname];
48
+ if (paravalue) {
49
+ return paravalue.toString();
50
+ } else {
51
+ return emptyvalue;
52
+ }
53
+ };
54
+ export const getPathQuery = (
55
+ paraname: string,
56
+ emptyvalue: string | string[] = "",
57
+ ): string | string[] => {
58
+ const paravalue = useRoute().query[paraname];
59
+ if (paraname.includes("[")) {
60
+ return (typeof paravalue == "string" ? [paravalue] : paravalue) as string[];
61
+ } else if (typeof paravalue == "string") {
62
+ return paravalue.toString();
63
+ } else {
64
+ return emptyvalue;
65
+ }
66
+ };
67
+ export const setCurrentUrl = (path: string) => useRouter().push({ path: path });
@@ -13,14 +13,14 @@ const allroles:roletype[] = [
13
13
  <% for(let i=0;i<it.modules.length; i++){ %>
14
14
  <% const m = it.modules[i] %>
15
15
  <% const appconfig = m.schema["x-simpleapp-config"] %>
16
- {resource: '<%=m.docname%>', action:'access'},
17
- {resource: '<%=m.docname%>', action:'create'},
18
- {resource: '<%=m.docname%>', action:'update'},
19
- {resource: '<%=m.docname%>', action:'delete'},
20
- {resource: '<%=m.docname%>', action:'search'},
16
+ {resource: '<%=m.typename%>', action:'access'},
17
+ {resource: '<%=m.typename%>', action:'create'},
18
+ {resource: '<%=m.typename%>', action:'update'},
19
+ {resource: '<%=m.typename%>', action:'delete'},
20
+ {resource: '<%=m.typename%>', action:'search'},
21
21
  <% if(Array.isArray(appconfig?.allStatus) && appconfig.allStatus.length>0){%>
22
22
  <% for(let sindex=0;sindex<appconfig.allStatus.length;sindex++){%>
23
- {resource: '<%=m.docname%>', action:'<%=appconfig.allStatus[sindex].status%>'},
23
+ {resource: '<%=m.typename%>', action:'<%=appconfig.allStatus[sindex].status%>'},
24
24
  <%}%>
25
25
  <%}%>
26
26
  <%}%>
@@ -23,7 +23,7 @@ export const md5=(s:string)=> new Md5().appendStr(s).end()
23
23
  // }
24
24
  export const getAvatarByUid = (id:string, size?:number):string=>{
25
25
  if(size===undefined)size=160
26
- return `${useRuntimeConfig().public.avatarUrl}/${md5(id)}?size=${size}`
26
+ return `${useRuntimeConfig().public.imageUrl}/id?width=${size}&height=${size}`
27
27
  }
28
28
  export const updateAvatarVersion = ()=>{
29
29
  myAvatarVersion.value++
@@ -89,6 +89,7 @@
89
89
  {{ t("more") }}
90
90
  <p class="text-danger-600">{{ t("onlyAppearInDebugMode") }}</p>
91
91
  <p class="text-danger-600">{{ getUserProfile().sessionId }}</p>
92
+ <div>generator: {{generatorVersion}} </div>
92
93
  </dt>
93
94
  <dd
94
95
  class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"
@@ -13,7 +13,7 @@ import {
13
13
  MINIAPPMANAGERApi,
14
14
  } from "~/simpleapp/generate/openapi";
15
15
  import { MiniAppFormWithMiniAppCode } from "~/simpleapp/generate/features/miniApp/app/types/miniApp";
16
- import { MiniappEnvEnum } from "~/enums/enums.generate";
16
+ import { MiniappEnvEnum } from "~/enums";
17
17
 
18
18
  export default defineNuxtPlugin(async () => {
19
19
  /**