@simitgroup/simpleapp-generator 1.6.0-alpha → 1.6.2-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 (40) hide show
  1. package/README.md +8 -1
  2. package/dist/framework.d.ts.map +1 -1
  3. package/dist/framework.js +2 -1
  4. package/dist/framework.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/framework.ts +2 -1
  7. package/templates/basic/nest/processor.ts.eta +2 -1
  8. package/templates/basic/nuxt/component.select.vue.eta +5 -1
  9. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +11 -13
  10. package/templates/nest/src/app.module.ts.eta +12 -4
  11. package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +1 -1
  12. package/templates/nest/src/printapi/printapi.module.ts.eta +1 -1
  13. package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +5 -4
  14. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +1 -0
  15. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +1 -1
  16. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +51 -7
  17. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +2 -2
  18. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +15 -0
  19. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +3 -1
  20. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -3
  21. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +22 -25
  22. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +4 -4
  23. package/templates/nuxt/assets/css/listview.css._eta +2 -2
  24. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +24 -0
  25. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +11 -2
  26. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +1 -1
  27. package/templates/nuxt/components/list/ListView.vue.eta +66 -28
  28. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +11 -12
  29. package/templates/nuxt/components/select/SelectTemplate.vue.eta +49 -20
  30. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
  31. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -15
  32. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +18 -20
  33. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +29 -6
  34. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +18 -2
  35. package/templates/nuxt/composables/date.generate.ts.eta +1 -0
  36. package/templates/nuxt/composables/getUserStore.generate.ts.eta +1 -1
  37. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +4 -1
  38. package/templates/project/jsonschemas/invoice.json._eta +15 -7
  39. package/templates/project/lang/default._json +1 -0
  40. package/tsconfig.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -104,7 +104,7 @@ simpleapp-generator -g init
104
104
 
105
105
  5. prepare backend
106
106
  ```sh
107
- sh build.sh backend
107
+ bash build.sh backend
108
108
  ```
109
109
  6. update backend configurations file by modify `~/project1/backend/.env`, change mongodb, keycloak settings according your requirements
110
110
  7. start backend:
@@ -118,6 +118,13 @@ pnpm start:dev
118
118
  sh build.sh frontend
119
119
  ```
120
120
  9. modify frontend configuration by modify `~/project1/frontend/.env`, change keycloak settings
121
+ ```sh
122
+ OAUTH2_BASEURL=https://server-url #keycloak server url
123
+ OAUTH2_CONFIGURL=https://server-url/realms/testing
124
+ OAUTH2_CLIENTID=client1
125
+ OAUTH2_CLIENTSECRET=aaaa-xxxxx-yyyy-zzzzz-www
126
+ ADMIN_EMAIL=your@ykeycloakemail.com #if you have multiple, separate by ','
127
+ ```
121
128
  10. start frontend:
122
129
  ```sh
123
130
  cd ~/project1/frontend
@@ -1 +1 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,gBAAgB,2BAE5B,CAAA;AAED,eAAO,MAAM,aAAa,aAAY,QAAQ,SAc7C,CAAA;AAED,eAAO,MAAM,aAAa,aAAa,QAAQ,SAc9C,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAuC5C,CAAA;AAED,eAAO,MAAM,cAAc,kCAiD1B,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAgE5C,CAAA;AAED,eAAO,MAAM,UAAU,YAKtB,CAAA;AACD,eAAO,MAAM,UAAU,YAEtB,CAAA;AAED,eAAO,MAAM,oBAAoB,YAOhC,CAAA"}
1
+ {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,gBAAgB,2BAE5B,CAAA;AAED,eAAO,MAAM,aAAa,aAAY,QAAQ,SAc7C,CAAA;AAED,eAAO,MAAM,aAAa,aAAa,QAAQ,SAc9C,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAuC5C,CAAA;AAED,eAAO,MAAM,cAAc,kCAiD1B,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAgE5C,CAAA;AAED,eAAO,MAAM,UAAU,YAKtB,CAAA;AACD,eAAO,MAAM,UAAU,YAEtB,CAAA;AAED,eAAO,MAAM,oBAAoB,YAOhC,CAAA"}
package/dist/framework.js CHANGED
@@ -46,6 +46,7 @@ let config = {
46
46
  "frontendFolder": "./frontend",
47
47
  "frontendPort": "8080",
48
48
  "printFormatDir": "./printformats",
49
+ "additionalNestModules": ["cloudapi", "printapi"],
49
50
  "oauthSetting": {
50
51
  "oauthBaseUrl": "https://keycloak-server-url/",
51
52
  "oauthRealm": "realm-name",
@@ -100,7 +101,7 @@ const prepareNest = (callback) => {
100
101
  if (!fs_1.default.existsSync(`${targetfolder}/.env`)) {
101
102
  //@nestjs/graphql @nestjs/apollo graphql apollo-server-express apollo-server-core
102
103
  //@nestjs/graphql graphql-tools graphql apollo-server-express
103
- (0, child_process_1.exec)(`cd ${targetfolder};pnpm install --save @nestjs/graphql @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`, async (error, stdout, stderr) => {
104
+ (0, child_process_1.exec)(`cd ${targetfolder};pnpm install --save @nestjs/graphql country-to-currency countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`, async (error, stdout, stderr) => {
104
105
  // log.info(`dependency installed`)
105
106
  if (!error) {
106
107
  // fs.mkdirSync(`${targetfolder}/public_html`,{recursive:true})
@@ -1 +1 @@
1
- {"version":3,"file":"framework.js","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA0E;AAC1E,iDAAwC;AACxC,oDAAsB;AACtB,iCAAwC;AACxC,sDAAuC;AACvC,6BAA0B;AAC1B,MAAM,GAAG,GAAoB,IAAI,cAAM,EAAE,CAAC;AAE1C,IAAI,MAAM,GAAG;IACT,kBAAkB,EAAC,eAAe;IAClC,YAAY,EAAC,EAAE;IACf,eAAe,EAAC,WAAW;IAC3B,aAAa,EAAC,UAAU;IACxB,YAAY,EAAC,QAAQ;IACrB,aAAa,EAAC,MAAM;IACpB,iBAAiB,EAAC,qCAAqC;IACvD,aAAa,EAAC,WAAW;IACzB,gBAAgB,EAAC,YAAY;IAC7B,cAAc,EAAC,MAAM;IACrB,gBAAgB,EAAC,gBAAgB;I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AAM,CAAC,cAAc,6BAA6B,EAAC,IAAI,EAAC,kBAAkB,EAAC,sBAAsB,CAAC,EAAC,EAAG,KAAK,EAAE,SAAS,GAAE,CAAC,CAAA;IACtO,mBAAmB;AACvB,CAAC,CAAA;AAPY,QAAA,oBAAoB,wBAOhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "1.6.0-alpha",
3
+ "version": "1.6.2-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/framework.ts CHANGED
@@ -18,6 +18,7 @@ let config = {
18
18
  "frontendFolder":"./frontend",
19
19
  "frontendPort":"8080",
20
20
  "printFormatDir":"./printformats",
21
+ "additionalNestModules":["cloudapi","printapi"],
21
22
  "oauthSetting":{
22
23
  "oauthBaseUrl":"https://keycloak-server-url/",
23
24
  "oauthRealm":"realm-name",
@@ -74,7 +75,7 @@ export const prepareNest = (callback:Function)=>{
74
75
 
75
76
  //@nestjs/graphql @nestjs/apollo graphql apollo-server-express apollo-server-core
76
77
  //@nestjs/graphql graphql-tools graphql apollo-server-express
77
- exec(`cd ${targetfolder};pnpm install --save @nestjs/graphql @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
78
+ exec(`cd ${targetfolder};pnpm install --save @nestjs/graphql country-to-currency countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
78
79
  // log.info(`dependency installed`)
79
80
  if(!error){
80
81
  // fs.mkdirSync(`${targetfolder}/public_html`,{recursive:true})
@@ -64,6 +64,7 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
64
64
 
65
65
  reCalculateValue(data:<%= it.typename %>){
66
66
  //console.log('trigger new recalculate')
67
+ const $data = data;
67
68
  const jsopbj= new jsonpath['JSONPath']()
68
69
  <% if(it.jsonschema['x-simpleapp-config']['formulas']){ %>
69
70
  <%Object.keys(it.jsonschema['x-simpleapp-config']['formulas']).forEach(function(index) { %>
@@ -71,7 +72,7 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
71
72
  // <%~ JSON.stringify(fml) %>
72
73
  //const tmp = jsopbj.query(vdata,fieldpath).filter((item:string)=>item!='')
73
74
 
74
- jsopbj.apply(data, '<%~ fml.jsonPath %>', function(value:any) { return <%~fml.formula %> });
75
+ jsopbj.apply($data, '<%~ fml.jsonPath %>', function($item:any) { return <%~fml.formula %> });
75
76
 
76
77
  <%}) %>
77
78
  <%} %>
@@ -7,6 +7,8 @@
7
7
  :showNull="showNull"
8
8
  :allowAddNew="allowAddNew"
9
9
  :filter ="filter"
10
+ :multiple="multiple"
11
+ :hideLabel="hideLabel"
10
12
  />
11
13
  </template>
12
14
  <script setup lang="ts">
@@ -19,12 +21,14 @@
19
21
  import { ForeignKey } from '~/types';
20
22
  import { <%= it.typename %> } from "~/simpleapp/generate/openapi";
21
23
  const emits = defineEmits(["change"]);
22
- const modelValue = defineModel<string>();
24
+ const modelValue = defineModel<string|string[]>();
23
25
  const props = defineProps<{
24
26
  placeholder?: string;
25
27
  showNull?:boolean;
26
28
  allowAddNew?: boolean;
27
29
  filter?: <%= it.typename %>;
30
+ multiple?:boolean;
31
+ hideLabel?:boolean;
28
32
  }>()
29
33
  const change = (id:string,data:ForeignKey) =>{
30
34
  emits('change',id,data)
@@ -53,25 +53,23 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
53
53
  const apiobj = getDocumentApi('<%=it.name %>')
54
54
  super(apiobj,'<%= it.doctype %>','<%=it.name %>')
55
55
  this.event=$event
56
- this.listen=$listen
57
-
58
- this.setNew();
59
- watch(this.getData(),(newvalue)=>{
60
- //console.log("Something change",this.completeformula)
56
+ this.listen=$listen
57
+ this.setNew();
58
+ }
59
+
60
+ setWatchChange = ()=>{
61
+ this.unwantchobj = watch(this.getData(),(newvalue)=>{
61
62
  if(this.completeformula==true){
62
- // console.log("Trigger caclculate")
63
63
  this.completeformula=false
64
64
  this.reCalculateValue()
65
65
  this.completeformula=true
66
- }else{
67
- //console.log("avoid unlimited loop")
68
- }
69
- })
70
-
66
+ }
67
+ },{deep:true})
71
68
  }
72
69
  setNew = ()=>{
73
70
  const newdata = Default<%= it.typename%>(randomUUID())
74
71
  this.setData(newdata)
72
+ this.setWatchChange()
75
73
  return true
76
74
  }
77
75
  <%if(it.jsonschema.properties['readOnly'] || it.jsonschema.properties['documentStatus']){%>
@@ -176,7 +174,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
176
174
 
177
175
  reCalculateValue(){
178
176
  //console.log('trigger new recalculate')
179
- const data = this.getData()
177
+ const $data = this.getData()
180
178
 
181
179
  <% if(it.jsonschema['x-simpleapp-config']['formulas']){ %>
182
180
  <%Object.keys(it.jsonschema['x-simpleapp-config']['formulas']).forEach(function(index) { %>
@@ -184,7 +182,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
184
182
  // <%~ JSON.stringify(fml) %>
185
183
  //const tmp = jsonpath.query(vdata,fieldpath).filter((item:string)=>item!='')
186
184
 
187
- jsonpath.apply(data, '<%~ fml.jsonPath %>', function(value) { return <%~fml.formula %> });
185
+ jsonpath.apply($data, '<%~ fml.jsonPath %>', function($item) { return <%~fml.formula %> });
188
186
 
189
187
  <%}) %>
190
188
  <%} %>
@@ -9,7 +9,12 @@ import { Module, MiddlewareConsumer, NestModule, Provider } from '@nestjs/common
9
9
  import { MongooseModule,MongooseModuleOptions } from '@nestjs/mongoose';
10
10
  import { GraphQLModule } from '@nestjs/graphql';
11
11
  import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
12
-
12
+ import {GenerateModule} from './simpleapp/simpleapp.module'
13
+ <% const nestmodules = it.configs.additionalNestModules%>
14
+ <% for(let i=0; i<nestmodules.length;i++){ %>
15
+ <% const modulename = capitalizeFirstLetter(nestmodules[i]) %>
16
+ import {<%= modulename %>Module } from './<%=nestmodules[i]%>/<%=nestmodules[i]%>.module';
17
+ <%}%>
13
18
  import { APP_GUARD,APP_INTERCEPTOR,APP_FILTER } from '@nestjs/core';
14
19
  import { ResponseInterceptor } from './simpleapp/generate/commons/interceptors/response.interceptor'
15
20
  import {
@@ -28,8 +33,6 @@ import { AppResolver } from './app.resolver';
28
33
  import { TenantMiddleware } from './simpleapp/generate/commons/middlewares/tenant.middleware';
29
34
  import { AppController } from './app.controller';
30
35
  import { AppService } from './app.service';
31
- import {GenerateModule} from './simpleapp/simpleapp.module'
32
- import { CloudApiModule } from './cloudapi/cloudapi.module';
33
36
  import { UserMongoSchema } from './simpleapp/generate/models/user.model';
34
37
  import { PermissionMongoSchema } from './simpleapp/generate/models/perm.model';
35
38
  import { ApiEventMongoSchema } from './simpleapp/generate/models/apievent.model';
@@ -76,7 +79,12 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
76
79
  tokenValidation: TokenValidation.ONLINE,
77
80
  }),
78
81
  GenerateModule,
79
- CloudApiModule,
82
+
83
+ <% for(let i=0; i<nestmodules.length;i++){ %>
84
+ <% const modulename = capitalizeFirstLetter(nestmodules[i]) %>
85
+ <%= modulename %>Module,
86
+ <%}%>
87
+
80
88
  MongooseModule.forFeature([
81
89
  { name: 'User', schema: UserMongoSchema },
82
90
  { name: 'Permission', schema: PermissionMongoSchema },
@@ -12,4 +12,4 @@ import { CloudApiService } from './cloudapi.service';
12
12
  providers: [CloudApiService],
13
13
  exports: [CloudApiService],
14
14
  })
15
- export class CloudApiModule {}
15
+ export class CloudapiModule {}
@@ -12,4 +12,4 @@ import { PrintApiService } from './printapi.service';
12
12
  providers: [PrintApiService],
13
13
  exports: [PrintApiService],
14
14
  })
15
- export class PrintApiModule {}
15
+ export class PrintapiModule {}
@@ -81,10 +81,11 @@ export class SimpleAppRobotUserService {
81
81
  const nextrefresh = tokens.expires_in * 0.8;
82
82
  const appuser = this.prepareAppUser(undefined);
83
83
 
84
-
85
- setTimeout(async () => {
86
- await this.refreshSystemToken();
87
- }, nextrefresh * 1000);
84
+ if(tokens.access_token){
85
+ setTimeout(async () => {
86
+ await this.refreshSystemToken();
87
+ }, nextrefresh * 1000);
88
+ }
88
89
  }
89
90
 
90
91
  prepareAppUser(data: any) {
@@ -535,6 +535,7 @@ export class UserContext {
535
535
  };
536
536
 
537
537
  searchInsertedRecordId(collection: string, _id: string) {
538
+ if(!this.modifiedRecords.createds[collection]) return undefined
538
539
  return this.modifiedRecords.createds[collection].find(
539
540
  (item) => item === _id,
540
541
  );
@@ -22,7 +22,7 @@ import { DefaultPermission } from '../defaults/perm.default';
22
22
  export class PermissionProcessor extends SimpleAppService<Permission> {
23
23
  protected documentIdentityCode = '';
24
24
  protected documentIdentityLabel = '';
25
-
25
+ protected strictIsolation = false;
26
26
  protected foreignkeys = { user: ['$.userId'] };
27
27
  constructor(mydoc: Model<Permission>) {
28
28
  super('PERM', 'permission', mydoc, IsolationType.org);
@@ -25,13 +25,14 @@ import addFormats from 'ajv-formats';
25
25
  import addErrors from 'ajv-errors';
26
26
  import {
27
27
  NotFoundException,
28
+ HttpException,
28
29
  BadRequestException,
29
30
  ForbiddenException,
30
31
  InternalServerErrorException,
31
32
  HttpExceptionOptions,
32
33
  } from '@nestjs/common/exceptions';
33
34
  import { UserContext } from '../commons/user.context';
34
- import {CloudApiService} from 'src/cloudapi/cloudapi.service'
35
+ import { CloudApiService } from 'src/cloudapi/cloudapi.service';
35
36
  import { PrintApiService } from 'src/printapi/printapi.service';
36
37
  import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
37
38
  import {
@@ -406,7 +407,7 @@ export class SimpleAppService<T extends { _id?: string }> {
406
407
  }
407
408
  }
408
409
  };
409
- async validateData(appuser: UserContext, data: T) {
410
+ async validateData(appuser: UserContext, data: T, _id?: string) {
410
411
  const ajv = new Ajv({ allErrors: true, useDefaults: true });
411
412
  addFormats(ajv);
412
413
  addErrors(ajv);
@@ -421,7 +422,7 @@ export class SimpleAppService<T extends { _id?: string }> {
421
422
  this.logger.debug('run hook during validation');
422
423
  let issuccess = true;
423
424
  if (this.hooks.beforeValidation) {
424
- issuccess = await this.hooks.beforeValidation(appuser, data);
425
+ issuccess = await this.hooks.beforeValidation(appuser, data, _id);
425
426
  }
426
427
  // const issuccess = await this.hook(appuser, HookType.beforeValidation, data);
427
428
  if (!issuccess) {
@@ -452,7 +453,7 @@ export class SimpleAppService<T extends { _id?: string }> {
452
453
  );
453
454
  }
454
455
  if (this.hooks.afterValidation)
455
- await this.hooks.afterValidation(appuser, data);
456
+ await this.hooks.afterValidation(appuser, data, _id);
456
457
  }
457
458
 
458
459
  polishIsolationFilter = (filterIsolation: any, data: any = {}) => {
@@ -555,11 +556,12 @@ export class SimpleAppService<T extends { _id?: string }> {
555
556
  // try {
556
557
  Object.assign(data, appuser.getUpdateFilter());
557
558
  // Object.assign(existingdata, data);
559
+
558
560
  delete data['_id'];
559
561
  this.reCalculateValue(data);
560
562
 
561
563
  // existingdata['_id']=''
562
- await this.validateData(appuser, data);
564
+ await this.validateData(appuser, data, id);
563
565
 
564
566
  const isolationFilter = { ...this.getIsolationFilter(appuser) };
565
567
  this.polishIsolationFilter(isolationFilter);
@@ -733,6 +735,48 @@ export class SimpleAppService<T extends { _id?: string }> {
733
735
  }
734
736
  }
735
737
 
738
+ /**
739
+ * similar like runWorker, but it is syncronizely add event into queue and return.
740
+ * No result will return from this method, it also lose appuser db's transaction
741
+ * due out of request flow
742
+ *
743
+ * @param {UserContext} appuser The appuser
744
+ * @param {string} eventName The event name
745
+ * @param {any} data The data
746
+ */
747
+ runBackgroundWorker(appuser: UserContext, eventName: string, payloads:any) {
748
+ this.eventEmitter.emit(eventName, appuser, payloads);
749
+ }
750
+
751
+ /**
752
+ * runWorker design with 2 purpose
753
+ * 1. we wish developer develop complex programming flow in worker class instead
754
+ * of service class. We wish service class remain simple and easy to understand
755
+ * it wish to do hook and api only
756
+ * complex task service class may pass to worker class.
757
+ * 2. it not cause circulate injection hell, which is useful in complex dependency
758
+ * this run foreground event which can async/await to obtain execution result,
759
+ * the appuser dbtransaction remain usable. however, the execution may delay response
760
+ *
761
+ *
762
+ * @param {UserContext} appuser The appuser
763
+ * @param {string} eventName The event name
764
+ * @param {any} data The data
765
+ * @return {Promise} { description_of_the_return_value }
766
+ */
767
+ async runWorker(appuser: UserContext, eventName: string, payloads:any) {
768
+ const res = await this.eventEmitter.emitAsync(eventName, appuser, payloads);
769
+ if (!this.eventEmitter.hasListeners(eventName)) {
770
+ throw new InternalServerErrorException(`${eventName} seems no listener`);
771
+ }
772
+ if (!res) {
773
+ throw new InternalServerErrorException(`${eventName} is invalid worker`);
774
+ }
775
+
776
+ const result = res[0];
777
+ if (result?.name && result?.name.includes('Exception')) throw result;
778
+ return result;
779
+ }
736
780
  startWorkflow(
737
781
  appuser: UserContext,
738
782
  processName: WorkflowName,
@@ -867,8 +911,8 @@ export class SimpleAppService<T extends { _id?: string }> {
867
911
  }
868
912
  }
869
913
 
870
- async print(appuser: UserContext, id: string, formatid: string) {
871
- const pdfresult = await this.printapi.getBase64Pdf(appuser, formatid, id);
914
+ async print(appuser: UserContext, id: string, formatid: string) {
915
+ const pdfresult = await this.printapi.getBase64Pdf(appuser, formatid, id);
872
916
  return pdfresult;
873
917
  }
874
918
  }
@@ -39,8 +39,8 @@ export type DefaultHooks<T> = {
39
39
  init?: () => Promise<void>;
40
40
  beforeSearch?: (appuser: UserContext, filter: any) => Promise<void>;
41
41
  afterSearch?: (appuser: UserContext, data: T[]) => Promise<void>;
42
- beforeValidation?: (appuser: UserContext, data: T) => Promise<boolean>;
43
- afterValidation?: (appuser: UserContext, data: T) => Promise<void>;
42
+ beforeValidation?: (appuser: UserContext, data: T,_id?:string) => Promise<boolean>;
43
+ afterValidation?: (appuser: UserContext, data: T,_id?:string) => Promise<void>;
44
44
  beforeCreate?: (appuser: UserContext, data: T) => Promise<void>;
45
45
  afterCreate?: (appuser: UserContext, data: T) => Promise<void>;
46
46
  beforeUpdate?: (
@@ -14,6 +14,21 @@ export class RegTenantApiSchema {
14
14
  default: '',
15
15
  })
16
16
  tenantName: string;
17
+ @ApiProperty({
18
+ type: 'string',
19
+ required: true,
20
+ examples: ['Asia/Kuala_Lumpur'],
21
+ default: '',
22
+ })
23
+ timeZone: string;
24
+ @ApiProperty({
25
+ type: Number,
26
+ required: true,
27
+ examples: [0,-460],
28
+
29
+ })
30
+ utcOffset: number;
31
+
17
32
  }
18
33
  export class MyProfileApiSchemaBranches{
19
34
  @ApiProperty({type: 'string'})
@@ -126,8 +126,10 @@ export class ProfileController {
126
126
  async createTenant(
127
127
  @AppUser() appuser: UserContext,
128
128
  @Body('tenantName') tenantName: string,
129
+ @Body('timeZone') timeZone: string,
130
+ @Body('utcOffset') utcOffset:number
129
131
  ) {
130
- const result = await this.profileservice.createTenant(appuser, tenantName);
132
+ const result = await this.profileservice.createTenant(appuser, tenantName,timeZone,utcOffset);
131
133
  if (result) {
132
134
  return result;
133
135
  } else {
@@ -5,6 +5,8 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { UserService, User } from './../services/user.service';
8
+ import countrytimezone from 'countries-and-timezones'
9
+ import countryToCurrency, { Currencies, Countries } from "country-to-currency";
8
10
  import {
9
11
  Injectable,
10
12
  Scope,
@@ -85,8 +87,18 @@ export class ProfileService {
85
87
  return userinfo;
86
88
  }
87
89
 
88
- async createTenant(appuser: UserContext, tenantName: string) {
90
+ async createTenant(
91
+ appuser: UserContext,
92
+ tenantName: string,
93
+ timeZone: string,
94
+ utcOffset: number
95
+ ) {
89
96
  // try{
97
+ const timezonedata = countrytimezone.getCountriesForTimezone(timeZone)[0]
98
+ const countryCode = timezonedata['id']
99
+ const countryName = timezonedata['name']
100
+ const currencyCode = countryToCurrency[countryCode]
101
+
90
102
  appuser.getDBSession().startTransaction();
91
103
  const tenantdata: Tenant = {
92
104
  tenantId: 1,
@@ -112,6 +124,10 @@ export class ProfileService {
112
124
  orgName: tenantName,
113
125
  active: true,
114
126
  orgCode: 'HQ',
127
+ timeZone: timeZone,
128
+ offsetMinute: utcOffset,
129
+ currency: currencyCode,
130
+ country: countryCode,
115
131
  orgId: 1,
116
132
  };
117
133
 
@@ -127,6 +143,7 @@ export class ProfileService {
127
143
  branchId: 1,
128
144
  branchCode: 'HQ',
129
145
  branchName: tenantName,
146
+ country: countryName,
130
147
  active: true,
131
148
  orgId: orgResult.orgId,
132
149
  tenantId: tenantResult.tenantId,
@@ -225,7 +242,7 @@ export class ProfileService {
225
242
  return await appuser.getAllTenants();
226
243
  }
227
244
 
228
- async getSession(appuser:UserContext){
229
- return 'OK'
245
+ async getSession(appuser: UserContext) {
246
+ return 'OK';
230
247
  }
231
248
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. It is changable
3
- * --remove-this-line-to-prevent-override--
4
3
  * last change 2024-04-24
5
4
  * Author: Ks Tan
6
5
  */
@@ -9,32 +8,30 @@ import { Injectable } from '@nestjs/common';
9
8
  import { SimpleAppRobotUserService } from '../generate/commons/robotuser.service';
10
9
  import { UserContext } from '../generate/commons/user.context';
11
10
  import { UserService } from './user.service';
12
- import { TeacherService } from './teacher.service';
13
-
11
+ // import { TeacherService } from './teacher.service';
14
12
 
15
13
  @Injectable()
16
14
  export class UserResolverService {
17
15
  constructor(
18
16
  private userService: UserService,
19
- private teacherService: TeacherService,
17
+ // private teacherService: TeacherService,
20
18
  private robotUserService: SimpleAppRobotUserService,
21
19
  ) {}
22
- async teacher(assignvalue: string, data: any) {
23
- console.log('assign value for teacher', assignvalue);
24
-
25
- const appuser = this.robotUserService.prepareAppUser(data);
26
- console.log('gettenant', appuser.getBranchFilter());
27
- return this.resolve(appuser, 'teacher', assignvalue, data);
28
- }
20
+ // async teacher(assignvalue: string, data: any) {
21
+ // console.log('assign value for teacher', assignvalue);
22
+ // const appuser = this.robotUserService.prepareAppUser(data);
23
+ // console.log('gettenant', appuser.getBranchFilter());
24
+ // return this.resolve(appuser, 'teacher', assignvalue, data);
25
+ // }
29
26
  async resolve(appuser: UserContext, usertype: string, id: string, data: any) {
30
27
  let result = '';
31
28
  switch (usertype) {
32
29
  case 'user':
33
30
  result = await this.resolveUser(appuser, id, data);
34
31
  break;
35
- case 'teacher':
36
- result = await this.resolveTeacher(appuser, id, data);
37
- break;
32
+ // case 'teacher':
33
+ // result = await this.resolveTeacher(appuser, id, data);
34
+ // break;
38
35
 
39
36
  case 'group':
40
37
  // result = await this.resolveTeacher(appuser,id,data)
@@ -51,17 +48,17 @@ export class UserResolverService {
51
48
  if (user && user.length > 0) return user[0].uid;
52
49
  else return undefined;
53
50
  }
54
- async resolveTeacher(
55
- appuser: UserContext,
56
- id: string | undefined,
57
- data: any,
58
- ) {
59
- if (!id) return undefined;
60
- console.log('Find teacher::', id);
61
- const teacher = await this.teacherService.findById(appuser, id);
62
- console.log('teacher', teacher);
63
- return this.getUser(appuser, teacher.email);
64
- }
51
+ // async resolveTeacher(
52
+ // appuser: UserContext,
53
+ // id: string | undefined,
54
+ // data: any,
55
+ // ) {
56
+ // if (!id) return undefined;
57
+ // console.log('Find teacher::', id);
58
+ // const teacher = await this.teacherService.findById(appuser, id);
59
+ // console.log('teacher', teacher);
60
+ // return this.getUser(appuser, teacher.email);
61
+ // }
65
62
 
66
63
  async resolveUser(appuser: UserContext, id: string | undefined, data: any) {
67
64
  const user = await this.userService.findById(appuser, id);
@@ -8,8 +8,8 @@ import { Module } from '@nestjs/common';
8
8
  import { MongooseModule } from '@nestjs/mongoose';
9
9
  import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
10
10
  import { AuditTrail } from './generate/commons/audittrail.service';
11
- import { CloudApiModule } from 'src/cloudapi/cloudapi.module';
12
- import { PrintApiModule } from 'src/printapi/printapi.module';
11
+ import { CloudapiModule } from 'src/cloudapi/cloudapi.module';
12
+ import { PrintapiModule } from 'src/printapi/printapi.module';
13
13
 
14
14
  import { UserResolverService } from './services/userresolver.service';
15
15
  // auto import modules
@@ -41,8 +41,8 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
41
41
 
42
42
  @Module({
43
43
  imports: [
44
- CloudApiModule,
45
- PrintApiModule,
44
+ CloudapiModule,
45
+ PrintapiModule,
46
46
  MongooseModule.forFeature([
47
47
  <% for(let i=0;i<it.modules.length; i++){ %>
48
48
  <% let obj = it.modules[i]%>
@@ -8,10 +8,10 @@
8
8
  @apply block
9
9
  }
10
10
  /* :hover.listview-item a */
11
- .listview-item:active a{
11
+ .listview-item:active .listlink{
12
12
  @apply dark:bg-primary-950 bg-primary-300
13
13
  }
14
14
 
15
- .listview-item a.router-link-exact-active{
15
+ .listview-item .listlink.router-link-exact-active{
16
16
  @apply dark:bg-gray-700 bg-primary-200
17
17
  }