@simitgroup/simpleapp-generator 1.5.1-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/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/controller.ts.eta +34 -17
- 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/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 +11 -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 +9 -9
- 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/simpleapp.type.ts.eta +10 -3
- 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 +95 -26
- 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 +6 -2
- package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
- 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/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/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
|
|
@@ -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(':')) {%>
|
|
@@ -325,5 +321,26 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
325
321
|
async delete(@AppUser() appuser: UserContext,@Param('id') id: string) {
|
|
326
322
|
return this._delete(appuser,id);
|
|
327
323
|
}
|
|
328
|
-
|
|
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
|
+
<%}%>
|
|
329
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>
|
|
@@ -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
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* prinf format microservice
|
|
5
|
+
* print format microservice
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: kstan@simitgroup.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import type { Configuration } from './configuration';
|
|
17
|
+
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
18
|
+
import globalAxios from 'axios';
|
|
19
|
+
// Some imports not used depending on template conditions
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
|
22
|
+
import type { RequestArgs } from './base';
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* DefaultApi - axios parameter creator
|
|
29
|
+
* @export
|
|
30
|
+
*/
|
|
31
|
+
export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
32
|
+
return {
|
|
33
|
+
/**
|
|
34
|
+
* generate pdf
|
|
35
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
36
|
+
* @param {string} id data _id
|
|
37
|
+
* @param {*} [options] Override http request option.
|
|
38
|
+
* @throws {RequiredError}
|
|
39
|
+
*/
|
|
40
|
+
runPdf: async (formatid: string, id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
41
|
+
// verify required parameter 'formatid' is not null or undefined
|
|
42
|
+
assertParamExists('runPdf', 'formatid', formatid)
|
|
43
|
+
// verify required parameter 'id' is not null or undefined
|
|
44
|
+
assertParamExists('runPdf', 'id', id)
|
|
45
|
+
const localVarPath = `/api/print/{formatid}/{id}`
|
|
46
|
+
.replace(`{${"formatid"}}`, encodeURIComponent(String(formatid)))
|
|
47
|
+
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
48
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
49
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
50
|
+
let baseOptions;
|
|
51
|
+
if (configuration) {
|
|
52
|
+
baseOptions = configuration.baseOptions;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
56
|
+
const localVarHeaderParameter = {} as any;
|
|
57
|
+
const localVarQueryParameter = {} as any;
|
|
58
|
+
|
|
59
|
+
// authentication simbiz_auth required
|
|
60
|
+
// oauth required
|
|
61
|
+
await setOAuthToObject(localVarHeaderParameter, "simbiz_auth", [], configuration)
|
|
62
|
+
|
|
63
|
+
// authentication apiKey required
|
|
64
|
+
await setApiKeyToObject(localVarHeaderParameter, "x-org", configuration)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
69
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
70
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
url: toPathString(localVarUrlObj),
|
|
74
|
+
options: localVarRequestOptions,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Generate base64 pdf string
|
|
79
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
80
|
+
* @param {string} id data _id
|
|
81
|
+
* @param {*} [options] Override http request option.
|
|
82
|
+
* @throws {RequiredError}
|
|
83
|
+
*/
|
|
84
|
+
runPdfBase64: async (formatid: string, id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
85
|
+
// verify required parameter 'formatid' is not null or undefined
|
|
86
|
+
assertParamExists('runPdfBase64', 'formatid', formatid)
|
|
87
|
+
// verify required parameter 'id' is not null or undefined
|
|
88
|
+
assertParamExists('runPdfBase64', 'id', id)
|
|
89
|
+
const localVarPath = `/api/print/{formatid}/{id}/base64`
|
|
90
|
+
.replace(`{${"formatid"}}`, encodeURIComponent(String(formatid)))
|
|
91
|
+
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
92
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
93
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
94
|
+
let baseOptions;
|
|
95
|
+
if (configuration) {
|
|
96
|
+
baseOptions = configuration.baseOptions;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
100
|
+
const localVarHeaderParameter = {} as any;
|
|
101
|
+
const localVarQueryParameter = {} as any;
|
|
102
|
+
|
|
103
|
+
// authentication simbiz_auth required
|
|
104
|
+
// oauth required
|
|
105
|
+
await setOAuthToObject(localVarHeaderParameter, "simbiz_auth", [], configuration)
|
|
106
|
+
|
|
107
|
+
// authentication apiKey required
|
|
108
|
+
await setApiKeyToObject(localVarHeaderParameter, "x-org", configuration)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
113
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
114
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
url: toPathString(localVarUrlObj),
|
|
118
|
+
options: localVarRequestOptions,
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* DefaultApi - functional programming interface
|
|
126
|
+
* @export
|
|
127
|
+
*/
|
|
128
|
+
export const DefaultApiFp = function(configuration?: Configuration) {
|
|
129
|
+
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
|
|
130
|
+
return {
|
|
131
|
+
/**
|
|
132
|
+
* generate pdf
|
|
133
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
134
|
+
* @param {string} id data _id
|
|
135
|
+
* @param {*} [options] Override http request option.
|
|
136
|
+
* @throws {RequiredError}
|
|
137
|
+
*/
|
|
138
|
+
async runPdf(formatid: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
|
|
139
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.runPdf(formatid, id, options);
|
|
140
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
141
|
+
const localVarOperationServerBasePath = operationServerMap['DefaultApi.runPdf']?.[localVarOperationServerIndex]?.url;
|
|
142
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Generate base64 pdf string
|
|
146
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
147
|
+
* @param {string} id data _id
|
|
148
|
+
* @param {*} [options] Override http request option.
|
|
149
|
+
* @throws {RequiredError}
|
|
150
|
+
*/
|
|
151
|
+
async runPdfBase64(formatid: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
|
|
152
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.runPdfBase64(formatid, id, options);
|
|
153
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
154
|
+
const localVarOperationServerBasePath = operationServerMap['DefaultApi.runPdfBase64']?.[localVarOperationServerIndex]?.url;
|
|
155
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* DefaultApi - factory interface
|
|
162
|
+
* @export
|
|
163
|
+
*/
|
|
164
|
+
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
165
|
+
const localVarFp = DefaultApiFp(configuration)
|
|
166
|
+
return {
|
|
167
|
+
/**
|
|
168
|
+
* generate pdf
|
|
169
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
170
|
+
* @param {string} id data _id
|
|
171
|
+
* @param {*} [options] Override http request option.
|
|
172
|
+
* @throws {RequiredError}
|
|
173
|
+
*/
|
|
174
|
+
runPdf(formatid: string, id: string, options?: any): AxiosPromise<File> {
|
|
175
|
+
return localVarFp.runPdf(formatid, id, options).then((request) => request(axios, basePath));
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Generate base64 pdf string
|
|
179
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
180
|
+
* @param {string} id data _id
|
|
181
|
+
* @param {*} [options] Override http request option.
|
|
182
|
+
* @throws {RequiredError}
|
|
183
|
+
*/
|
|
184
|
+
runPdfBase64(formatid: string, id: string, options?: any): AxiosPromise<File> {
|
|
185
|
+
return localVarFp.runPdfBase64(formatid, id, options).then((request) => request(axios, basePath));
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* DefaultApi - object-oriented interface
|
|
192
|
+
* @export
|
|
193
|
+
* @class DefaultApi
|
|
194
|
+
* @extends {BaseAPI}
|
|
195
|
+
*/
|
|
196
|
+
export class DefaultApi extends BaseAPI {
|
|
197
|
+
/**
|
|
198
|
+
* generate pdf
|
|
199
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
200
|
+
* @param {string} id data _id
|
|
201
|
+
* @param {*} [options] Override http request option.
|
|
202
|
+
* @throws {RequiredError}
|
|
203
|
+
* @memberof DefaultApi
|
|
204
|
+
*/
|
|
205
|
+
public runPdf(formatid: string, id: string, options?: RawAxiosRequestConfig) {
|
|
206
|
+
return DefaultApiFp(this.configuration).runPdf(formatid, id, options).then((request) => request(this.axios, this.basePath));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Generate base64 pdf string
|
|
211
|
+
* @param {string} formatid format name, can be invoice,purchaseorder, or formatid like xxxx-yyy-zzz-xxx in database
|
|
212
|
+
* @param {string} id data _id
|
|
213
|
+
* @param {*} [options] Override http request option.
|
|
214
|
+
* @throws {RequiredError}
|
|
215
|
+
* @memberof DefaultApi
|
|
216
|
+
*/
|
|
217
|
+
public runPdfBase64(formatid: string, id: string, options?: RawAxiosRequestConfig) {
|
|
218
|
+
return DefaultApiFp(this.configuration).runPdfBase64(formatid, id, options).then((request) => request(this.axios, this.basePath));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|