@simitgroup/simpleapp-generator 1.0.52 → 1.0.54
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 +10 -3
- package/docs/jsonschema.md +123 -0
- package/package.json +1 -1
- package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +1 -4
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +0 -7
- package/templates/nuxt/layouts/sidelistcrud.vue.eta +1 -1
- package/templates/nuxt/nuxt.config.ts.eta +4 -1
- package/templates/project/README.md +2 -10
- package/templates/project/build.sh.eta +2 -2
- package/templates/project/jsonschemas/category.json._eta +34 -0
- package/templates/project/jsonschemas/customer.json._eta +38 -0
- package/templates/project/jsonschemas/invoice.json._eta +70 -0
- package/templates/project/jsonschemas/product.json._eta +39 -0
- package/templates/project/generate.ts.eta +0 -10
- package/templates/project/jsonschemas/category.json.eta +0 -1
- package/templates/project/schemas/category.ts.eta +0 -40
- package/templates/project/schemas/customer.ts.eta +0 -35
- package/templates/project/schemas/index.ts.eta +0 -5
- package/templates/project/schemas/invoice.ts.eta +0 -56
- package/templates/project/schemas/product.ts.eta +0 -43
- /package/{documentation → design}/designconcept.bpmn +0 -0
- /package/{documentation → design}/documentation.png +0 -0
- /package/{documentation → design}/infra.drawio +0 -0
- /package/{documentation → design}/infra.png +0 -0
- /package/{documentation → design}/management.drawio +0 -0
- /package/{documentation → design}/stack.drawio +0 -0
package/README.md
CHANGED
|
@@ -22,7 +22,10 @@ SimpleApp generator is a typescript code generator for convert jsonschemas becom
|
|
|
22
22
|
g. document uploads[]
|
|
23
23
|
h. workflow integration[]
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
# Documentation
|
|
26
|
+
1. [jsonschemas](./docs/jsonschema.md)
|
|
27
|
+
2. backend
|
|
28
|
+
3. frontend
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
# Quick start
|
|
@@ -49,11 +52,11 @@ docker exec -it mongo1 mongosh --eval "rs.initiate({
|
|
|
49
52
|
})"
|
|
50
53
|
|
|
51
54
|
# set mongod1 high priority as primary server
|
|
52
|
-
docker exec -it mongo1
|
|
55
|
+
docker exec -it mongo1 mongosh --eval "cfg = rs.conf()
|
|
53
56
|
cfg.members[0].priority = 50
|
|
54
57
|
cfg.members[1].priority = 1
|
|
55
58
|
cfg.members[2].priority = 1
|
|
56
|
-
rs.reconfig(cfg)"
|
|
59
|
+
rs.reconfig(cfg)"
|
|
57
60
|
|
|
58
61
|
#check cluster status
|
|
59
62
|
docker exec -it mongo1 mongosh --eval "rs.status()"
|
|
@@ -104,6 +107,10 @@ sh build.sh frontend
|
|
|
104
107
|
```sh
|
|
105
108
|
cd ~/project1/frontend
|
|
106
109
|
pnpm dev
|
|
110
|
+
|
|
111
|
+
#or use production way
|
|
112
|
+
nuxi build
|
|
113
|
+
nuxi preview
|
|
107
114
|
```
|
|
108
115
|
|
|
109
116
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Json Schema
|
|
2
|
+
Simpleapp implement customized version of json schema. This chapter cover some explanation of the special property.
|
|
3
|
+
To understannd what is json schema, refer [official documentation](https://json-schema.org/learn/getting-started-step-by-step)
|
|
4
|
+
To prepare jsonschema efficiently, we can convert json sample data to jsonschema [here](https://redocly.com/tools/json-to-json-schema/)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Sample
|
|
8
|
+
|
|
9
|
+
refer below example `product.json`:
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"type": "object",
|
|
13
|
+
"x-simpleapp-config": {
|
|
14
|
+
"documentType": "prd",
|
|
15
|
+
"documentName": "product",
|
|
16
|
+
"uniqueKey": "productCode",
|
|
17
|
+
"documentTitle": "productName",
|
|
18
|
+
"isolationType": "org",
|
|
19
|
+
"pageType": "crud",
|
|
20
|
+
"additionalAutoCompleteFields": ["defaultprice"]
|
|
21
|
+
},
|
|
22
|
+
"properties": {
|
|
23
|
+
...
|
|
24
|
+
"productCode": { "type": "string", "examples": ["BK-MTHP1"] },
|
|
25
|
+
"productName": { "type": "string", "examples": ["Math Primary 1 Book"] },
|
|
26
|
+
"category": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"x-foreignkey": "category",
|
|
29
|
+
"properties": {
|
|
30
|
+
"_id": { "type": "string" },
|
|
31
|
+
"label": { "type": "string" }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
...
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
There is 2 special property (and only 2) which is
|
|
39
|
+
1. root level property `x-simpleapp-config`, which define how the json schema been use to generate source code
|
|
40
|
+
2. field level property `x-foreignkey`: field level property, which declare foreign key `category`. It require another json schema `category.json` which will store at different mongodb collection
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## `x-simpleapp-config`
|
|
44
|
+
It tell code generator what it need to do with this schema such as:
|
|
45
|
+
1. store under which collection
|
|
46
|
+
2. tag with what api name
|
|
47
|
+
3. rules of data isolation
|
|
48
|
+
4. implement special document numbering format
|
|
49
|
+
5. how data index and much more.
|
|
50
|
+
|
|
51
|
+
| property | datatype | required | description|
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| documentType | string | yes |short form of document name, it is unique identity of resource use by some place, like configure document running number, tags in swagger ui, backend file prefix and etc. Example: inv, po |
|
|
54
|
+
| documentName | string | yes | default name of mongodb collection, also act as long unique identity of resources, most of the place will use this name as as resource name, or prefix of resource name. Example invoice,purchaseorder
|
|
55
|
+
| isolationType | string | yes | data isolation rules. `none`: shall all tenant, `tenant`: shall all organization in same tenant, `org`: shall to all branch under same org. `branch`: only share within same branch
|
|
56
|
+
| uniqueKey | string | usually yes | declare unique key field name, such as itemCode, documentNo, studentCode. auto generate document running number shall use field name declare here too. it auto appear in autocomplete. it will auto index in mongodb
|
|
57
|
+
| documentTitle | string | usually yes | label or title of this record. such as itemName, categoryName, customerName, invoiceTitle. it auto appear in autocomplete
|
|
58
|
+
| documentDate | string | no | define which field name of date. like invoiceDate, orderDate. it allow frontend know how to filter current month record. |
|
|
59
|
+
| generateDocumentNumber | boolean | no | it tell code generator whether current schema have document numbering control|
|
|
60
|
+
| pageType | string | usually yes| define 'crud' to generate template page, else no auto create page|
|
|
61
|
+
|additionalAutoCompleteFields| array of string| no | define what others field you want to put in autocomplete. such as product always like to include `defaultprice`, `uom`
|
|
62
|
+
| formula | array | no | define array of formula which will apply in fields. target field define with `jsonpath` format. formula usually define in sharelibs |
|
|
63
|
+
|additionalApis| array | no | define additional api for current schema. use case such as `suspend`, `confirm`, `reschedule`. We can define which customized function here
|
|
64
|
+
| collectionName | string | no | default value same with documentName. Avoid define it, it reserve for special situation which we want multiple document store in same collection
|
|
65
|
+
|allStatus| array| no | not implement yet, determine current document allow what document status, different document status may act differently like readonly, next status, available api and etc
|
|
66
|
+
|foreignKeys| object | no | system property, it auto fill in base on current document connect to which collection. It ensure current document join to record which is valid. It used during data validation during create and update
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## `x-foreignkey`
|
|
70
|
+
1. it define at field level, which allow frontend pick list of value easily.
|
|
71
|
+
2. backend only allow _id which is exists in destinated collection, invalid designate _id will cause create/update blocked. product only can store valid category's _id
|
|
72
|
+
3. it act like foreign key constraint, delete category which was connected to product will block
|
|
73
|
+
|
|
74
|
+
## format
|
|
75
|
+
all field define as string support additional property `format`. such as:
|
|
76
|
+
```json
|
|
77
|
+
{...
|
|
78
|
+
"email": {"type":"string","format":"email"}
|
|
79
|
+
..}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
input which not compatible with `format` will be block by frontend and backend.
|
|
83
|
+
|
|
84
|
+
simpleapp support [ajv](https://ajv.js.org/guide/formats.html#string-formats`), plus a few as below:
|
|
85
|
+
| format name | example | description|
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| documentno | SI-HQ-0001 | generator will auto prepare special input element for field with this format. apply this format to field declared as `uniqueKey` only
|
|
88
|
+
| tel | 0129988772 | 7-15 character numbering only
|
|
89
|
+
| text| any word | no control, generator will auto prepare textarea for field with this format
|
|
90
|
+
| html| any word | no control, reserve, reserve to auto prepare html editor. yet to decide implement or not
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Compulsory schema properties
|
|
95
|
+
to allow data traceable and isolated properly, there is compulsory property in highest level
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
...
|
|
99
|
+
"_id": { "type": "string" },
|
|
100
|
+
"created": { "type": "string" },
|
|
101
|
+
"updated": { "type": "string" },
|
|
102
|
+
"createdby": { "type": "string" },
|
|
103
|
+
"updatedby": { "type": "string" },
|
|
104
|
+
"tenantId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
105
|
+
"orgId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
106
|
+
"branchId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
107
|
+
...
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Data validation
|
|
114
|
+
There is 2 kind of data validation which is:
|
|
115
|
+
1. jsonschema rules
|
|
116
|
+
2. backend validation rules
|
|
117
|
+
|
|
118
|
+
## jsonschema data validation
|
|
119
|
+
we use [AJV](https://ajv.js.org/guide/getting-started.html) to jsonschema rules validation, it support `required`,`minimum`,`minLength`, `format`, `pattern` and etc. Refer jsonschema official website to know more rules
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## backend validation rules
|
|
123
|
+
it require to write programming hook in backend, cover at backend development guide
|
package/package.json
CHANGED
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
<Button
|
|
5
5
|
class="btn-primary pi pi-question"
|
|
6
6
|
@click="previewPermission"
|
|
7
|
-
>
|
|
8
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
9
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z" />
|
|
10
|
-
</svg>
|
|
7
|
+
>
|
|
11
8
|
</Button>
|
|
12
9
|
<Sidebar
|
|
13
10
|
v-model:visible="showpermissioninfo"
|
|
@@ -88,7 +88,10 @@ tailwindcss: {
|
|
|
88
88
|
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
|
89
89
|
"./node_modules/primevue/**/*.{vue,js,ts,jsx,tsx}"
|
|
90
90
|
],
|
|
91
|
-
css: [
|
|
91
|
+
css: [
|
|
92
|
+
'primeicons/primeicons.css',
|
|
93
|
+
path.resolve(__dirname,'./assets/css/style.css')
|
|
94
|
+
],
|
|
92
95
|
|
|
93
96
|
// devtools: { enabled: true },
|
|
94
97
|
// build: {
|
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
# how to use
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
3. run build schemas
|
|
5
|
-
```
|
|
6
|
-
sh ./build.sh schema
|
|
7
|
-
```
|
|
8
|
-
4. then run
|
|
9
|
-
```
|
|
10
|
-
sh ./build.sh
|
|
11
|
-
```
|
|
2
|
+
refer to
|
|
3
|
+
https://github.com/SIMITGROUP/simpleapp-generator
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"x-simpleapp-config": {
|
|
4
|
+
"documentType": "cat",
|
|
5
|
+
"documentName": "category",
|
|
6
|
+
"isolationType": "org",
|
|
7
|
+
"uniqueKey": "categoryCode",
|
|
8
|
+
"documentTitle": "categoryName",
|
|
9
|
+
"pageType": "crud"
|
|
10
|
+
},
|
|
11
|
+
"properties": {
|
|
12
|
+
"_id": { "type": "string" },
|
|
13
|
+
"created": { "type": "string" },
|
|
14
|
+
"updated": { "type": "string" },
|
|
15
|
+
"createdby": { "type": "string" },
|
|
16
|
+
"updatedby": { "type": "string" },
|
|
17
|
+
"tenantId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
18
|
+
"orgId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
19
|
+
"branchId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
20
|
+
"categoryCode": { "type": "string", "examples": ["TUITION"] },
|
|
21
|
+
"categoryName": { "type": "string", "examples": ["Tuition Service"] },
|
|
22
|
+
"active": { "type": "boolean", "default": true, "examples": [true] },
|
|
23
|
+
"categoryType": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": ["class", "charge"],
|
|
26
|
+
"examples": ["class"]
|
|
27
|
+
},
|
|
28
|
+
"description": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"format": "text",
|
|
31
|
+
"examples": ["Maths Tuition primary 1"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"x-simpleapp-config": {
|
|
4
|
+
"documentType": "cust",
|
|
5
|
+
"documentName": "customer",
|
|
6
|
+
"uniqueKey": "customerNo",
|
|
7
|
+
"documentTitle": "customerName",
|
|
8
|
+
"generateDocumentNumber": true,
|
|
9
|
+
"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
|
+
"customerNo": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"format": "documentno",
|
|
24
|
+
"examples": ["S0001"]
|
|
25
|
+
},
|
|
26
|
+
"customerName": { "type": "string", "examples": ["Customer 1"] },
|
|
27
|
+
"active": { "type": "boolean", "default": true, "examples": [true] },
|
|
28
|
+
"description": { "type": "string", "format": "text" },
|
|
29
|
+
"docNoFormat": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"x-foreignkey": "docnoformat",
|
|
32
|
+
"properties": {
|
|
33
|
+
"_id": { "type": "string" },
|
|
34
|
+
"label": { "type": "string" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"x-simpleapp-config": {
|
|
4
|
+
"documentType": "inv",
|
|
5
|
+
"documentName": "invoice",
|
|
6
|
+
"isolationType": "org",
|
|
7
|
+
"uniqueKey": "invoiceNo",
|
|
8
|
+
"documentTitle": "invoiceTitle",
|
|
9
|
+
"documentDate": "invoiceDate",
|
|
10
|
+
"generateDocumentNumber": true,
|
|
11
|
+
"pageType": "crud",
|
|
12
|
+
"formulas": [
|
|
13
|
+
{ "jsonpath": "$.details[*]", "formula": "sharelibs.getSubtotal(value)" },
|
|
14
|
+
{
|
|
15
|
+
"jsonpath": "$.invoiceTotal",
|
|
16
|
+
"formula": "sharelibs.getTotal(data.details)"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"properties": {
|
|
21
|
+
"_id": { "type": "string" },
|
|
22
|
+
"created": { "type": "string" },
|
|
23
|
+
"updated": { "type": "string" },
|
|
24
|
+
"createdby": { "type": "string" },
|
|
25
|
+
"updatedby": { "type": "string" },
|
|
26
|
+
"tenantId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
27
|
+
"orgId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
28
|
+
"branchId": { "type": "integer", "default": 1, "minimum": 1 },
|
|
29
|
+
"customer": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"x-foreignkey": "customer",
|
|
32
|
+
"properties": {
|
|
33
|
+
"_id": { "type": "string" },
|
|
34
|
+
"label": { "type": "string" }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"invoiceNo": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"examples": ["SI1111"],
|
|
40
|
+
"format": "documentno"
|
|
41
|
+
},
|
|
42
|
+
"invoiceTitle": { "type": "string", "examples": ["Sales to XYZ"] },
|
|
43
|
+
"invoiceTotal": { "type": "number", "default": 0 },
|
|
44
|
+
"details": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"product": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"x-foreignkey": "product",
|
|
52
|
+
"properties": {
|
|
53
|
+
"_id": { "type": "string" },
|
|
54
|
+
"label": { "type": "string" },
|
|
55
|
+
"defaultprice": { "type": "number", "default": 0 }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"quantity": { "type": "integer", "default": 1 },
|
|
59
|
+
"unitprice": { "type": "number", "default": 0 },
|
|
60
|
+
"subtotal": { "type": "number", "default": 0 }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"description": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"format": "text",
|
|
67
|
+
"examples": ["Maths Tuition primary 1"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"x-simpleapp-config": {
|
|
4
|
+
"documentType": "prd",
|
|
5
|
+
"documentName": "product",
|
|
6
|
+
"uniqueKey": "productCode",
|
|
7
|
+
"documentTitle": "productName",
|
|
8
|
+
"isolationType": "org",
|
|
9
|
+
"pageType": "crud",
|
|
10
|
+
"additionalAutoCompleteFields": ["defaultprice"]
|
|
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
|
+
"productCode": { "type": "string", "examples": ["BK-MTHP1"] },
|
|
22
|
+
"productName": { "type": "string", "examples": ["Math Primary 1 Book"] },
|
|
23
|
+
"category": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"x-foreignkey": "category",
|
|
26
|
+
"properties": {
|
|
27
|
+
"_id": { "type": "string" },
|
|
28
|
+
"label": { "type": "string" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"defaultprice": { "type": "number" },
|
|
32
|
+
"active": { "type": "boolean", "default": true },
|
|
33
|
+
"description": { "type": "string" },
|
|
34
|
+
"tags": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": { "type": "string", "examples": ["P1", "Math"] }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as schemas from './schemas'
|
|
2
|
-
import {writeFileSync} from 'fs'
|
|
3
|
-
type keyofschema = keyof typeof schemas
|
|
4
|
-
Object.keys(schemas).forEach( (schemaname)=>{
|
|
5
|
-
const mykey :keyofschema = schemaname as keyofschema
|
|
6
|
-
// console.log("writing",schemas[mykey])
|
|
7
|
-
const content = JSON.stringify(schemas[mykey])
|
|
8
|
-
// console.log(content)
|
|
9
|
-
writeFileSync(`./jsonschemas/${schemaname}.json`,content)
|
|
10
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
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,56 +0,0 @@
|
|
|
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,43 +0,0 @@
|
|
|
1
|
-
//examples
|
|
2
|
-
import {
|
|
3
|
-
SchemaType,
|
|
4
|
-
RESTMethods,
|
|
5
|
-
IsolationType,
|
|
6
|
-
} from '/usr/local/lib/node_modules/@simitgroup/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
|
-
},
|
|
18
|
-
|
|
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
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|