@simitgroup/simpleapp-generator 2.0.2-p-alpha → 2.0.2-r-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
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
[2.0.2r-alpha]
|
|
2
|
+
|
|
3
|
+
1. Fix define types on controller fulltextsearch and setStatus
|
|
4
|
+
2. Define paramType on json to update define type on service file
|
|
5
|
+
|
|
6
|
+
[2.0.2q-alpha]
|
|
7
|
+
|
|
8
|
+
1. Added 'schema' on the TypeScript type
|
|
9
|
+
|
|
1
10
|
[2.0.2p-alpha]
|
|
2
11
|
|
|
3
12
|
1. Added explicit return types in generated controller endpoints to improve TypeScript type safety and resolve ESLint `no-unsafe-return` warnings
|
package/package.json
CHANGED
|
@@ -100,7 +100,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
100
100
|
@ApiOperation({ operationId: 'runSearch' })
|
|
101
101
|
<%~ drawMiniAppScope('list') %>
|
|
102
102
|
async search(@AppUser() appuser: UserContext,@Body() data: schemas.SearchBody, @Res({ passthrough: true }) res: Response): Promise<schemas.<%= it.typename %>[]> {
|
|
103
|
-
return await this._search(appuser,data, res)
|
|
103
|
+
return (await this._search(appuser, data, res)) as schemas.<%= it.typename %>[];
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
<% if(simpleappconfig.search !==undefined){%>
|
|
@@ -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
|
|
|
@@ -170,7 +170,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
170
170
|
@Query('keyword') keyword:string,
|
|
171
171
|
@Body() data: schemas.<%=it.typename%>,
|
|
172
172
|
): Promise<schemas.<%= it.typename %>AutoComplete[]> {
|
|
173
|
-
return this._autocomplete(appuser, keyword,data);
|
|
173
|
+
return (await this._autocomplete(appuser, keyword, data)) as schemas.<%= it.typename %>AutoComplete[];
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
@Post()
|
|
@@ -222,7 +222,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
222
222
|
<%~ drawMiniAppScope('patchMany') %>
|
|
223
223
|
async patchMany(@AppUser() appuser: UserContext, @Body() patchManyData: schemas.PatchManyRequest<schemas.<%= it.typename%>>
|
|
224
224
|
): Promise<schemas.UpdateManyResponse> {
|
|
225
|
-
return await this._patchMany(appuser, patchManyData);
|
|
225
|
+
return (await this._patchMany(appuser, patchManyData)) as schemas.UpdateManyResponse;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
@Patch(':id')
|
|
@@ -260,7 +260,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
|
|
|
260
260
|
@ApiOperation({ operationId: 'runDelete' })
|
|
261
261
|
<%~ drawMiniAppScope('delete') %>
|
|
262
262
|
async delete(@AppUser() appuser: UserContext,@Param('id') id: string): Promise<schemas.<%= it.typename %>> {
|
|
263
|
-
return this._delete(appuser,id)
|
|
263
|
+
return (await this._delete(appuser, id)) as schemas.<%= it.typename %>;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
/***************************** start status control api definitions *****************************************/
|
|
@@ -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,10 +8,10 @@ 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
|
-
let data:
|
|
14
|
+
let data: schema.<%= toTypeName(it.resourceName ,modelname) %> | undefined
|
|
15
15
|
<%} else{%>
|
|
16
16
|
|
|
17
17
|
const data = {
|
|
@@ -87,9 +87,8 @@ export class <%= it.typename %>Service extends SimpleAppService<schema.<%= it.ty
|
|
|
87
87
|
<% let fml = it.jsonschema['x-simpleapp-config']['formulas'][index] %>
|
|
88
88
|
// <%~ JSON.stringify(fml) %>
|
|
89
89
|
//const tmp = jsonpath.query(vdata,fieldpath).filter((item:string)=>item!='')
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return <%~fml.formula %>
|
|
90
|
+
jsonpath.apply($data, '<%~ fml.jsonPath %>', function ($item: schema.<%= fml?.paramType || it.typename %>) {
|
|
91
|
+
return <%~ fml.formula %>
|
|
93
92
|
})
|
|
94
93
|
<%}) %>
|
|
95
94
|
<%} %>
|