@simitgroup/simpleapp-generator 2.0.2-q-alpha → 2.0.2-s-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/ReleaseNote.md +10 -0
- package/package.json +1 -1
- package/templates/basic/nest/controller.ts.eta +3 -3
- package/templates/basic/nest/default.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +9 -11
- package/templates/nuxt/app.vue.eta +1 -1
- package/templates/nuxt/server/api/auth/[...].ts.eta +5 -1
package/ReleaseNote.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
[2.0.2s-alpha]
|
|
2
|
+
|
|
3
|
+
1. Reduce expired-token issues
|
|
4
|
+
2. Define type on service for readonly
|
|
5
|
+
|
|
6
|
+
[2.0.2r-alpha]
|
|
7
|
+
|
|
8
|
+
1. Fix define types on controller fulltextsearch and setStatus
|
|
9
|
+
2. Define paramType on json to update define type on service file
|
|
10
|
+
|
|
1
11
|
[2.0.2q-alpha]
|
|
2
12
|
|
|
3
13
|
1. Added 'schema' on the TypeScript type
|
package/package.json
CHANGED
|
@@ -119,8 +119,8 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
119
119
|
async fulltextsearch(
|
|
120
120
|
@AppUser() appuser: UserContext,
|
|
121
121
|
@Body() data: schemas.TextSearchBody,
|
|
122
|
-
) {
|
|
123
|
-
return await this._fulltextsearch(appuser, data);
|
|
122
|
+
): Promise<schemas.<%= it.typename %>[]> {
|
|
123
|
+
return (await this._fulltextsearch(appuser, data)) as schemas.<%= it.typename %>[];
|
|
124
124
|
}
|
|
125
125
|
<%}%>
|
|
126
126
|
|
|
@@ -271,7 +271,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
271
271
|
@ApiBody({ description: 'Document data', type: Object })
|
|
272
272
|
@Roles(Role.SuperAdmin,Role.<%= `${it.typename}_${statusname}`%>)
|
|
273
273
|
<%~ drawMiniAppScope(statusname) %>
|
|
274
|
-
async setStatus<%=capitalizeFirstLetter(statusname)%>(@AppUser() appuser: UserContext,@Param('id') id: string, @Body() data:
|
|
274
|
+
async setStatus<%=capitalizeFirstLetter(statusname)%>(@AppUser() appuser: UserContext,@Param('id') id: string, @Body() data:schemas.<%= it.typename %>,){
|
|
275
275
|
return await this.service.setDocumentStatus(appuser,id,data,'<%=statusname%>',)
|
|
276
276
|
}
|
|
277
277
|
<%}%>
|
|
@@ -8,7 +8,7 @@ import * as schema from './<%= camelToKebab(it.resourceName) %>.schema'
|
|
|
8
8
|
|
|
9
9
|
<%Object.keys(it.models).forEach(function(modelname) { %>
|
|
10
10
|
|
|
11
|
-
export const Default<%= toTypeName(it.resourceName ,modelname) %> = (uuid:string) :
|
|
11
|
+
export const Default<%= toTypeName(it.resourceName ,modelname) %> = (uuid:string) : schema.<%= toTypeName(it.resourceName ,modelname) %> | undefined =>{
|
|
12
12
|
<% let model = it.models[modelname].model%>
|
|
13
13
|
<% if(model['_id'] && model['code'] && model['label']){%>
|
|
14
14
|
let data: schema.<%= toTypeName(it.resourceName ,modelname) %> | undefined
|
|
@@ -72,8 +72,13 @@ export class <%= it.typename %>Service extends SimpleAppService<schema.<%= it.ty
|
|
|
72
72
|
<%}%>
|
|
73
73
|
<%if(it.jsonschema.properties['documentStatus']){%>
|
|
74
74
|
const docstatus = this.data.documentStatus
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const schemaJson = this.jsonschema as {
|
|
76
|
+
['x-simpleapp-config']?: { allStatus?: { status: string; readOnly?: boolean }[] }
|
|
77
|
+
}
|
|
78
|
+
const statussetting = schemaJson['x-simpleapp-config']?.allStatus?.find(
|
|
79
|
+
(item) => item.status === docstatus
|
|
80
|
+
)
|
|
81
|
+
if(statussetting?.readOnly) return true
|
|
77
82
|
<%}%>
|
|
78
83
|
return false
|
|
79
84
|
}
|
|
@@ -87,15 +92,8 @@ export class <%= it.typename %>Service extends SimpleAppService<schema.<%= it.ty
|
|
|
87
92
|
<% let fml = it.jsonschema['x-simpleapp-config']['formulas'][index] %>
|
|
88
93
|
// <%~ JSON.stringify(fml) %>
|
|
89
94
|
//const tmp = jsonpath.query(vdata,fieldpath).filter((item:string)=>item!='')
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const prop = m ? m[1] : '';
|
|
93
|
-
const pascalProp = prop ? (prop[0].toUpperCase() + prop.slice(1)) : '';
|
|
94
|
-
const itemType = m ? `schema.${it.typename}${pascalProp}` : 'unknown';
|
|
95
|
-
%>
|
|
96
|
-
|
|
97
|
-
jsonpath.apply($data, '<%~ fml.jsonPath %>', function ($item: <%= itemType %>) {
|
|
98
|
-
return <%~ fml.formula %>
|
|
95
|
+
jsonpath.apply($data, '<%~ fml.jsonPath %>', function ($item: schema.<%= fml?.paramType || it.typename %>) {
|
|
96
|
+
return (<%~ fml.formula %>) as schema.<%= fml?.paramType || it.typename %>;
|
|
99
97
|
})
|
|
100
98
|
<%}) %>
|
|
101
99
|
<%} %>
|