@simitgroup/simpleapp-generator 1.5.0-alpha → 1.6.0-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 (142) hide show
  1. package/README.md +3 -1
  2. package/dist/buildinschemas/branch.d.ts.map +1 -1
  3. package/dist/buildinschemas/branch.js +10 -0
  4. package/dist/buildinschemas/branch.js.map +1 -1
  5. package/dist/buildinschemas/index.d.ts +2 -0
  6. package/dist/buildinschemas/index.d.ts.map +1 -1
  7. package/dist/buildinschemas/index.js +5 -1
  8. package/dist/buildinschemas/index.js.map +1 -1
  9. package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
  10. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
  11. package/dist/buildinschemas/keyvaluepair.js +28 -0
  12. package/dist/buildinschemas/keyvaluepair.js.map +1 -0
  13. package/dist/buildinschemas/message.d.ts +3 -0
  14. package/dist/buildinschemas/message.d.ts.map +1 -0
  15. package/dist/buildinschemas/message.js +34 -0
  16. package/dist/buildinschemas/message.js.map +1 -0
  17. package/dist/buildinschemas/organization.d.ts.map +1 -1
  18. package/dist/buildinschemas/organization.js +18 -1
  19. package/dist/buildinschemas/organization.js.map +1 -1
  20. package/dist/buildinschemas/systemmessage.d.ts +3 -0
  21. package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
  22. package/dist/buildinschemas/systemmessage.js +43 -0
  23. package/dist/buildinschemas/systemmessage.js.map +1 -0
  24. package/dist/framework.d.ts.map +1 -1
  25. package/dist/framework.js +3 -2
  26. package/dist/framework.js.map +1 -1
  27. package/dist/generate.d.ts.map +1 -1
  28. package/dist/generate.js +37 -9
  29. package/dist/generate.js.map +1 -1
  30. package/dist/processors/bpmnbuilder.d.ts.map +1 -1
  31. package/dist/processors/bpmnbuilder.js +23 -32
  32. package/dist/processors/bpmnbuilder.js.map +1 -1
  33. package/dist/processors/jrxmlbuilder.d.ts +3 -0
  34. package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
  35. package/dist/processors/jrxmlbuilder.js +57 -0
  36. package/dist/processors/jrxmlbuilder.js.map +1 -0
  37. package/dist/type.d.ts +6 -0
  38. package/dist/type.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/buildinschemas/branch.ts +10 -0
  41. package/src/buildinschemas/index.ts +2 -0
  42. package/src/buildinschemas/keyvaluepair.ts +26 -0
  43. package/src/buildinschemas/organization.ts +18 -1
  44. package/src/buildinschemas/systemmessage.ts +42 -0
  45. package/src/framework.ts +3 -2
  46. package/src/generate.ts +41 -13
  47. package/src/processors/bpmnbuilder.ts +34 -38
  48. package/src/processors/jrxmlbuilder.ts +38 -0
  49. package/src/type.ts +7 -1
  50. package/templates/basic/nest/apischema.ts.eta +1 -1
  51. package/templates/basic/nest/controller.ts.eta +37 -19
  52. package/templates/basic/nest/resolver.ts.eta +1 -1
  53. package/templates/basic/nest/service.ts.eta +22 -4
  54. package/templates/basic/nest/type.ts.eta +2 -2
  55. package/templates/basic/nuxt/pages.form.vue.eta +1 -1
  56. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
  57. package/templates/nest/src/app.module.ts.eta +2 -0
  58. package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +15 -0
  59. package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +15 -0
  60. package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
  61. package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
  62. package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
  63. package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
  64. package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
  65. package/templates/nest/src/printapi/api/api.ts.eta +223 -0
  66. package/templates/nest/src/printapi/api/base.ts.eta +86 -0
  67. package/templates/nest/src/printapi/api/common.ts.eta +150 -0
  68. package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
  69. package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
  70. package/templates/nest/src/printapi/api/index.ts.eta +18 -0
  71. package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
  72. package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
  73. package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
  74. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +25 -0
  75. package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +112 -0
  76. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
  77. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +8 -5
  78. package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
  79. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
  80. package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
  81. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
  82. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
  83. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
  84. package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
  85. package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
  86. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -1
  87. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +191 -0
  88. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +208 -6
  89. package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +1 -1
  90. package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
  91. package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
  92. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +107 -20
  93. package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
  94. package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
  95. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
  96. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +10 -3
  97. package/templates/nest/src/simpleapp/types/index.ts._eta +11 -0
  98. package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +31 -0
  99. package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
  100. package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
  101. package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
  102. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
  103. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
  104. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
  105. package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
  106. package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
  107. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
  108. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
  109. package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
  110. package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
  111. package/templates/nuxt/composables/graphquery.generate.ts.eta +7 -7
  112. package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
  113. package/templates/nuxt/composables/pusher.ts._eta +13 -0
  114. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
  115. package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
  116. package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
  117. package/templates/nuxt/layouts/mobile.vue._eta +31 -42
  118. package/templates/nuxt/nuxt.config.ts._eta +2 -2
  119. package/templates/nuxt/othermodules.d.ts.eta +449 -0
  120. package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
  121. package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
  122. package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
  123. package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
  124. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
  125. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
  126. package/templates/nuxt/types/schema.ts.eta +8 -1
  127. package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
  128. package/templates/printformats/template.jrxml._eta +27 -0
  129. package/templates/project/groups/admin.json.eta +6 -1
  130. package/templates/project/jsonschemas/branch.json._eta +113 -0
  131. package/templates/project/jsonschemas/invoice.json._eta +5 -1
  132. package/templates/project/jsonschemas/organization.json._eta +111 -0
  133. package/templates/project/lang/default._json +70 -150
  134. package/templates/workflow/next/listener.ts.eta +6 -3
  135. package/tsconfig.tsbuildinfo +1 -1
  136. package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts._eta +0 -26
  137. /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
  138. /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
  139. /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
  140. /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
  141. /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
  142. /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
@@ -0,0 +1,38 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
+ import * as constants from '../constant'
3
+ import { SchemaPrintFormat } from "../type";
4
+ import { Logger, ILogObj } from "tslog";
5
+
6
+ const log: Logger<ILogObj> = new Logger();
7
+
8
+ const { Eta } = require('eta');
9
+ export const generatePrintformat = async (configs,printFormats:SchemaPrintFormat[]) =>{
10
+
11
+ console.log("Generate printformats ",printFormats);
12
+ const generateTemplateName = `${constants.templatedir}/printformats/template.jrxml._eta`
13
+ log.info("Generate printformat ",generateTemplateName);
14
+
15
+ const eta = new Eta({
16
+ views: '/',
17
+
18
+ functionHeader: getCodeGenHelper()
19
+ });
20
+ if(configs.printFormatDir && printFormats){
21
+ mkdirSync(configs.printFormatDir,{recursive:true})
22
+ for(let i=0;i<printFormats.length; i++){
23
+ const format = printFormats[i]
24
+ const targetfile = `${configs.printFormatDir}/${format.formatId}.jrxml`;
25
+ log.info("Process jrxml:",targetfile)
26
+ if(!existsSync(targetfile)){
27
+ const filecontent = eta.render(generateTemplateName, format)
28
+ writeFileSync(targetfile,filecontent);
29
+ }
30
+
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+ const getCodeGenHelper = () => 'const capitalizeFirstLetter = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);' +
37
+ 'const initType=(str)=>{return ["string","number","boolean","array","object"].includes(str) ? capitalizeFirstLetter(str) : str;};' +
38
+ 'const camelCaseToWords = (s) => {const result = s.replace(/([A-Z])/g, \' $1\');return result.charAt(0).toUpperCase() + result.slice(1);}'
package/src/type.ts CHANGED
@@ -149,9 +149,15 @@ export type SchemaConfig = {
149
149
  documentType: string
150
150
  documentName: string
151
151
  collectionName?: string
152
- foreignKeys?:MyForeignKey,
152
+ foreignKeys?:MyForeignKey
153
+ printFormats?: SchemaPrintFormat[]
153
154
  }
154
155
 
156
+ export type SchemaPrintFormat = {
157
+ formatName: string
158
+ formatId: string
159
+ description?: string
160
+ }
155
161
 
156
162
  export type SchemaFields = {
157
163
  _id: SimpleAppJSONSchema7
@@ -5,7 +5,7 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { ApiProperty } from '@nestjs/swagger';
8
- import { Field, ObjectType } from '@nestjs/graphql';
8
+ import { Field, ObjectType,ID } from '@nestjs/graphql';
9
9
 
10
10
  <%Object.keys(it.models).forEach(function(name) { %>
11
11
  <% let schema = it.models[name].model %>
@@ -1,3 +1,4 @@
1
+ <%let simpleappconfig = it.jsonschema['x-simpleapp-config'] %>
1
2
  /**
2
3
  * This file was automatically generated by simpleapp generator. Every
3
4
  * MODIFICATION OVERRIDE BY GENERATEOR
@@ -34,12 +35,13 @@ import { Response } from 'express';
34
35
  import {AppUser} from '../commons/decorators/appuser.decorator'
35
36
  import {UserContext} from '../commons/user.context'
36
37
 
38
+
37
39
  <% const getFieldType =(proptype, typename)=>{
38
40
  const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
39
41
  let tmptypename = typename.replace('[','').replace(']','')
40
42
 
41
43
  if(systemtypes.includes(tmptypename)){
42
-
44
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
43
45
  }else if(proptype=='schema'){
44
46
  tmptypename= 'schemas.'+tmptypename
45
47
  }else{ //type
@@ -68,20 +70,19 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
68
70
 
69
71
  @Get()
70
72
  <%if(superadmindoctype.includes(it.doctype)){%>
71
- @Roles(Role.SuperAdmin,Role.<%= `${it.typename}_search`%>)
73
+ @Roles(Role.SuperAdmin,Role.<%= `${it.typename}_access`%>)
72
74
  <%}else{%>
73
- @Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}_search`%>)
75
+ @Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}_access`%>)
74
76
  <%}%>
75
77
  @HttpCode(200)
76
78
  @ApiResponse({
77
79
  status: 200,
78
- description: 'Found',
79
- type: String
80
+ description: 'Found',
80
81
  })
81
82
  @ApiResponse({ status: 500, description: 'Internal error' })
82
- @ApiOperation({ operationId: 'runHello', description:"Say hello only" })
83
- async hello(@AppUser() appuser: UserContext) {
84
- return `Hello, welcome to ${ this.service.getDocumentName()}`//this._list(appuser);
83
+ @ApiOperation({ operationId: 'runDefault', description:"Run default behavior like say hello" })
84
+ async runDefault(@AppUser() appuser: UserContext) {
85
+ return await this.service.runDefault(appuser)
85
86
  }
86
87
  //autocomplete shall above :id
87
88
  @Post('/autocomplete')
@@ -168,11 +169,8 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
168
169
  <%}%>
169
170
  <% if(['post','put','patch'].includes(api.method)){ %>
170
171
  @ApiBody({ description: 'Request Body',
171
- type:
172
- <%= api.schema
173
- ? (api.schema.includes('[') ? '[schemas.'+api.schema.replace('[','').replace(']','') + ']' : 'schemas.'+api.schema )
174
- : 'Object'
175
- %>
172
+ type: <%= getFieldType('schema',api.schema)%>
173
+
176
174
  })
177
175
  <%}%>
178
176
  @ApiResponse({status: 200,description: '<%=api.description%>'
@@ -187,9 +185,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
187
185
  async <%=capitalizeFirstLetter(api.action) %>(
188
186
  @AppUser() appuser: UserContext,
189
187
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
190
- @Body() data:<%= api.schema
191
- ? (api.schema.includes('[') ? 'types.'+api.schema.replace('[','').replace(']','') + '[]' : 'types.'+api.schema )
192
- : 'Object'%>,
188
+ @Body() data:<%= getFieldType('type',api.schema)%>,
193
189
  //@Body() data:any,
194
190
  <%}%>
195
191
  <% if(api.entryPoint && api.entryPoint.includes(':')) {%>
@@ -210,7 +206,8 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
210
206
  <%}%>
211
207
  ){
212
208
 
213
- return await this.service.run<%=capitalizeFirstLetter(api.action)%>(appuser,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
209
+
210
+ const res:<%= getFieldType('type',api.responseType)%> = await this.service.run<%=capitalizeFirstLetter(api.action)%>(appuser,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
214
211
  <%let subpath = api.entryPoint.split('/')%>
215
212
  <% for(let a=0;a<subpath.length;a++){%>
216
213
  <%const partstr = subpath[a]%>
@@ -229,7 +226,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
229
226
  data,
230
227
  <%}%>
231
228
  )
232
-
229
+ return res
233
230
 
234
231
  }
235
232
  <%}%>
@@ -324,5 +321,26 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
324
321
  async delete(@AppUser() appuser: UserContext,@Param('id') id: string) {
325
322
  return this._delete(appuser,id);
326
323
  }
327
-
324
+
325
+ <% if(simpleappconfig?.printFormats){%>
326
+ @Get(':id/print/:formatid')
327
+ @Roles(Role.SuperAdmin, Role.SuperUser, Role.<%= `${it.typename}_print`%>)
328
+ @ApiResponse({
329
+ status: 200,
330
+ description: 'return base64 pdf string',
331
+ type: String,
332
+ })
333
+ @ApiResponse({ status: 404, description: 'Document not found' })
334
+ @ApiResponse({ status: 500, description: 'Internal error' })
335
+ @ApiOperation({ operationId: 'runPrint' })
336
+ async print(@AppUser() appuser: UserContext, @Param('id') id: string, @Param('formatid') formatid: string) {
337
+ const data = await this.service.print(appuser, id,formatid);
338
+ if (!data) {
339
+ throw new NotFoundException(`${id} not found`, 'not found');
340
+ } else {
341
+ return data;
342
+ }
343
+ }
344
+
345
+ <%}%>
328
346
  }
@@ -19,7 +19,7 @@ import { Request } from '@nestjs/common';
19
19
  let tmptypename = typename.replace('[','').replace(']','')
20
20
 
21
21
  if(systemtypes.includes(tmptypename)){
22
-
22
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
23
23
  }else if(proptype=='schema'){
24
24
  tmptypename= 'schemas.'+tmptypename
25
25
  }else{ //type
@@ -13,14 +13,32 @@ import { <%= it.typename %>Processor } from '../generate/processors/<%= it.docty
13
13
  //import { <%= it.typename %>,<%= it.typename %>Hooks} from '../generate/types';
14
14
  import * as types from '../generate/types';
15
15
  export { <%= it.typename %>} from '../generate/types';
16
+ <% const getFieldType =(proptype, typename)=>{
17
+ const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
18
+ let tmptypename = typename.replace('[','').replace(']','')
19
+
20
+ if(systemtypes.includes(tmptypename)){
21
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
22
+ }else if(proptype=='schema'){
23
+ tmptypename= 'schemas.'+tmptypename
24
+ }else{ //type
25
+ tmptypename= 'types.'+tmptypename
26
+ }
16
27
 
28
+ if(typename.includes('[')){
29
+ return proptype=='schema' ? `[${tmptypename}]` : `${tmptypename}[]`
30
+ }else{
31
+ return tmptypename
32
+ }
33
+ }
34
+ %>
17
35
 
18
36
  @Injectable()
19
37
  export class <%= it.typename %>Service extends <%= it.typename %>Processor {
20
38
  <% const config = it.jsonschema['x-simpleapp-config']%>
21
39
  <%if(config['loseDataIsolation']){%>protected strictIsolation = false;<%}%>
22
40
 
23
- public hooks: types.<%= it.typename %>Hooks = {}
41
+ //protected hooks: types.<%= it.typename %>Hooks = {}
24
42
  constructor(
25
43
  @InjectModel('<%= it.typename %>') mydoc: Model<types.<%= it.typename %>>
26
44
  ){
@@ -28,6 +46,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
28
46
  }
29
47
 
30
48
  /***************************** begin x-document-api definitions *****************************************/
49
+ /*
31
50
  <% for(let i=0;i<it.apiSettings.length;i++){%>
32
51
  <% let api = it.apiSettings[i] %>
33
52
  async run<%= capitalizeFirstLetter(api.action) %>(
@@ -50,9 +69,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
50
69
  <%}%>
51
70
 
52
71
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
53
- data:<%= api.schema
54
- ? (api.schema.includes('[') ? 'types.'+api.schema.replace('[','').replace(']','') + '[]' : 'types.'+api.schema )
55
- : 'any'%>,
72
+ data:<%= getFieldType('schema',api.schema)%>,
56
73
  <%}%>
57
74
 
58
75
  ){
@@ -63,6 +80,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
63
80
  <%}%>
64
81
  }
65
82
  <%}%>
83
+ */
66
84
 
67
85
  /***************************** end x-document-api definitions *****************************************/
68
86
  }
@@ -15,9 +15,9 @@ import {DefaultHooks} from "../types"
15
15
  <% if(typeof obj == 'string') {%>
16
16
  <%= key %> <%if(obj.required){%>?<%}%>: <%= obj %>; //child object
17
17
  <% }else if( Array.isArray( obj)){%>
18
- <%= key %><%if(obj.required){%>?<%}%>: <%= obj[0] %>[]; //array
18
+ <%= key %>?: <%= obj[0] %>[]; //array 1
19
19
  <% }else if( obj.type == 'array'){%>
20
- <%= key %><%if(obj.required){%>?<%}%>: <%= obj.items.type %>[]; //array
20
+ <%= key %><%if(obj.required){%>?<%}%>: <%= obj.items.type %>[]; //array 2
21
21
  <% }else{%>
22
22
  <%= key %> <% if(!obj.required || obj.required==false){%>?<%}%>: <%= obj.type %>; // <%~ JSON.stringify(obj) %>
23
23
  <% } %>
@@ -7,7 +7,7 @@
7
7
  <template>
8
8
  <div>
9
9
  <% if(it.autocompletename){%>
10
- <title v-if="id">{{ data.<%=it.autocompletename%> ?? data.<%=it.autocompletecode%>}}</title>
10
+ <title v-if="id">{{ data.<%=it.autocompletename%> }}</title>
11
11
  <%}else{%>
12
12
  <title v-if="id">{{ t(doc.getDocName())}}</title>
13
13
  <%}%>
@@ -1,69 +1,12 @@
1
- <% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
2
1
  <template>
3
-
4
- <PageDocList :document="doc" :columns="columns" :data="docdata" :sorts="sorts">
5
- <template #mobileList="{index,item}">
6
- </template>
7
- <template #dataTableColumns>
8
- <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
9
- <%let obj=it.jsonschema.properties[key] %>
10
- <%let config=it.jsonschema['x-simpleapp-config'] %>
11
- <%if(skipcolumns.indexOf(key)>=0){%>
12
- <%} else if(config['uniqueKey'] && (config['uniqueKey']==key || config['documentTitle']==key) ){%>
13
- <Column #body="{index,data}" :header="t('<%=key%>')">
14
- <RendererLink :value="data" :setting="{path:'<%=it.name%>'}" :fields="['<%=key%>']">{{ data.<%=key%> }}</RendererLink>
15
- </Column>
16
-
17
- <%} else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>
18
- <Column #body="{index,data}" :header="t('<%=key%>')">
19
- {{data.<%=key%>}}
20
- </Column>
21
- <%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
22
- <Column #body="{index,data}" :header="t('<%=key%>')">
23
- <RendererViewer :value="data.<%=key%>" :setting="{documentName:'<%=obj["x-foreignkey"]%>'}" :fields="['<%=key%>']">{{ data.label }}</RendererViewer>
24
- </Column>
25
- <%}%>
26
- <%})%>
27
- </template>
28
- <template #default><div><NuxtPage :_id="id ?? 'new'"/></div></template>
29
- </PageDocList>
2
+ <LadingPage/>
30
3
  </template>
31
- <script setup lang="ts">
4
+ <script lang="ts" setup>
32
5
  /**
33
6
  * This file was automatically generated by simpleapp generator.
34
7
  * --remove-this-line-to-prevent-override--
35
8
  * last change 2023-09-09
36
9
  * author: Ks Tan
37
10
  */
38
- import { <%= it.typename %> } from '~/simpleapp/generate/openapi';
39
-
40
- const {$<%= it.typename %>Doc,$listen } = useNuxtApp();
41
- const doc = $<%= it.typename %>Doc()
42
- const docdata = doc.getReactiveData();
43
- type <%= it.typename %>Key = keyof <%= it.typename %>
44
- definePageMeta({
45
- menuPath:'nocategory/<%= it.name %>'
46
- });
47
-
48
- const columns: <%= it.typename %>Key[] = [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
49
- <%let obj=it.jsonschema.properties[key] %>
50
- <%let config=it.jsonschema['x-simpleapp-config'] %>
51
- <%if(skipcolumns.indexOf(key)>=0){%>
52
- <%}else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>'<%=key%>',
53
- <%} %>
54
- <%})%>]
55
-
56
-
57
-
58
-
59
-
60
- const sorts:string[][] = [
61
- <%if(it.jsonschema['x-simpleapp-config'] && it.jsonschema['x-simpleapp-config']['uniqueKey']){%>
62
- ['<%=it.jsonschema['x-simpleapp-config']['uniqueKey']%>','asc'],
63
- <%}%>
64
- ]
65
-
66
- const id=computed(()=>useRoute().params.id)
67
- </script>
68
-
69
-
11
+ import LadingPage from '../../<%= it.name %>.vue'
12
+ </script>
@@ -29,6 +29,7 @@ import { TenantMiddleware } from './simpleapp/generate/commons/middlewares/tenan
29
29
  import { AppController } from './app.controller';
30
30
  import { AppService } from './app.service';
31
31
  import {GenerateModule} from './simpleapp/simpleapp.module'
32
+ import { CloudApiModule } from './cloudapi/cloudapi.module';
32
33
  import { UserMongoSchema } from './simpleapp/generate/models/user.model';
33
34
  import { PermissionMongoSchema } from './simpleapp/generate/models/perm.model';
34
35
  import { ApiEventMongoSchema } from './simpleapp/generate/models/apievent.model';
@@ -75,6 +76,7 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
75
76
  tokenValidation: TokenValidation.ONLINE,
76
77
  }),
77
78
  GenerateModule,
79
+ CloudApiModule,
78
80
  MongooseModule.forFeature([
79
81
  { name: 'User', schema: UserMongoSchema },
80
82
  { name: 'Permission', schema: PermissionMongoSchema },
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. It is changable
3
+ * --remove-this-line-to-prevent-override--
4
+ * last change 2024-04-19
5
+ * Author: Ks Tan
6
+ */
7
+ import { Module } from '@nestjs/common';
8
+ import { CloudApiService } from './cloudapi.service';
9
+ @Module({
10
+ imports: [],
11
+ controllers: [],
12
+ providers: [CloudApiService],
13
+ exports: [CloudApiService],
14
+ })
15
+ export class CloudApiModule {}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. It is changable
3
+ * --remove-this-line-to-prevent-override--
4
+ * last change 2024-04-19
5
+ * Author: Ks Tan
6
+ */
7
+ import { Injectable, InternalServerErrorException } from '@nestjs/common';
8
+ import { UserContext } from 'src/simpleapp/generate/commons/user.context';
9
+
10
+ @Injectable()
11
+ export class CloudApiService {
12
+ constructor() {}
13
+
14
+
15
+ }
@@ -0,0 +1,4 @@
1
+ wwwroot/*.js
2
+ node_modules
3
+ typings
4
+ dist
@@ -0,0 +1 @@
1
+ # empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
@@ -0,0 +1,8 @@
1
+ .gitignore
2
+ .npmignore
3
+ api.ts
4
+ base.ts
5
+ common.ts
6
+ configuration.ts
7
+ git_push.sh
8
+ index.ts
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md