@simitgroup/simpleapp-generator 1.6.4-g-alpha → 1.6.6-a-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,6 @@
1
+ [1.6.6a-alpha]
2
+ 1. fix simpleapp generated frontend lib bugs
3
+
1
4
  [1.6.5g]
2
5
  1. change simpleapp document controller use document name instead of document type
3
6
  2. allow use header x-apikey(match env X_APIKEY), x-apisecret (match env X_APISECRET), to by pass access token. which will use robotuser in user context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "1.6.4g-alpha",
3
+ "version": "1.6.6a-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@ export type {
34
34
 
35
35
  } from '../openapi'
36
36
 
37
- export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.typename%>,openapi.<%= it.doctype.toUpperCase()%>Api>{
37
+ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<openapi.<%= capitalizeFirstLetter(it.name)%>,openapi.<%= it.name.toUpperCase()%>Api>{
38
38
  public readonly schema= <%~ JSON.stringify(it.jsonschema) %> as SchemaType;
39
39
  protected documentIdentityCode='<%~ it.autocompletecode %>'
40
40
  protected documentIdentityName='<%~ it.autocompletename %>'
@@ -49,7 +49,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
49
49
  }
50
50
 
51
51
  //const apipath = `${useRuntimeConfig().public.API_URL}/${xorg}`
52
- //const apiobj = new <%= it.doctype.toUpperCase()%>Api(undefined,apipath,$axios)
52
+ //const apiobj = new <%= it.name.toUpperCase()%>Api(undefined,apipath,$axios)
53
53
  const apiobj = getDocumentApi('<%=it.name %>')
54
54
  super(apiobj,'<%= it.doctype %>','<%=it.name %>')
55
55
  this.event=$event
@@ -15,6 +15,11 @@ export class ApiKeyValuePair {
15
15
  })
16
16
  field1: any;
17
17
  }
18
+ export class SortItem {
19
+
20
+ }
21
+
22
+
18
23
  export class ApiSearchBody {
19
24
  @ApiProperty({
20
25
  type: Object,
@@ -31,12 +36,21 @@ export class ApiSearchBody {
31
36
  })
32
37
  fields?: string[];
33
38
  @ApiProperty({
34
- type: () => [[String]],
35
- required: false,
36
- examples: ['[[ "field1", "asc" ]]'],
37
- default: [['field1', 'asc']],
39
+ type: 'array',
40
+ required: false,
41
+ items:{
42
+ type: 'array',
43
+ items:{
44
+ type:'string'
45
+ }
46
+ },
47
+ examples: ['[[ "field1", "asc" ]]'],
48
+ default: [['field1', 'asc']],
38
49
  })
50
+
39
51
  sorts?: string[][];
52
+
53
+
40
54
  @ApiProperty({ type: () => Object, required: false })
41
55
  lookup: Object;
42
56
  }
@@ -628,7 +628,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
628
628
  // }
629
629
  // this.logger.debug('warn2');
630
630
  if (this.hooks.beforeUpdate)
631
- await this.hooks.beforeUpdate(appuser, id, existingdata,data);
631
+ await this.hooks.beforeUpdate(appuser, id, existingdata, data);
632
632
 
633
633
  const dbsession = appuser.getDBSession();
634
634
  if (dbsession && !dbsession.inTransaction()) {
@@ -691,7 +691,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
691
691
  data.__v = existingdata.__v + 1;
692
692
 
693
693
  if (this.hooks.beforeUpdate)
694
- await this.hooks.beforeUpdate(appuser, id,existingdata, data);
694
+ await this.hooks.beforeUpdate(appuser, id, existingdata, data);
695
695
 
696
696
  const dbsession = appuser.getDBSession();
697
697
  if (dbsession && !dbsession.inTransaction()) {
@@ -1058,7 +1058,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
1058
1058
  collections.forEach((tokey: string) => {
1059
1059
  const toarr = tokey.split('.');
1060
1060
  const to = toarr[0];
1061
- const foreignField = toarr[1] ?? '_id';
1061
+ toarr.splice(0,1)
1062
+ const foreignField = toarr.join('.') ?? '_id';
1062
1063
  pipelines.push({
1063
1064
  $lookup: {
1064
1065
  from: to,
@@ -1083,7 +1084,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
1083
1084
  });
1084
1085
  pipelines.push({ $sort: sortobj });
1085
1086
  }
1086
- // console.log('pipelinespipelinespipelines', pipelines);
1087
+ this.logger.warn( pipelines,'pipelinespipelinespipelines',);
1087
1088
 
1088
1089
  return pipelines;
1089
1090
  }
@@ -39,7 +39,7 @@ export const getDocumentApi = (documentName: string): any => {
39
39
  const config = getAxiosConfig()
40
40
  const docsOpenapi: any = {
41
41
  <% for(let i=0;i<it.modules.length; i++){ %>
42
- '<%=it.modules[i].docname.toLowerCase()%>': new o.<%=it.modules[i].doctype.toUpperCase()%>Api(config),
42
+ '<%=it.modules[i].docname.toLowerCase()%>': new o.<%=it.modules[i].docname.toUpperCase()%>Api(config),
43
43
  <%}%>
44
44
  };
45
45
 
@@ -24,7 +24,7 @@ type crudType = {
24
24
  runDelete: Function;
25
25
  runSearch: Function;
26
26
  runDefault:Function;
27
- runFullTextSearch:Function;
27
+ runFullTextSearch?:Function;
28
28
  };
29
29
  export class SimpleAppClient<
30
30
  TData extends { _id?: string,created?:string },