@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.
- package/README.md +3 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +10 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
- package/dist/buildinschemas/keyvaluepair.js +28 -0
- package/dist/buildinschemas/keyvaluepair.js.map +1 -0
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +18 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts +3 -0
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
- package/dist/buildinschemas/systemmessage.js +43 -0
- package/dist/buildinschemas/systemmessage.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +37 -9
- package/dist/generate.js.map +1 -1
- package/dist/processors/bpmnbuilder.d.ts.map +1 -1
- package/dist/processors/bpmnbuilder.js +23 -32
- package/dist/processors/bpmnbuilder.js.map +1 -1
- package/dist/processors/jrxmlbuilder.d.ts +3 -0
- package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
- package/dist/processors/jrxmlbuilder.js +57 -0
- package/dist/processors/jrxmlbuilder.js.map +1 -0
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +10 -0
- package/src/buildinschemas/index.ts +2 -0
- package/src/buildinschemas/keyvaluepair.ts +26 -0
- package/src/buildinschemas/organization.ts +18 -1
- package/src/buildinschemas/systemmessage.ts +42 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +41 -13
- package/src/processors/bpmnbuilder.ts +34 -38
- package/src/processors/jrxmlbuilder.ts +38 -0
- package/src/type.ts +7 -1
- package/templates/basic/nest/apischema.ts.eta +1 -1
- package/templates/basic/nest/controller.ts.eta +37 -19
- package/templates/basic/nest/resolver.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +22 -4
- package/templates/basic/nest/type.ts.eta +2 -2
- package/templates/basic/nuxt/pages.form.vue.eta +1 -1
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
- package/templates/nest/src/app.module.ts.eta +2 -0
- package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +15 -0
- package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +15 -0
- package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
- package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
- package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
- package/templates/nest/src/printapi/api/api.ts.eta +223 -0
- package/templates/nest/src/printapi/api/base.ts.eta +86 -0
- package/templates/nest/src/printapi/api/common.ts.eta +150 -0
- package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
- package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
- package/templates/nest/src/printapi/api/index.ts.eta +18 -0
- package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
- package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
- package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +25 -0
- package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +112 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +8 -5
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -1
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +191 -0
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +208 -6
- package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +107 -20
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +10 -3
- package/templates/nest/src/simpleapp/types/index.ts._eta +11 -0
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +31 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
- package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
- package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
- package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
- package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
- package/templates/nuxt/composables/graphquery.generate.ts.eta +7 -7
- package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
- package/templates/nuxt/composables/pusher.ts._eta +13 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
- package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
- package/templates/nuxt/layouts/mobile.vue._eta +31 -42
- package/templates/nuxt/nuxt.config.ts._eta +2 -2
- package/templates/nuxt/othermodules.d.ts.eta +449 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
- package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
- package/templates/nuxt/types/schema.ts.eta +8 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
- package/templates/printformats/template.jrxml._eta +27 -0
- package/templates/project/groups/admin.json.eta +6 -1
- package/templates/project/jsonschemas/branch.json._eta +113 -0
- package/templates/project/jsonschemas/invoice.json._eta +5 -1
- package/templates/project/jsonschemas/organization.json._eta +111 -0
- package/templates/project/lang/default._json +70 -150
- package/templates/workflow/next/listener.ts.eta +6 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts._eta +0 -26
- /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
- /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}
|
|
73
|
+
@Roles(Role.SuperAdmin,Role.<%= `${it.typename}_access`%>)
|
|
72
74
|
<%}else{%>
|
|
73
|
-
@Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}
|
|
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: '
|
|
83
|
-
async
|
|
84
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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%>
|
|
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
|
|
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
|
|
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 @@
|
|
|
1
|
+
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.4.0
|
|
@@ -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
|