@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.
- package/README.md +35 -1
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -20
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/autoincreament.js.map +1 -1
- package/dist/buildinschemas/branch.js +1 -1
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
- package/dist/buildinschemas/docnoformat.js +12 -25
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +1 -0
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +11 -3
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +33 -22
- package/dist/generate.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +115 -22
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +1 -1
- package/src/buildinschemas/branch.ts +1 -1
- package/src/buildinschemas/docnoformat.ts +13 -27
- package/src/buildinschemas/user.ts +1 -0
- package/src/framework.ts +11 -3
- package/src/generate.ts +35 -22
- package/src/index.ts +1 -1
- package/src/processors/jsonschemabuilder.ts +14 -1
- package/src/type.ts +137 -22
- package/templates/basic/nest/processor.ts.eta +5 -3
- package/templates/basic/nest/service.ts.eta +2 -4
- package/templates/basic/nuxt/pages.crud.vue.eta +3 -2
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +18 -2
- package/templates/nest/src/app.controller.ts.eta +6 -0
- package/templates/nest/src/app.module.ts.eta +9 -1
- package/templates/nest/src/app.service.ts.eta +6 -0
- package/templates/nest/src/main.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +54 -12
- package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +9 -10
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
- package/templates/nuxt/app.vue.eta +6 -1
- package/templates/nuxt/assets/css/style.css._eta +12 -0
- package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
- package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
- package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
- package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
- package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
- package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
- package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +16 -8
- package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
- package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
- package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
- package/templates/nuxt/components/Invitation.vue.eta +2 -2
- package/templates/nuxt/components/ListView.vue.eta +52 -0
- package/templates/nuxt/components/Menus.vue.eta +6 -6
- package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +2 -2
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
- package/templates/nuxt/components/Spinner.vue.eta +9 -0
- package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
- package/templates/nuxt/layouts/default.vue.eta +3 -12
- package/templates/nuxt/layouts/sidelistcrud.vue.eta +43 -0
- package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
- package/templates/nuxt/nuxt.config.ts.eta +55 -12
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +274 -247
- package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -65
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
- package/templates/nuxt/pages/index.vue.eta +10 -85
- package/templates/nuxt/pages/login.vue.eta +9 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
- package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
- package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
- package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
- package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
- package/templates/nuxt/tailwind.config.ts._eta +66 -0
- package/templates/nuxt/types/index.ts.eta +22 -1
- package/templates/project/build.sh.eta +4 -4
- package/templates/project/schemas/category.ts.eta +40 -27
- package/templates/project/schemas/customer.ts.eta +35 -0
- package/templates/project/schemas/index.ts.eta +4 -4
- package/templates/project/schemas/invoice.ts.eta +56 -0
- package/templates/project/schemas/product.ts.eta +41 -57
- package/templates/project/sharelibs/index.ts.eta +2 -0
- package/templates/project/sharelibs/money.ts.eta +17 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
- package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
- package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
- package/templates/nuxt/tailwind.config.ts.eta +0 -9
- package/templates/project/shares/index.ts.eta +0 -2
- /package/templates/nest/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +0 -0
- /package/templates/project/{config.json.eta → config.json._eta} +0 -0
- /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
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
5
|
-
*
|
|
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
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
5
|
-
*
|
|
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
|
-
|
|
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
|
|
4
|
-
*
|
|
5
|
-
* last change 2023-
|
|
6
|
-
*
|
|
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
|
|
4
|
-
*
|
|
5
|
-
* last change 2023-
|
|
6
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
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 ./
|
|
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 ./
|
|
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 ./
|
|
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 ./
|
|
19
|
+
cp -a ./sharelibs backend/src/simpleapp/generate
|
|
20
20
|
fi
|
|
21
21
|
|
|
22
22
|
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
3
|
-
export {category} from
|
|
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 {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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,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
|
+
}
|