@things-factory/quotation 6.0.46
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/CHANGELOG.md +8 -0
- package/assets/images/hatiolab-logo.png +0 -0
- package/client/actions/main.ts +1 -0
- package/client/activities/activity-quotation-edit.ts +90 -0
- package/client/activities/activity-quotation-view.ts +90 -0
- package/client/bootstrap.ts +8 -0
- package/client/index.ts +1 -0
- package/client/pages/main.ts +25 -0
- package/client/pages/quotation/quotation-importer.ts +97 -0
- package/client/pages/quotation/quotation-list-page.ts +348 -0
- package/client/reducers/main.ts +17 -0
- package/client/route.ts +11 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/actions/main.d.ts +1 -0
- package/dist-client/actions/main.js +2 -0
- package/dist-client/actions/main.js.map +1 -0
- package/dist-client/activities/activity-quotation-edit.d.ts +14 -0
- package/dist-client/activities/activity-quotation-edit.js +87 -0
- package/dist-client/activities/activity-quotation-edit.js.map +1 -0
- package/dist-client/activities/activity-quotation-view.d.ts +14 -0
- package/dist-client/activities/activity-quotation-view.js +87 -0
- package/dist-client/activities/activity-quotation-view.js.map +1 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +8 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/main.d.ts +1 -0
- package/dist-client/pages/main.js +27 -0
- package/dist-client/pages/main.js.map +1 -0
- package/dist-client/pages/quotation/quotation-importer.d.ts +22 -0
- package/dist-client/pages/quotation/quotation-importer.js +100 -0
- package/dist-client/pages/quotation/quotation-importer.js.map +1 -0
- package/dist-client/pages/quotation/quotation-list-page.d.ts +62 -0
- package/dist-client/pages/quotation/quotation-list-page.js +326 -0
- package/dist-client/pages/quotation/quotation-list-page.js.map +1 -0
- package/dist-client/reducers/main.d.ts +6 -0
- package/dist-client/reducers/main.js +14 -0
- package/dist-client/reducers/main.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +11 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/activities/activity-quotation.js +113 -0
- package/dist-server/activities/activity-quotation.js.map +1 -0
- package/dist-server/activities/index.js +17 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.js +7 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/index.js +23 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/quotation/event-subscriber.js +21 -0
- package/dist-server/service/quotation/event-subscriber.js.map +1 -0
- package/dist-server/service/quotation/index.js +12 -0
- package/dist-server/service/quotation/index.js.map +1 -0
- package/dist-server/service/quotation/quotation-history.js +123 -0
- package/dist-server/service/quotation/quotation-history.js.map +1 -0
- package/dist-server/service/quotation/quotation-mutation.js +168 -0
- package/dist-server/service/quotation/quotation-mutation.js.map +1 -0
- package/dist-server/service/quotation/quotation-query.js +97 -0
- package/dist-server/service/quotation/quotation-query.js.map +1 -0
- package/dist-server/service/quotation/quotation-type.js +86 -0
- package/dist-server/service/quotation/quotation-type.js.map +1 -0
- package/dist-server/service/quotation/quotation.js +110 -0
- package/dist-server/service/quotation/quotation.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/quotation/quotation.md +160 -0
- package/package.json +36 -0
- package/server/activities/activity-quotation.ts +112 -0
- package/server/activities/index.ts +17 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +4 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +28 -0
- package/server/service/index.ts +22 -0
- package/server/service/quotation/event-subscriber.ts +17 -0
- package/server/service/quotation/index.ts +9 -0
- package/server/service/quotation/quotation-history.ts +110 -0
- package/server/service/quotation/quotation-mutation.ts +198 -0
- package/server/service/quotation/quotation-query.ts +62 -0
- package/server/service/quotation/quotation-type.ts +61 -0
- package/server/service/quotation/quotation.ts +95 -0
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +11 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Quotation
|
|
2
|
+
|
|
3
|
+
Paragraphs are separated by a blank line.
|
|
4
|
+
|
|
5
|
+
2nd paragraph. _Italic_, **bold**, and `monospace`. Itemized lists
|
|
6
|
+
look like:
|
|
7
|
+
|
|
8
|
+
- this one
|
|
9
|
+
- that one
|
|
10
|
+
- the other one
|
|
11
|
+
|
|
12
|
+
Note that --- not considering the asterisk --- the actual text
|
|
13
|
+
content starts at 4-columns in.
|
|
14
|
+
|
|
15
|
+
> Block quotes are
|
|
16
|
+
> written like so.
|
|
17
|
+
>
|
|
18
|
+
> They can span multiple paragraphs,
|
|
19
|
+
> if you like.
|
|
20
|
+
|
|
21
|
+
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
|
|
22
|
+
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
|
|
23
|
+
Unicode is supported. ☺
|
|
24
|
+
|
|
25
|
+
## An h2 header
|
|
26
|
+
|
|
27
|
+
Here's a numbered list:
|
|
28
|
+
|
|
29
|
+
1. first item
|
|
30
|
+
2. second item
|
|
31
|
+
3. third item
|
|
32
|
+
|
|
33
|
+
Note again how the actual text starts at 4 columns in (4 characters
|
|
34
|
+
from the left side). Here's a code sample:
|
|
35
|
+
|
|
36
|
+
# Let me re-iterate ...
|
|
37
|
+
|
|
38
|
+
for i in 1 .. 10 { do-something(i) }
|
|
39
|
+
|
|
40
|
+
As you probably guessed, indented 4 spaces. By the way, instead of
|
|
41
|
+
indenting the block, you can use delimited blocks, if you like:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
define foobar() {
|
|
45
|
+
print "Welcome to flavor country!";
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
(which makes copying & pasting easier). You can optionally mark the
|
|
50
|
+
delimited block for Pandoc to syntax highlight it:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import time
|
|
54
|
+
# Quick, count to ten!
|
|
55
|
+
for i in range(10):
|
|
56
|
+
# (but not *too* quick)
|
|
57
|
+
time.sleep(0.5)
|
|
58
|
+
print(i)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### An h3 header
|
|
62
|
+
|
|
63
|
+
Now a nested list:
|
|
64
|
+
|
|
65
|
+
1. First, get these ingredients:
|
|
66
|
+
|
|
67
|
+
- carrots
|
|
68
|
+
- celery
|
|
69
|
+
- lentils
|
|
70
|
+
|
|
71
|
+
2. Boil some water.
|
|
72
|
+
|
|
73
|
+
3. Dump everything in the pot and follow
|
|
74
|
+
this algorithm:
|
|
75
|
+
|
|
76
|
+
find wooden spoon
|
|
77
|
+
uncover pot
|
|
78
|
+
stir
|
|
79
|
+
cover pot
|
|
80
|
+
balance wooden spoon precariously on pot handle
|
|
81
|
+
wait 10 minutes
|
|
82
|
+
goto first step (or shut off burner when done)
|
|
83
|
+
|
|
84
|
+
Do not bump wooden spoon or it will fall.
|
|
85
|
+
|
|
86
|
+
Notice again how text always lines up on 4-space indents (including
|
|
87
|
+
that last line which continues item 3 above).
|
|
88
|
+
|
|
89
|
+
Here's a link to [a website](http://foo.bar), to a [local
|
|
90
|
+
doc](local-doc.html), and to a [section heading in the current
|
|
91
|
+
doc](#an-h2-header). Here's a footnote [^1].
|
|
92
|
+
|
|
93
|
+
[^1]: Some footnote text.
|
|
94
|
+
|
|
95
|
+
Tables can look like this:
|
|
96
|
+
|
|
97
|
+
Name Size Material Color
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
All Business 9 leather brown
|
|
102
|
+
Roundabout 10 hemp canvas natural
|
|
103
|
+
Cinderella 11 glass transparent
|
|
104
|
+
|
|
105
|
+
Table: Shoes sizes, materials, and colors.
|
|
106
|
+
|
|
107
|
+
(The above is the caption for the table.) Pandoc also supports
|
|
108
|
+
multi-line tables:
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
Keyword Text
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
red Sunsets, apples, and
|
|
117
|
+
other red or reddish
|
|
118
|
+
things.
|
|
119
|
+
|
|
120
|
+
green Leaves, grass, frogs
|
|
121
|
+
and other things it's
|
|
122
|
+
not easy being.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
A horizontal rule follows.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
Here's a definition list:
|
|
131
|
+
|
|
132
|
+
apples
|
|
133
|
+
: Good for making applesauce.
|
|
134
|
+
|
|
135
|
+
oranges
|
|
136
|
+
: Citrus!
|
|
137
|
+
|
|
138
|
+
tomatoes
|
|
139
|
+
: There's no "e" in tomatoe.
|
|
140
|
+
|
|
141
|
+
Again, text is indented 4 spaces. (Put a blank line between each
|
|
142
|
+
term and its definition to spread things out more.)
|
|
143
|
+
|
|
144
|
+
Here's a "line block" (note how whitespace is honored):
|
|
145
|
+
|
|
146
|
+
| Line one
|
|
147
|
+
| Line too
|
|
148
|
+
| Line tree
|
|
149
|
+
|
|
150
|
+
and images can be specified like so:
|
|
151
|
+
|
|
152
|
+

|
|
153
|
+
|
|
154
|
+
Inline math equation: $\omega = d\phi / dt$. Display
|
|
155
|
+
math should get its own line like so:
|
|
156
|
+
|
|
157
|
+
$$I = \int \rho R^{2} dV$$
|
|
158
|
+
|
|
159
|
+
And note that you can backslash-escape any punctuation characters
|
|
160
|
+
which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@things-factory/quotation",
|
|
3
|
+
"version": "6.0.46",
|
|
4
|
+
"main": "dist-server/index.js",
|
|
5
|
+
"browser": "dist-client/index.js",
|
|
6
|
+
"things-factory": true,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "heartyoh <heartyoh@hatiolab.com>",
|
|
9
|
+
"description": "A module that manages the entire lifecycle from quotation issuance to approval, revision, etc",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"@things-factory:registry": "https://registry.npmjs.org"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/hatiolab/things-factory.git",
|
|
17
|
+
"directory": "packages/quotation"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "npm run build:server && npm run build:client",
|
|
21
|
+
"build:client": "npx tsc --p ./client/tsconfig.json",
|
|
22
|
+
"build:server": "npx tsc --p ./server/tsconfig.json",
|
|
23
|
+
"clean:client": "npx rimraf dist-client",
|
|
24
|
+
"clean:server": "npx rimraf dist-server",
|
|
25
|
+
"clean": "npm run clean:server && npm run clean:client",
|
|
26
|
+
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@operato/graphql": "^1.0.0",
|
|
30
|
+
"@operato/shell": "^1.0.0",
|
|
31
|
+
"@things-factory/auth-base": "^6.0.43",
|
|
32
|
+
"@things-factory/shell": "^6.0.43",
|
|
33
|
+
"@things-factory/worklist": "^6.0.46"
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "0fc79b215a4dabc07d2a73432e09f57252d55d83"
|
|
36
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Activity, ActivityInstance, ActivityInstanceStatus } from '@things-factory/worklist'
|
|
2
|
+
|
|
3
|
+
async function callback(activityInstance: ActivityInstance, context: ResolverContext) {
|
|
4
|
+
const { domain, tx } = context.state
|
|
5
|
+
const { input, output, state } = activityInstance
|
|
6
|
+
|
|
7
|
+
if (state == ActivityInstanceStatus.Ended) {
|
|
8
|
+
const activity = (await tx.getRepository(Activity).findOneBy({
|
|
9
|
+
domain: { id: domain.id },
|
|
10
|
+
name: 'Quotation'
|
|
11
|
+
})) as Activity
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
quotation 액티비티는 한명의 assignee(thread)만 수행하도록 한다. 따라서, output 중에서 샘플 한 개만을 data로 취한다.
|
|
15
|
+
만약, 여러 assignees(threads)가 수행하는 액티비티인 경우에는 output 전체를 data로 처리한다.
|
|
16
|
+
*/
|
|
17
|
+
const assignees = Object.keys(output)
|
|
18
|
+
const data = assignees.length > 0 && output[assignees[0]]
|
|
19
|
+
|
|
20
|
+
if (activity) {
|
|
21
|
+
/*
|
|
22
|
+
custom logic goes here.
|
|
23
|
+
주로,
|
|
24
|
+
*/
|
|
25
|
+
} else {
|
|
26
|
+
console.error('Quotation Activity not installed.')
|
|
27
|
+
}
|
|
28
|
+
} else if (state == ActivityInstanceStatus.Aborted) {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const ActivityQuotation = {
|
|
33
|
+
name: 'Quotation',
|
|
34
|
+
description: 'An activity that issues a quotation',
|
|
35
|
+
release: '1.0.0',
|
|
36
|
+
provider: 'hatiolab.com',
|
|
37
|
+
category: '',
|
|
38
|
+
activityType: 'user',
|
|
39
|
+
priority: 1,
|
|
40
|
+
searchKeys: [
|
|
41
|
+
// sample search keys
|
|
42
|
+
{
|
|
43
|
+
name: 'customer',
|
|
44
|
+
description: 'Customer Code',
|
|
45
|
+
inputKey: 'customer',
|
|
46
|
+
tKey: 'customer'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'product',
|
|
50
|
+
description: 'Product Code',
|
|
51
|
+
inputKey: 'product',
|
|
52
|
+
tKey: 'product'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
/*
|
|
56
|
+
startable 설정된 액티비티는 수동으로 업무를 시작하여, 할당할 수 있음을 의미한다.
|
|
57
|
+
issuer로 정의된 역할을 갖는 사용자가 시작할 수 있으며, issuer가 정의되지 않았다면 모든 사용자가 시작할 수 있다.
|
|
58
|
+
업무를 시작하는 과정에서 assignees와 approval-line은 액티비티의 설정을 디폴트로 하지만 수동으로 조정할 수 있다.
|
|
59
|
+
*/
|
|
60
|
+
startable: true,
|
|
61
|
+
/* (미구현 속성)
|
|
62
|
+
startingType 설정된 액티비티는 'issue' 또는 'post' 이 될 수 있다. 'post' 타입은 혼자서 start, assign, end 까지 한번에 다하는 특성을 갖는다. 이 액티비티를 수행하는 사용자는 draft(초안)과 post(완료)단계만 인식하게 된다.
|
|
63
|
+
이 경우의 모델은 모두 'in' 또는 'inout'의 속성을 갖는 것이 좋다. 'out' 속성의 데이타는 입력될 기회를 갖지 못한다.
|
|
64
|
+
이 경우의 assignees 설정은 의미가 없다.
|
|
65
|
+
이 경우에도 approval-line이 설정되어 있다면, 승인 프로세스에 의해서 처리된다.
|
|
66
|
+
'issue' 타입인 경우에는 모델의 'in' 또는 'inout' 속성을 채워서 assignee에게 할당하는 방식이므로 assignee가 설정되어야 한다.
|
|
67
|
+
*/
|
|
68
|
+
startingType: 'post',
|
|
69
|
+
/* (미구현 속성)
|
|
70
|
+
multiple 속성은 'parallel', 'sequential' 값을 설정할 수 있다. parallel로 설정하면, 다중 인스턴스(여기서는 다중 쓰레드)로 처리하되 병렬처리되며,
|
|
71
|
+
sequential로 설정하면 순차적으로 다중 인스턴스가 수행된다.
|
|
72
|
+
설정하지 않으면, single 인스턴스로 수행된다는 의미이며, 이 경우 assignees가 여럿이 설정되어있어도 1명에게만 할당되게 된다.
|
|
73
|
+
이 경우에는 액티비티 인스턴스의 결과 데이타(output)도 단일 쓰레드의 output이 그대로 적용된다.
|
|
74
|
+
*/
|
|
75
|
+
multiple: null,
|
|
76
|
+
model: [
|
|
77
|
+
{
|
|
78
|
+
name: 'customer',
|
|
79
|
+
description: 'Customer Code',
|
|
80
|
+
tag: 'customer',
|
|
81
|
+
hidden: true,
|
|
82
|
+
mandatory: true,
|
|
83
|
+
inout: 'in',
|
|
84
|
+
type: 'string',
|
|
85
|
+
options: {},
|
|
86
|
+
unit: null,
|
|
87
|
+
quantifier: [1],
|
|
88
|
+
spec: {}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'product',
|
|
92
|
+
description: 'Product Code',
|
|
93
|
+
tag: 'product',
|
|
94
|
+
hidden: true,
|
|
95
|
+
mandatory: true,
|
|
96
|
+
inout: 'in',
|
|
97
|
+
type: 'string',
|
|
98
|
+
options: {},
|
|
99
|
+
unit: null,
|
|
100
|
+
quantifier: [1],
|
|
101
|
+
spec: {}
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
uiType: 'custom-element',
|
|
105
|
+
uiSource: 'activity-quotation-edit',
|
|
106
|
+
viewType: 'custom-element',
|
|
107
|
+
viewSource: 'activity-quotation-view',
|
|
108
|
+
reportType: 'custom-element',
|
|
109
|
+
reportSource: 'activity-quotation-report',
|
|
110
|
+
thumbnail: '/assets/images/quotation-activity.png',
|
|
111
|
+
callback /* Called when there is a change in the lifecycle of a task (activity-instance). */
|
|
112
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActivityInstallations } from '@things-factory/worklist'
|
|
2
|
+
|
|
3
|
+
/* IMPORT ACTIVITY TEMPLATES */
|
|
4
|
+
import { ActivityQuotation } from './activity-quotation'
|
|
5
|
+
|
|
6
|
+
;[
|
|
7
|
+
/* ACTIVITY TEMPLATES */
|
|
8
|
+
ActivityQuotation,
|
|
9
|
+
].forEach(template => {
|
|
10
|
+
ActivityInstallations.installActivityTemplate(template)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
Add the following line to server/index.ts so that activities can be registered when loading a module.
|
|
15
|
+
--
|
|
16
|
+
import './activities'
|
|
17
|
+
*/
|
|
File without changes
|
package/server/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const glob = require('glob')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
export var migrations = []
|
|
5
|
+
|
|
6
|
+
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
|
|
7
|
+
if (file.indexOf('index.js') !== -1) return
|
|
8
|
+
migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
|
|
9
|
+
})
|
package/server/routes.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const debug = require('debug')('things-factory:quotation:routes')
|
|
2
|
+
|
|
3
|
+
process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
|
|
4
|
+
/*
|
|
5
|
+
* can add global public routes to application (auth not required, tenancy not required)
|
|
6
|
+
*
|
|
7
|
+
* ex) routes.get('/path', async(context, next) => {})
|
|
8
|
+
* ex) routes.post('/path', async(context, next) => {})
|
|
9
|
+
*/
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
|
|
13
|
+
/*
|
|
14
|
+
* can add global private routes to application (auth required, tenancy not required)
|
|
15
|
+
*/
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
process.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {
|
|
19
|
+
/*
|
|
20
|
+
* can add domain public routes to application (auth not required, tenancy required)
|
|
21
|
+
*/
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
|
|
25
|
+
/*
|
|
26
|
+
* can add domain private routes to application (auth required, tenancy required)
|
|
27
|
+
*/
|
|
28
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* EXPORT ENTITY TYPES */
|
|
2
|
+
export * from './quotation/quotation'
|
|
3
|
+
|
|
4
|
+
/* IMPORT ENTITIES AND RESOLVERS */
|
|
5
|
+
import { entities as QuotationEntities, resolvers as QuotationResolvers, subscribers as QuotationSubscribers } from './quotation'
|
|
6
|
+
|
|
7
|
+
export const entities = [
|
|
8
|
+
/* ENTITIES */
|
|
9
|
+
...QuotationEntities,
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
export const subscribers = [
|
|
13
|
+
/* SUBSCRIBERS */
|
|
14
|
+
...QuotationSubscribers,
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
export const schema = {
|
|
18
|
+
resolverClasses: [
|
|
19
|
+
/* RESOLVER CLASSES */
|
|
20
|
+
...QuotationResolvers,
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventSubscriber } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
+
|
|
5
|
+
import { Quotation } from './quotation'
|
|
6
|
+
import { QuotationHistory } from './quotation-history'
|
|
7
|
+
|
|
8
|
+
@EventSubscriber()
|
|
9
|
+
export class QuotationHistoryEntitySubscriber extends HistoryEntitySubscriber<Quotation, QuotationHistory> {
|
|
10
|
+
public get entity() {
|
|
11
|
+
return Quotation
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public get historyEntity() {
|
|
15
|
+
return QuotationHistory
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Quotation } from './quotation'
|
|
2
|
+
import { QuotationHistory } from './quotation-history'
|
|
3
|
+
import { QuotationQuery } from './quotation-query'
|
|
4
|
+
import { QuotationMutation } from './quotation-mutation'
|
|
5
|
+
import { QuotationHistoryEntitySubscriber } from './event-subscriber'
|
|
6
|
+
|
|
7
|
+
export const entities = [Quotation, QuotationHistory]
|
|
8
|
+
export const resolvers = [QuotationQuery, QuotationMutation]
|
|
9
|
+
export const subscribers = [QuotationHistoryEntitySubscriber]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
+
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
HistoryActionColumn,
|
|
6
|
+
HistoryActionType,
|
|
7
|
+
HistoryEntityInterface,
|
|
8
|
+
HistoryOriginalIdColumn
|
|
9
|
+
} from '@operato/typeorm-history'
|
|
10
|
+
import { Role, User } from '@things-factory/auth-base'
|
|
11
|
+
import { config } from '@things-factory/env'
|
|
12
|
+
import { Domain } from '@things-factory/shell'
|
|
13
|
+
|
|
14
|
+
import { Quotation, QuotationStatus } from './quotation'
|
|
15
|
+
|
|
16
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
|
17
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
|
18
|
+
|
|
19
|
+
@Entity()
|
|
20
|
+
@Index(
|
|
21
|
+
'ix_quotation_history_0',
|
|
22
|
+
(quotationHistory: QuotationHistory) => [quotationHistory.originalId, quotationHistory.version],
|
|
23
|
+
{ unique: true }
|
|
24
|
+
)
|
|
25
|
+
@Index(
|
|
26
|
+
'ix_quotation_history_1',
|
|
27
|
+
(quotationHistory: QuotationHistory) => [quotationHistory.domain, quotationHistory.originalId, quotationHistory.version],
|
|
28
|
+
{ unique: true }
|
|
29
|
+
)
|
|
30
|
+
@ObjectType({ description: 'History Entity of Quotation' })
|
|
31
|
+
export class QuotationHistory implements HistoryEntityInterface<Quotation> {
|
|
32
|
+
@PrimaryGeneratedColumn('uuid')
|
|
33
|
+
@Field(type => ID)
|
|
34
|
+
readonly id: string
|
|
35
|
+
|
|
36
|
+
@Column({ nullable: true, default: 1 })
|
|
37
|
+
@Field({ nullable: true })
|
|
38
|
+
version?: number = 1
|
|
39
|
+
|
|
40
|
+
@ManyToOne(type => Domain)
|
|
41
|
+
@Field({ nullable: true })
|
|
42
|
+
domain?: Domain
|
|
43
|
+
|
|
44
|
+
@RelationId((quotation: Quotation) => quotation.domain)
|
|
45
|
+
domainId?: string
|
|
46
|
+
|
|
47
|
+
@Column()
|
|
48
|
+
@Field()
|
|
49
|
+
name: string
|
|
50
|
+
|
|
51
|
+
@Column({ nullable: true })
|
|
52
|
+
@Field({ nullable: true })
|
|
53
|
+
description?: string
|
|
54
|
+
|
|
55
|
+
@Column({ nullable: true })
|
|
56
|
+
@Field({ nullable: true })
|
|
57
|
+
active?: boolean
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true })
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
state?: QuotationStatus
|
|
62
|
+
|
|
63
|
+
@Column({ nullable: true })
|
|
64
|
+
@Field({ nullable: true })
|
|
65
|
+
params?: string
|
|
66
|
+
|
|
67
|
+
@Column({ nullable: true })
|
|
68
|
+
@Field({ nullable: true })
|
|
69
|
+
createdAt?: Date
|
|
70
|
+
|
|
71
|
+
@Column({ nullable: true })
|
|
72
|
+
@Field({ nullable: true })
|
|
73
|
+
updatedAt?: Date
|
|
74
|
+
|
|
75
|
+
@Column({ nullable: true })
|
|
76
|
+
@Field({ nullable: true })
|
|
77
|
+
deletedAt?: Date
|
|
78
|
+
|
|
79
|
+
@ManyToOne(type => User, { nullable: true })
|
|
80
|
+
@Field({ nullable: true })
|
|
81
|
+
creator?: User
|
|
82
|
+
|
|
83
|
+
@RelationId((quotation: Quotation) => quotation.creator)
|
|
84
|
+
creatorId?: string
|
|
85
|
+
|
|
86
|
+
@ManyToOne(type => User, { nullable: true })
|
|
87
|
+
@Field({ nullable: true })
|
|
88
|
+
updater?: User
|
|
89
|
+
|
|
90
|
+
@RelationId((quotation: Quotation) => quotation.updater)
|
|
91
|
+
updaterId?: string
|
|
92
|
+
|
|
93
|
+
@Field(type => String, { nullable: true })
|
|
94
|
+
thumbnail?: string
|
|
95
|
+
|
|
96
|
+
@HistoryOriginalIdColumn()
|
|
97
|
+
public originalId!: string
|
|
98
|
+
|
|
99
|
+
@HistoryActionColumn({
|
|
100
|
+
nullable: false,
|
|
101
|
+
type:
|
|
102
|
+
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
103
|
+
? 'enum'
|
|
104
|
+
: DATABASE_TYPE == 'oracle'
|
|
105
|
+
? 'varchar2'
|
|
106
|
+
: 'smallint',
|
|
107
|
+
enum: HistoryActionType
|
|
108
|
+
})
|
|
109
|
+
public action!: HistoryActionType
|
|
110
|
+
}
|