@simitgroup/simpleapp-generator 2.0.2-q-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,8 @@
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
+
1
6
  [2.0.2q-alpha]
2
7
 
3
8
  1. Added 'schema' on the TypeScript type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "2.0.2q-alpha",
3
+ "version": "2.0.2r-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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:any,){
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) : <%= toTypeName(it.resourceName ,modelname) %> | undefined =>{
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
@@ -87,14 +87,7 @@ 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
- const m = String(fml.jsonPath || '').match(/^\$\.(\w+)\[\*\]/);
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 %>) {
90
+ jsonpath.apply($data, '<%~ fml.jsonPath %>', function ($item: schema.<%= fml?.paramType || it.typename %>) {
98
91
  return <%~ fml.formula %>
99
92
  })
100
93
  <%}) %>