@simitgroup/simpleapp-generator 1.0.46 → 1.0.48

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.
Files changed (147) hide show
  1. package/README.md +35 -1
  2. package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -20
  3. package/dist/buildinschemas/autoincreament.js +1 -1
  4. package/dist/buildinschemas/autoincreament.js.map +1 -1
  5. package/dist/buildinschemas/branch.js +1 -1
  6. package/dist/buildinschemas/branch.js.map +1 -1
  7. package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
  8. package/dist/buildinschemas/docnoformat.js +12 -25
  9. package/dist/buildinschemas/docnoformat.js.map +1 -1
  10. package/dist/buildinschemas/user.d.ts.map +1 -1
  11. package/dist/buildinschemas/user.js +1 -0
  12. package/dist/buildinschemas/user.js.map +1 -1
  13. package/dist/framework.d.ts.map +1 -1
  14. package/dist/framework.js +11 -3
  15. package/dist/framework.js.map +1 -1
  16. package/dist/generate.js +33 -22
  17. package/dist/generate.js.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  21. package/dist/processors/jsonschemabuilder.js +10 -0
  22. package/dist/processors/jsonschemabuilder.js.map +1 -1
  23. package/dist/type.d.ts +115 -22
  24. package/dist/type.d.ts.map +1 -1
  25. package/dist/type.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/buildinschemas/autoincreament.ts +1 -1
  28. package/src/buildinschemas/branch.ts +1 -1
  29. package/src/buildinschemas/docnoformat.ts +13 -27
  30. package/src/buildinschemas/user.ts +1 -0
  31. package/src/framework.ts +11 -3
  32. package/src/generate.ts +35 -22
  33. package/src/index.ts +1 -1
  34. package/src/processors/jsonschemabuilder.ts +14 -1
  35. package/src/type.ts +137 -22
  36. package/templates/basic/nest/processor.ts.eta +5 -3
  37. package/templates/basic/nest/service.ts.eta +2 -4
  38. package/templates/basic/nuxt/pages.crud.vue.eta +3 -2
  39. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +18 -2
  40. package/templates/nest/src/app.controller.ts.eta +6 -0
  41. package/templates/nest/src/app.module.ts.eta +9 -1
  42. package/templates/nest/src/app.service.ts.eta +6 -0
  43. package/templates/nest/src/main.ts.eta +7 -0
  44. package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
  45. package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
  46. package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
  47. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
  48. package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
  49. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
  50. package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
  51. package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
  52. package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
  53. package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
  54. package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
  55. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
  56. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
  57. package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
  58. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
  59. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
  60. package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
  61. package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
  62. package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
  63. package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
  64. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +54 -12
  65. package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
  66. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
  67. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
  68. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
  69. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
  70. package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
  71. package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
  72. package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
  73. package/templates/nest/src/simpleapp/services/docno.service.ts.eta +9 -10
  74. package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
  75. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
  76. package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
  77. package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
  78. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
  79. package/templates/nuxt/app.vue.eta +6 -1
  80. package/templates/nuxt/assets/css/style.css._eta +12 -0
  81. package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
  82. package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
  83. package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
  84. package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
  85. package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
  86. package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
  87. package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
  88. package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
  89. package/templates/nuxt/components/CrudNestedDoc.vue.eta +16 -8
  90. package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
  91. package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
  92. package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
  93. package/templates/nuxt/components/Invitation.vue.eta +2 -2
  94. package/templates/nuxt/components/ListView.vue.eta +52 -0
  95. package/templates/nuxt/components/Menus.vue.eta +6 -6
  96. package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
  97. package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
  98. package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +2 -2
  99. package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
  100. package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
  101. package/templates/nuxt/components/Spinner.vue.eta +9 -0
  102. package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
  103. package/templates/nuxt/layouts/default.vue.eta +3 -12
  104. package/templates/nuxt/layouts/sidelistcrud.vue.eta +43 -0
  105. package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
  106. package/templates/nuxt/nuxt.config.ts.eta +55 -12
  107. package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +274 -247
  108. package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
  109. package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -65
  110. package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
  111. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
  112. package/templates/nuxt/pages/index.vue.eta +10 -85
  113. package/templates/nuxt/pages/login.vue.eta +9 -3
  114. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
  115. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
  116. package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
  117. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
  118. package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
  119. package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
  120. package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
  121. package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
  122. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
  123. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
  124. package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
  125. package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
  126. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
  127. package/templates/nuxt/tailwind.config.ts._eta +66 -0
  128. package/templates/nuxt/types/index.ts.eta +22 -1
  129. package/templates/project/build.sh.eta +4 -4
  130. package/templates/project/schemas/category.ts.eta +40 -27
  131. package/templates/project/schemas/customer.ts.eta +35 -0
  132. package/templates/project/schemas/index.ts.eta +4 -4
  133. package/templates/project/schemas/invoice.ts.eta +56 -0
  134. package/templates/project/schemas/product.ts.eta +41 -57
  135. package/templates/project/sharelibs/index.ts.eta +2 -0
  136. package/templates/project/sharelibs/money.ts.eta +17 -0
  137. package/tsconfig.tsbuildinfo +1 -1
  138. package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
  139. package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
  140. package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
  141. package/templates/nuxt/tailwind.config.ts.eta +0 -9
  142. package/templates/project/shares/index.ts.eta +0 -2
  143. /package/templates/nest/{.env.eta → .env._eta} +0 -0
  144. /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
  145. /package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +0 -0
  146. /package/templates/project/{config.json.eta → config.json._eta} +0 -0
  147. /package/templates/project/{shares → sharelibs}/hello.ts.eta +0 -0
@@ -1,8 +1,8 @@
1
1
  /**
2
- * This file was automatically generated by simpleapp generator during initialization.
3
- * DO NOT MODIFY IT BY HAND.
4
- * last change 2023-09-22
5
- * author: Ks Tan
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
6
  */
7
7
  import { defineNuxtPlugin } from "#app";
8
8
  <% for(let i=0;i<it.modules.length; i++){ %>
@@ -1,8 +1,8 @@
1
1
  /**
2
- * This file was automatically generated by simpleapp generator during initialization.
3
- * DO NOT MODIFY IT BY HAND.
4
- * last change 2023-09-09
5
- * author: Ks Tan
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
6
  */
7
7
 
8
8
 
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  import { NuxtAuthHandler } from "#auth";
2
8
  import KeycloakProvider from "next-auth/providers/keycloak";
3
9
 
@@ -1,4 +1,9 @@
1
- // give keycloak for
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
2
7
  export default defineEventHandler(async (event) => {
3
8
  const path = `${
4
9
  process.env.OAUTH2_CONFIGURL
@@ -1,9 +1,8 @@
1
-
2
1
  /**
3
- * This file was automatically generated by simpleapp generator during initialization.
4
- * DO NOT MODIFY IT BY HAND.
5
- * last change 2023-09-09
6
- * author: Ks Tan
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
7
6
  */
8
7
 
9
8
 
@@ -1,11 +1,9 @@
1
-
2
1
  /**
3
- * This file was automatically generated by simpleapp generator during initialization.
4
- * DO NOT MODIFY IT BY HAND.
5
- * last change 2023-09-09
6
- * author: Ks Tan
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
7
6
  */
8
-
9
7
 
10
8
  import axios from 'axios';
11
9
  import { getServerSession } from '#auth'
@@ -1,4 +1,9 @@
1
-
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
2
7
  import Ajv from 'ajv';
3
8
  import addFormats from 'ajv-formats';
4
9
  import addErrors from 'ajv-errors';
@@ -18,7 +23,7 @@ type crudType = {
18
23
  runSearch: Function
19
24
  };
20
25
  export class SimpleAppClient<
21
- TData extends { _id?: string },
26
+ TData extends { _id?: string,created:string },
22
27
  TApi extends crudType,
23
28
  > {
24
29
  protected defaultTimeOut=5000
@@ -36,9 +41,11 @@ export class SimpleAppClient<
36
41
  this.doctype=doctype
37
42
  this.docname = docname
38
43
  }
44
+
39
45
  getDocType = () => this.doctype;
40
46
  getDocName = () => this.docname;
41
47
  setNew = ()=>{}
48
+ isNew = () => this.data.value['created']==''
42
49
  setSchema = (schema: any) => (this.schema = schema);
43
50
  getSchema = () => this.schema;
44
51
  getErrors = () => this.errorlist;
@@ -1,6 +1,15 @@
1
- export const alldocuments:any[] = [
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
7
+ import { DocumentMetaData } from "~/types"
8
+ export const alldocuments:DocumentMetaData[] = [
2
9
  <%for(let i=0; i<it.modules.length;i++){ %>
3
- <% const d = it.modules[i] %>
4
- {docName:'<%= d['docname'] %>',docType:'<%= d['doctype'].toUpperCase()%>',page: '<%=d['pagetype'] %>'},
10
+ <% const d = it.modules[i] %>
11
+ <% const conf = d.schema["x-simpleapp-config"] %>
12
+ {docName:'<%= d['docname'] %>',docType:'<%= d['doctype'].toUpperCase()%>',page: '<%=d['pagetype']%>', isolationType:'<%=conf['isolationType']%>',
13
+ documentDate:'<%=conf['documentDate']??""%>', docNumber:<%=conf['generateDocumentNumber']??false%>},
5
14
  <%}%>
6
15
  ]
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  export enum SimpleAppEventType {
2
8
  'InvitationAccepted' = 'invitationaccepted',
3
9
  'InvitationRejected' = 'invitationrejected'
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  type grouptype = {[key:string]:roletype[]}
2
8
  export const allgroups:grouptype = {
3
9
  <% Object.getOwnPropertyNames(it.allroles).forEach((key)=>{ %>
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  type roletype = {resource:string, action:string}
2
8
  const allroles:roletype[] = [
3
9
  <% for(let i=0;i<it.modules.length; i++){ %>
@@ -0,0 +1,66 @@
1
+ import type { Config } from 'tailwindcss'
2
+
3
+ // Default are on https://tailwindcss.nuxtjs.org/tailwind/config#default-configuration
4
+ export default <Partial<Config>>{
5
+ theme: {
6
+ extend:{
7
+ colors:{
8
+ primary:{
9
+ '50': '#f0fdf4',
10
+ '100': '#dcfce7',
11
+ '200': '#bbf7d0',
12
+ '300': '#6ee7b7',
13
+ '400': '#34d399',
14
+ '500': '#10b981',
15
+ '600': '#059669',
16
+ '700': '#15803d',
17
+ '800': '#166534',
18
+ '900': '#14532d',
19
+ '950': '#052e16',
20
+ },
21
+ secondary:{
22
+ '50': '#f0f9ff',
23
+ '100': '#e0f2fe',
24
+ '200': '#bae6fd',
25
+ '300': '#93c5fd',
26
+ '400': '#38bdf8',
27
+ '500': '#0ea5e9',
28
+ '600': '#0284c7',
29
+ '700': '#0369a1',
30
+ '800': '#075985',
31
+ '900': '#0c4a6e',
32
+ '950': '#082f49',
33
+ },
34
+ warning:{
35
+ '50': '#fff7ed',
36
+ '100': '#ffedd5',
37
+ '200': '#fed7aa',
38
+ '300': '#fdba74',
39
+ '400': '#fb923c',
40
+ '500': '#f97316',
41
+ '600': '#ea580c',
42
+ '700': '#c2410c',
43
+ '800': '#9a3412',
44
+ '900': '#7c2d12',
45
+ '950': '#431407',
46
+ },
47
+ danger:{
48
+ '50': '#fef2f2',
49
+ '100': '#fee2e2',
50
+ '200': '#fecaca',
51
+ '300': '#fca5a5',
52
+ '400': '#f87171',
53
+ '500': '#ef4444',
54
+ '600': '#dc2626',
55
+ '700': '#b91c1c',
56
+ '800': '#991b1b',
57
+ '900': '#7f1d1d',
58
+ '950': '#450a0a'
59
+ }
60
+ }
61
+ }
62
+ },
63
+ plugins: [],
64
+ content: [],
65
+ darkMode: 'class',
66
+ }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  export type UserListItem = {
2
8
  _id: string
3
9
  uid?:string
@@ -39,12 +45,27 @@ export type PermissionListItem = {
39
45
  _id:string
40
46
 
41
47
  }
48
+ export type DocumentMetaData = {
49
+ docName:string
50
+ docType:string
51
+ page: string
52
+ isolationType:string
53
+ documentDate:string
54
+ docNumber:boolean
55
+ }
56
+ export type MenuData = {
57
+ label: string
58
+ icon?: string
59
+ command?:Function
60
+ items?: MenuData[]
61
+ isolationType?:string
62
+ url?:string
63
+ }
42
64
 
43
65
  export type DocNoFormat ={
44
66
  docNoFormatName: string
45
67
  docNoFormatNo:string
46
68
  docNoPattern:string
47
- isMonthly: boolean
48
69
  active: boolean
49
70
  sample:string
50
71
  }
@@ -7,16 +7,16 @@ npx prettier --write jsonschemas
7
7
 
8
8
  if [ $type == 'frontend' ]; then
9
9
  simpleapp-generator -c config.json -g frontend
10
- cp -a ./shares frontend/simpleapp/generate
10
+ cp -a ./sharelibs frontend/simpleapp/generate
11
11
  elif [ $type == 'updatefrontend' ]; then
12
12
  simpleapp-generator -c config.json -g updatefrontend
13
- cp -a ./shares frontend/simpleapp/generate
13
+ cp -a ./sharelibs frontend/simpleapp/generate
14
14
  elif [ $type == 'backend' ]; then
15
15
  simpleapp-generator -c config.json -g backend
16
- cp -a ./shares backend/src/simpleapp/generate
16
+ cp -a ./sharelibs backend/src/simpleapp/generate
17
17
  elif [ $type == 'updatebackend' ]; then
18
18
  simpleapp-generator -c config.json -g updatebackend
19
- cp -a ./shares backend/src/simpleapp/generate
19
+ cp -a ./sharelibs backend/src/simpleapp/generate
20
20
  fi
21
21
 
22
22
 
@@ -1,27 +1,40 @@
1
- //examples
2
- import {SchemaType,RESTMethods,IsolationType} from '/usr/local/lib/node_modules/@simitgroup/simpleapp-generator/src/type'
3
- export const category:SchemaType =
4
- {
5
- type: "object",
6
- "x-simpleapp-config":{
7
- documentType:'cat',
8
- documentName:'category',
9
- isolationType:IsolationType.org,
10
- pageType:"crud"
11
- },
12
- properties: {
13
- _id:{type:'string'},
14
- created:{type:'string'},
15
- updated:{type:'string'},
16
- createdby:{type:'string'},
17
- updatedby:{type:'string'},
18
- tenantId: {type:'integer',default:1,minimum:1 },
19
- orgId: {type:'integer',default:1,minimum:1 },
20
- branchId: {type:'integer',default:1,minimum:1 },
21
- categoryCode: {"type": "string","examples": ["TUITION"]},
22
- categoryName: {"type": "string","examples": ["Tuition Service"]},
23
- active: {"type": "boolean","default":true,"examples": [true]},
24
- categoryType: {type: "string",enum:["class","charge"],examples: ["class"]},
25
- description: {type: "string",format:"text","examples": ["Maths Tuition primary 1"]}
26
- }
27
- }
1
+ import {
2
+ SchemaType,
3
+ RESTMethods,
4
+ IsolationType,
5
+ } from '/usr/local/lib/node_modules/@simitgroup/simpleapp-generator/src/type'
6
+ //"/Users/kstan/dev/lowcode/simpleapp-generator/src/type";
7
+ export const category: SchemaType = {
8
+ type: "object",
9
+ "x-simpleapp-config": {
10
+ documentType: "cat",
11
+ documentName: "category",
12
+ isolationType: IsolationType.org,
13
+ uniqueKey:'categoryCode',
14
+ documentTitle:'categoryName',
15
+ pageType: "crud",
16
+ },
17
+ properties: {
18
+ _id: { type: "string" },
19
+ created: { type: "string" },
20
+ updated: { type: "string" },
21
+ createdby: { type: "string" },
22
+ updatedby: { type: "string" },
23
+ tenantId: { type: "integer", default: 1, minimum: 1 },
24
+ orgId: { type: "integer", default: 1, minimum: 1 },
25
+ branchId: { type: "integer", default: 1, minimum: 1 },
26
+ categoryCode: { type: "string", examples: ["TUITION"] },
27
+ categoryName: { type: "string", examples: ["Tuition Service"] },
28
+ active: { type: "boolean", default: true, examples: [true] },
29
+ categoryType: {
30
+ type: "string",
31
+ enum: ["class", "charge"],
32
+ examples: ["class"],
33
+ },
34
+ description: {
35
+ type: "string",
36
+ format: "text",
37
+ examples: ["Maths Tuition primary 1"],
38
+ },
39
+ },
40
+ };
@@ -0,0 +1,35 @@
1
+ import {
2
+ SchemaType,
3
+ RESTMethods,
4
+ IsolationType,
5
+ } from '/usr/local/lib/node_modules/@simitgroup/simpleapp-generator/src/type'
6
+ //"/Users/kstan/dev/lowcode/simpleapp-generator/src/type";
7
+ export const customer: SchemaType = {
8
+ type: "object",
9
+ "x-simpleapp-config": {
10
+ documentType: "cust",
11
+ documentName: "customer",
12
+ uniqueKey:'customerNo',
13
+ documentTitle:'customerName',
14
+ generateDocumentNumber:true,
15
+ isolationType: IsolationType.org,
16
+ pageType: "crud",
17
+ },
18
+ properties: {
19
+ _id: { type: "string" },
20
+ created: { type: "string" },
21
+ updated: { type: "string" },
22
+ createdby: { type: "string" },
23
+ updatedby: { type: "string" },
24
+ tenantId: { type: "integer", default: 1, minimum: 1 },
25
+ orgId: { type: "integer", default: 1, minimum: 1 },
26
+ branchId: { type: "integer", default: 1, minimum: 1 },
27
+ customerNo: { type: "string", format:"documentno",examples: ["S0001"] },
28
+ customerName: { type: "string", examples: ["Customer 1"] },
29
+ active: { type: "boolean", default: true, examples: [true] },
30
+ description: {type: "string",format: "text"},
31
+ docNoFormat: {type: "object","x-foreignkey":"docnoformat",
32
+ properties: { _id: { type: "string" }, label: { type: "string" } },
33
+ },
34
+ },
35
+ };
@@ -1,5 +1,5 @@
1
1
  //examples
2
- export { product } from './product';
3
- export {category} from './category'
4
-
5
-
2
+ export { product } from "./product";
3
+ export { category } from "./category";
4
+ export { customer } from "./customer";
5
+ export { invoice } from "./invoice";
@@ -0,0 +1,56 @@
1
+ import {
2
+ SchemaType,
3
+ RESTMethods,
4
+ IsolationType,
5
+ } from '/usr/local/lib/node_modules/@simitgroup/simpleapp-generator/src/type'
6
+ //"/Users/kstan/dev/lowcode/simpleapp-generator/src/type";
7
+ export const invoice: SchemaType = {
8
+ type: "object",
9
+ "x-simpleapp-config": {
10
+ documentType: "inv",
11
+ documentName: "invoice",
12
+ isolationType: IsolationType.org,
13
+ uniqueKey:'invoiceNo',
14
+ documentTitle:'invoiceTitle',
15
+ documentDate:"invoiceDate",
16
+ generateDocumentNumber:true,
17
+ pageType: "crud",
18
+ formulas:[
19
+ {jsonpath:'$.details[*]',formula:'sharelibs.getSubtotal(value)'},
20
+ {jsonpath:'$.invoiceTotal',formula:'sharelibs.getTotal(data.details)'},
21
+ ]
22
+ },
23
+ properties: {
24
+ _id: { type: "string", },
25
+
26
+ created: { type: "string" },
27
+ updated: { type: "string" },
28
+ createdby: { type: "string" },
29
+ updatedby: { type: "string" },
30
+ tenantId: { type: "integer", default: 1, minimum: 1 },
31
+ orgId: { type: "integer", default: 1, minimum: 1 },
32
+ branchId: { type: "integer", default: 1, minimum: 1 },
33
+ customer:{type:'object','x-foreignkey':'customer',properties:{_id:{type:'string'},label:{type:'string'}, }},
34
+ invoiceNo: { type: "string", examples: ["SI1111"],format:'documentno' },
35
+ invoiceTitle: { type: "string", examples: ["Sales to XYZ"] },
36
+ invoiceTotal:{ type:'number',default:0.00},
37
+ details:{
38
+ type:'array',
39
+ items:{
40
+ type:'object',
41
+ properties:{
42
+ product:{ type:'object', 'x-foreignkey':'product',properties:{_id:{type:'string'},label:{type:'string'},defaultprice:{type:'number',default:0.00}}},
43
+ quantity:{type:'integer',default:1},
44
+ unitprice:{type:'number',default:0.00},
45
+ subtotal:{type:'number', default:0.00}
46
+ }
47
+ }
48
+ },
49
+ description: {
50
+ type: "string",
51
+ format: "text",
52
+ examples: ["Maths Tuition primary 1"],
53
+ },
54
+ },
55
+ };
56
+
@@ -1,59 +1,43 @@
1
1
  //examples
2
- import {SchemaType,RESTMethods,IsolationType} from '/usr/local/lib/node_modules/@simitgroup/simpleapp-generator/src/type'
3
- export const product:SchemaType =
4
- {
5
- type: "object",
6
- "x-simpleapp-config":{
7
- documentType:'prd',
8
- documentName:'product',
9
- isolationType:IsolationType.org,
10
- pageType:"crud"
11
- },
2
+ import {
3
+ SchemaType,
4
+ RESTMethods,
5
+ IsolationType,
6
+ } from "/Users/kstan/dev/lowcode/simpleapp-generator/src/type";
7
+ export const product: SchemaType = {
8
+ type: "object",
9
+ "x-simpleapp-config": {
10
+ documentType: "prd",
11
+ documentName: "product",
12
+ uniqueKey:'productCode',
13
+ documentTitle:'productName',
14
+ isolationType: IsolationType.org,
15
+ pageType: "crud",
16
+ additionalAutoCompleteFields:['defaultprice'],
17
+ },
12
18
 
13
- properties: {
14
- _id:{type:'string'},
15
- created:{type:'string'},
16
- updated:{type:'string'},
17
- createdby:{type:'string'},
18
- updatedby:{type:'string'},
19
- tenantId: {type:'integer',default:1,minimum:1 },
20
- orgId: {type:'integer',default:1,minimum:1 },
21
- branchId: {type:'integer',default:1,minimum:1 },
22
- productCode: {type: "string",examples: ["BK-MTHP1"]},
23
- productName: {type: "string",examples: ["Math Primary 1 Book"]},
24
- level: {
25
- type: "object",
26
- "x-foreignkey":"level",
27
- properties: {
28
- "_id": {
29
- "type": "string",
30
- "examples": [
31
- "aaa"
32
- ]
33
- },
34
- "label": {
35
- "type": "string",
36
- "examples": [
37
- "P1"
38
- ]
39
- }
40
- }
41
- },
42
- category: {type: "object","x-foreignkey":"category", properties: {_id: {type: "string"},label: {type: "string"}}},
43
- defaultprice: {"type": "number",},
44
- taxsetting: {
45
- type: "object",
46
- "x-foreignkey":"taxsetting",
47
- properties: {
48
- "_id": {"type": "string",},
49
- "label": {"type": "string","examples": ["6%"]},
50
- "taxpercent":{"type":"number","examples":[6]}
51
- }
52
- },
53
- "taxinclusive": {type: "boolean",},
54
- active: {type: "boolean",default:true,},
55
- description: {type: "string",},
56
- tags: {type: "array",items: {type: "string",examples: ["P1","Math"]}
57
- }
58
- }
59
- }
19
+ properties: {
20
+ _id: { type: "string" },
21
+ created: { type: "string" },
22
+ updated: { type: "string" },
23
+ createdby: { type: "string" },
24
+ updatedby: { type: "string" },
25
+ tenantId: { type: "integer", default: 1, minimum: 1 },
26
+ orgId: { type: "integer", default: 1, minimum: 1 },
27
+ branchId: { type: "integer", default: 1, minimum: 1 },
28
+ productCode: { type: "string", examples: ["BK-MTHP1"] },
29
+ productName: { type: "string", examples: ["Math Primary 1 Book"] },
30
+ category: {
31
+ type: "object",
32
+ "x-foreignkey": "category",
33
+ properties: { _id: { type: "string" }, label: { type: "string" } },
34
+ },
35
+ defaultprice: { type: "number" },
36
+ active: { type: "boolean", default: true },
37
+ description: { type: "string" },
38
+ tags: {
39
+ type: "array",
40
+ items: { type: "string", examples: ["P1", "Math"] },
41
+ },
42
+ },
43
+ };
@@ -0,0 +1,2 @@
1
+ export * from './hello';
2
+ export * from './money'
@@ -0,0 +1,17 @@
1
+ export const getSubtotal = (details) =>{
2
+
3
+ details.subtotal = details.unitprice * details.quantity
4
+ console.log(details)
5
+ return details
6
+ }
7
+
8
+ export const getTotal = (details:any[]) => {
9
+ if(details && details.length> 0){
10
+ let total = 0
11
+ details.forEach(item=>{
12
+ total += item.subtotal
13
+ })
14
+ return total
15
+ }
16
+ return 0
17
+ }