@things-factory/accounting 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.
Files changed (227) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +31 -0
  3. package/assets/images/book-activity.jpg +0 -0
  4. package/assets/images/expense-activity.jpg +0 -0
  5. package/assets/images/hatiolab-logo.png +0 -0
  6. package/client/activities/activity-book-edit.ts +88 -0
  7. package/client/activities/activity-book-view.ts +88 -0
  8. package/client/activities/activity-expense-edit.ts +88 -0
  9. package/client/activities/activity-expense-view.ts +88 -0
  10. package/client/bootstrap.ts +1 -0
  11. package/client/index.ts +0 -0
  12. package/client/pages/account/account-importer.ts +97 -0
  13. package/client/pages/account/account-list-page.ts +348 -0
  14. package/client/pages/accounting-category/accounting-category-importer.ts +97 -0
  15. package/client/pages/accounting-category/accounting-category-list-page.ts +348 -0
  16. package/client/pages/financial-statement/financial-statement-importer.ts +97 -0
  17. package/client/pages/financial-statement/financial-statement-list-page.ts +348 -0
  18. package/client/pages/income-statement/income-statement-importer.ts +97 -0
  19. package/client/pages/income-statement/income-statement-list-page.ts +348 -0
  20. package/client/pages/ledger/ledger-importer.ts +97 -0
  21. package/client/pages/ledger/ledger-list-page.ts +332 -0
  22. package/client/pages/main.ts +24 -0
  23. package/client/pages/transaction/transaction-importer.ts +97 -0
  24. package/client/pages/transaction/transaction-list-page.ts +348 -0
  25. package/client/route.ts +27 -0
  26. package/client/tsconfig.json +11 -0
  27. package/dist-client/activities/activity-book-edit.d.ts +14 -0
  28. package/dist-client/activities/activity-book-edit.js +85 -0
  29. package/dist-client/activities/activity-book-edit.js.map +1 -0
  30. package/dist-client/activities/activity-book-view.d.ts +14 -0
  31. package/dist-client/activities/activity-book-view.js +85 -0
  32. package/dist-client/activities/activity-book-view.js.map +1 -0
  33. package/dist-client/activities/activity-expense-edit.d.ts +14 -0
  34. package/dist-client/activities/activity-expense-edit.js +85 -0
  35. package/dist-client/activities/activity-expense-edit.js.map +1 -0
  36. package/dist-client/activities/activity-expense-view.d.ts +14 -0
  37. package/dist-client/activities/activity-expense-view.js +85 -0
  38. package/dist-client/activities/activity-expense-view.js.map +1 -0
  39. package/dist-client/bootstrap.d.ts +1 -0
  40. package/dist-client/bootstrap.js +2 -0
  41. package/dist-client/bootstrap.js.map +1 -0
  42. package/dist-client/index.d.ts +0 -0
  43. package/dist-client/index.js +2 -0
  44. package/dist-client/index.js.map +1 -0
  45. package/dist-client/pages/account/account-importer.d.ts +22 -0
  46. package/dist-client/pages/account/account-importer.js +100 -0
  47. package/dist-client/pages/account/account-importer.js.map +1 -0
  48. package/dist-client/pages/account/account-list-page.d.ts +62 -0
  49. package/dist-client/pages/account/account-list-page.js +326 -0
  50. package/dist-client/pages/account/account-list-page.js.map +1 -0
  51. package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +22 -0
  52. package/dist-client/pages/accounting-category/accounting-category-importer.js +100 -0
  53. package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -0
  54. package/dist-client/pages/accounting-category/accounting-category-list-page.d.ts +62 -0
  55. package/dist-client/pages/accounting-category/accounting-category-list-page.js +326 -0
  56. package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -0
  57. package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +22 -0
  58. package/dist-client/pages/financial-statement/financial-statement-importer.js +100 -0
  59. package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -0
  60. package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +62 -0
  61. package/dist-client/pages/financial-statement/financial-statement-list-page.js +326 -0
  62. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -0
  63. package/dist-client/pages/income-statement/income-statement-importer.d.ts +22 -0
  64. package/dist-client/pages/income-statement/income-statement-importer.js +100 -0
  65. package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -0
  66. package/dist-client/pages/income-statement/income-statement-list-page.d.ts +62 -0
  67. package/dist-client/pages/income-statement/income-statement-list-page.js +326 -0
  68. package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -0
  69. package/dist-client/pages/ledger/ledger-importer.d.ts +22 -0
  70. package/dist-client/pages/ledger/ledger-importer.js +100 -0
  71. package/dist-client/pages/ledger/ledger-importer.js.map +1 -0
  72. package/dist-client/pages/ledger/ledger-list-page.d.ts +62 -0
  73. package/dist-client/pages/ledger/ledger-list-page.js +317 -0
  74. package/dist-client/pages/ledger/ledger-list-page.js.map +1 -0
  75. package/dist-client/pages/main.d.ts +1 -0
  76. package/dist-client/pages/main.js +27 -0
  77. package/dist-client/pages/main.js.map +1 -0
  78. package/dist-client/pages/transaction/transaction-importer.d.ts +22 -0
  79. package/dist-client/pages/transaction/transaction-importer.js +100 -0
  80. package/dist-client/pages/transaction/transaction-importer.js.map +1 -0
  81. package/dist-client/pages/transaction/transaction-list-page.d.ts +62 -0
  82. package/dist-client/pages/transaction/transaction-list-page.js +326 -0
  83. package/dist-client/pages/transaction/transaction-list-page.js.map +1 -0
  84. package/dist-client/route.d.ts +1 -0
  85. package/dist-client/route.js +23 -0
  86. package/dist-client/route.js.map +1 -0
  87. package/dist-client/tsconfig.tsbuildinfo +1 -0
  88. package/dist-server/activities/activity-book.js +150 -0
  89. package/dist-server/activities/activity-book.js.map +1 -0
  90. package/dist-server/activities/activity-expense.js +150 -0
  91. package/dist-server/activities/activity-expense.js.map +1 -0
  92. package/dist-server/activities/index.js +19 -0
  93. package/dist-server/activities/index.js.map +1 -0
  94. package/dist-server/controllers/index.js +1 -0
  95. package/dist-server/controllers/index.js.map +1 -0
  96. package/dist-server/index.js +7 -0
  97. package/dist-server/index.js.map +1 -0
  98. package/dist-server/middlewares/index.js +8 -0
  99. package/dist-server/middlewares/index.js.map +1 -0
  100. package/dist-server/migrations/index.js +12 -0
  101. package/dist-server/migrations/index.js.map +1 -0
  102. package/dist-server/routes.js +25 -0
  103. package/dist-server/routes.js.map +1 -0
  104. package/dist-server/service/account/account-history.js +113 -0
  105. package/dist-server/service/account/account-history.js.map +1 -0
  106. package/dist-server/service/account/account-mutation.js +130 -0
  107. package/dist-server/service/account/account-mutation.js.map +1 -0
  108. package/dist-server/service/account/account-query.js +79 -0
  109. package/dist-server/service/account/account-query.js.map +1 -0
  110. package/dist-server/service/account/account-type.js +65 -0
  111. package/dist-server/service/account/account-type.js.map +1 -0
  112. package/dist-server/service/account/account.js +102 -0
  113. package/dist-server/service/account/account.js.map +1 -0
  114. package/dist-server/service/account/event-subscriber.js +21 -0
  115. package/dist-server/service/account/event-subscriber.js.map +1 -0
  116. package/dist-server/service/account/index.js +12 -0
  117. package/dist-server/service/account/index.js.map +1 -0
  118. package/dist-server/service/accounting-category/accounting-category-mutation.js +132 -0
  119. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -0
  120. package/dist-server/service/accounting-category/accounting-category-query.js +79 -0
  121. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -0
  122. package/dist-server/service/accounting-category/accounting-category-type.js +65 -0
  123. package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -0
  124. package/dist-server/service/accounting-category/accounting-category.js +89 -0
  125. package/dist-server/service/accounting-category/accounting-category.js.map +1 -0
  126. package/dist-server/service/accounting-category/index.js +10 -0
  127. package/dist-server/service/accounting-category/index.js.map +1 -0
  128. package/dist-server/service/financial-statement/event-subscriber.js +21 -0
  129. package/dist-server/service/financial-statement/event-subscriber.js.map +1 -0
  130. package/dist-server/service/financial-statement/financial-statement-history.js +126 -0
  131. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -0
  132. package/dist-server/service/financial-statement/financial-statement-mutation.js +132 -0
  133. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -0
  134. package/dist-server/service/financial-statement/financial-statement-query.js +79 -0
  135. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -0
  136. package/dist-server/service/financial-statement/financial-statement-type.js +77 -0
  137. package/dist-server/service/financial-statement/financial-statement-type.js.map +1 -0
  138. package/dist-server/service/financial-statement/financial-statement.js +111 -0
  139. package/dist-server/service/financial-statement/financial-statement.js.map +1 -0
  140. package/dist-server/service/financial-statement/index.js +12 -0
  141. package/dist-server/service/financial-statement/index.js.map +1 -0
  142. package/dist-server/service/income-statement/event-subscriber.js +21 -0
  143. package/dist-server/service/income-statement/event-subscriber.js.map +1 -0
  144. package/dist-server/service/income-statement/income-statement-history.js +126 -0
  145. package/dist-server/service/income-statement/income-statement-history.js.map +1 -0
  146. package/dist-server/service/income-statement/income-statement-mutation.js +132 -0
  147. package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -0
  148. package/dist-server/service/income-statement/income-statement-query.js +79 -0
  149. package/dist-server/service/income-statement/income-statement-query.js.map +1 -0
  150. package/dist-server/service/income-statement/income-statement-type.js +77 -0
  151. package/dist-server/service/income-statement/income-statement-type.js.map +1 -0
  152. package/dist-server/service/income-statement/income-statement.js +117 -0
  153. package/dist-server/service/income-statement/income-statement.js.map +1 -0
  154. package/dist-server/service/income-statement/index.js +12 -0
  155. package/dist-server/service/income-statement/index.js.map +1 -0
  156. package/dist-server/service/index.js +43 -0
  157. package/dist-server/service/index.js.map +1 -0
  158. package/dist-server/service/transaction/event-subscriber.js +21 -0
  159. package/dist-server/service/transaction/event-subscriber.js.map +1 -0
  160. package/dist-server/service/transaction/index.js +12 -0
  161. package/dist-server/service/transaction/index.js.map +1 -0
  162. package/dist-server/service/transaction/transaction-history.js +123 -0
  163. package/dist-server/service/transaction/transaction-history.js.map +1 -0
  164. package/dist-server/service/transaction/transaction-mutation.js +130 -0
  165. package/dist-server/service/transaction/transaction-mutation.js.map +1 -0
  166. package/dist-server/service/transaction/transaction-query.js +79 -0
  167. package/dist-server/service/transaction/transaction-query.js.map +1 -0
  168. package/dist-server/service/transaction/transaction-type.js +73 -0
  169. package/dist-server/service/transaction/transaction-type.js.map +1 -0
  170. package/dist-server/service/transaction/transaction.js +130 -0
  171. package/dist-server/service/transaction/transaction.js.map +1 -0
  172. package/dist-server/tsconfig.tsbuildinfo +1 -0
  173. package/helps/accounting/account.md +160 -0
  174. package/helps/accounting/accounting-category.md +160 -0
  175. package/helps/accounting/financial-accounting.md +53 -0
  176. package/helps/accounting/financial-statement.md +160 -0
  177. package/helps/accounting/income-statement.md +160 -0
  178. package/helps/accounting/transaction.md +160 -0
  179. package/package.json +36 -0
  180. package/server/activities/activity-book.ts +149 -0
  181. package/server/activities/activity-expense.ts +149 -0
  182. package/server/activities/index.ts +19 -0
  183. package/server/controllers/index.ts +0 -0
  184. package/server/index.ts +4 -0
  185. package/server/middlewares/index.ts +3 -0
  186. package/server/migrations/index.ts +9 -0
  187. package/server/routes.ts +28 -0
  188. package/server/service/account/account-history.ts +103 -0
  189. package/server/service/account/account-mutation.ts +137 -0
  190. package/server/service/account/account-query.ts +49 -0
  191. package/server/service/account/account-type.ts +44 -0
  192. package/server/service/account/account.ts +86 -0
  193. package/server/service/account/event-subscriber.ts +17 -0
  194. package/server/service/account/index.ts +9 -0
  195. package/server/service/accounting-category/accounting-category-mutation.ts +145 -0
  196. package/server/service/accounting-category/accounting-category-query.ts +51 -0
  197. package/server/service/accounting-category/accounting-category-type.ts +42 -0
  198. package/server/service/accounting-category/accounting-category.ts +80 -0
  199. package/server/service/accounting-category/index.ts +7 -0
  200. package/server/service/financial-statement/event-subscriber.ts +17 -0
  201. package/server/service/financial-statement/financial-statement-history.ts +114 -0
  202. package/server/service/financial-statement/financial-statement-mutation.ts +145 -0
  203. package/server/service/financial-statement/financial-statement-query.ts +51 -0
  204. package/server/service/financial-statement/financial-statement-type.ts +51 -0
  205. package/server/service/financial-statement/financial-statement.ts +100 -0
  206. package/server/service/financial-statement/index.ts +9 -0
  207. package/server/service/income-statement/event-subscriber.ts +17 -0
  208. package/server/service/income-statement/income-statement-history.ts +114 -0
  209. package/server/service/income-statement/income-statement-mutation.ts +145 -0
  210. package/server/service/income-statement/income-statement-query.ts +48 -0
  211. package/server/service/income-statement/income-statement-type.ts +51 -0
  212. package/server/service/income-statement/income-statement.ts +105 -0
  213. package/server/service/income-statement/index.ts +9 -0
  214. package/server/service/index.ts +62 -0
  215. package/server/service/transaction/event-subscriber.ts +17 -0
  216. package/server/service/transaction/index.ts +9 -0
  217. package/server/service/transaction/transaction-history.ts +111 -0
  218. package/server/service/transaction/transaction-mutation.ts +143 -0
  219. package/server/service/transaction/transaction-query.ts +48 -0
  220. package/server/service/transaction/transaction-type.ts +48 -0
  221. package/server/service/transaction/transaction.ts +115 -0
  222. package/server/tsconfig.json +10 -0
  223. package/things-factory.config.js +16 -0
  224. package/translations/en.json +1 -0
  225. package/translations/ko.json +1 -0
  226. package/translations/ms.json +1 -0
  227. package/translations/zh.json +1 -0
@@ -0,0 +1,160 @@
1
+ # Transaction
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
+ ![example image](example-image.jpg 'An exemplary image')
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/accounting",
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 a company's cash flow balance, including income, expenses, and backlog",
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/accounting"
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,149 @@
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: 'Book'
11
+ })) as Activity
12
+
13
+ /*
14
+ book 액티비티는 한명의 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('Book Activity not installed.')
27
+ }
28
+ } else if (state == ActivityInstanceStatus.Aborted) {
29
+ }
30
+ }
31
+
32
+ export const ActivityBook = {
33
+ name: 'Book',
34
+ description: 'An activity thate enter a incoming or expense in the ledger',
35
+ release: '1.0.0',
36
+ provider: 'hatiolab.com',
37
+ category: 'accounting',
38
+ activityType: 'user',
39
+ priority: 1,
40
+ searchKeys: [
41
+ // sample search keys
42
+ {
43
+ name: 'category',
44
+ description: 'expense category',
45
+ inputKey: 'category',
46
+ tKey: 'category'
47
+ }
48
+ ],
49
+ /*
50
+ startable 설정된 액티비티는 수동으로 업무를 시작하여, 할당할 수 있음을 의미한다.
51
+ issuer로 정의된 역할을 갖는 사용자가 시작할 수 있으며, issuer가 정의되지 않았다면 모든 사용자가 시작할 수 있다.
52
+ 업무를 시작하는 과정에서 assignees와 approval-line은 액티비티의 설정을 디폴트로 하지만 수동으로 조정할 수 있다.
53
+ */
54
+ startable: true,
55
+ /* (미구현 속성)
56
+ startingType 설정된 액티비티는 'issue' 또는 'post' 이 될 수 있다. 'post' 타입은 혼자서 start, assign, end 까지 한번에 다하는 특성을 갖는다. 이 액티비티를 수행하는 사용자는 draft(초안)과 post(완료)단계만 인식하게 된다.
57
+ 이 경우의 모델은 모두 'in' 또는 'inout'의 속성을 갖는 것이 좋다. 'out' 속성의 데이타는 입력될 기회를 갖지 못한다.
58
+ 이 경우의 assignees 설정은 의미가 없다.
59
+ 이 경우에도 approval-line이 설정되어 있다면, 승인 프로세스에 의해서 처리된다.
60
+ 'issue' 타입인 경우에는 모델의 'in' 또는 'inout' 속성을 채워서 assignee에게 할당하는 방식이므로 assignee가 설정되어야 한다.
61
+ */
62
+ startingType: 'post',
63
+ /* (미구현 속성)
64
+ multiple 속성은 'parallel', 'sequential' 값을 설정할 수 있다. parallel로 설정하면, 다중 인스턴스(여기서는 다중 쓰레드)로 처리하되 병렬처리되며,
65
+ sequential로 설정하면 순차적으로 다중 인스턴스가 수행된다.
66
+ 설정하지 않으면, single 인스턴스로 수행된다는 의미이며, 이 경우 assignees가 여럿이 설정되어있어도 1명에게만 할당되게 된다.
67
+ 이 경우에는 액티비티 인스턴스의 결과 데이타(output)도 단일 쓰레드의 output이 그대로 적용된다.
68
+ */
69
+ multiple: null,
70
+ model: [
71
+ {
72
+ name: 'name',
73
+ description: 'name',
74
+ tag: 'name',
75
+ hidden: false,
76
+ mandatory: true,
77
+ inout: 'in',
78
+ type: 'select',
79
+ options: {
80
+ options: ['KRW', 'USD', 'CNY']
81
+ },
82
+ unit: null,
83
+ quantifier: [1],
84
+ spec: {}
85
+ },
86
+ {
87
+ name: 'currency',
88
+ description: 'currency',
89
+ tag: 'currency',
90
+ hidden: false,
91
+ mandatory: true,
92
+ inout: 'in',
93
+ type: 'select',
94
+ options: {
95
+ options: ['KRW', 'USD', 'CNY']
96
+ },
97
+ unit: null,
98
+ quantifier: [1],
99
+ spec: {}
100
+ },
101
+ {
102
+ name: 'amount',
103
+ description: 'amount',
104
+ tag: 'amount',
105
+ hidden: false,
106
+ mandatory: true,
107
+ inout: 'in',
108
+ type: 'number',
109
+ options: {},
110
+ unit: null,
111
+ quantifier: [1],
112
+ spec: {}
113
+ },
114
+ {
115
+ name: 'category',
116
+ description: 'accounting category',
117
+ tag: 'category',
118
+ hidden: true,
119
+ mandatory: true,
120
+ inout: 'in',
121
+ type: 'string',
122
+ options: {},
123
+ unit: null,
124
+ quantifier: [1],
125
+ spec: {}
126
+ },
127
+ {
128
+ name: 'date',
129
+ description: 'issuance date',
130
+ tag: 'date',
131
+ hidden: true,
132
+ mandatory: true,
133
+ inout: 'in',
134
+ type: 'string',
135
+ options: {},
136
+ unit: null,
137
+ quantifier: [1],
138
+ spec: {}
139
+ }
140
+ ],
141
+ uiType: 'generated',
142
+ uiSource: '',
143
+ viewType: 'generated',
144
+ viewSource: '',
145
+ reportType: 'custom-element',
146
+ reportSource: 'activity-book-report',
147
+ thumbnail: '/assets/images/book-activity.jpg',
148
+ callback /* Called when there is a change in the lifecycle of a task (activity-instance). */
149
+ }
@@ -0,0 +1,149 @@
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: 'Expense'
11
+ })) as Activity
12
+
13
+ /*
14
+ expense 액티비티는 한명의 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('Expense Activity not installed.')
27
+ }
28
+ } else if (state == ActivityInstanceStatus.Aborted) {
29
+ }
30
+ }
31
+
32
+ export const ActivityExpense = {
33
+ name: 'Expense',
34
+ description: 'An activity for reporting and approving expense spending',
35
+ release: '1.0.0',
36
+ provider: 'hatiolab.com',
37
+ category: 'accounting',
38
+ activityType: 'user',
39
+ priority: 1,
40
+ searchKeys: [
41
+ // sample search keys
42
+ {
43
+ name: 'category',
44
+ description: 'expense category',
45
+ inputKey: 'category',
46
+ tKey: 'category'
47
+ }
48
+ ],
49
+ /*
50
+ startable 설정된 액티비티는 수동으로 업무를 시작하여, 할당할 수 있음을 의미한다.
51
+ issuer로 정의된 역할을 갖는 사용자가 시작할 수 있으며, issuer가 정의되지 않았다면 모든 사용자가 시작할 수 있다.
52
+ 업무를 시작하는 과정에서 assignees와 approval-line은 액티비티의 설정을 디폴트로 하지만 수동으로 조정할 수 있다.
53
+ */
54
+ startable: true,
55
+ /* (미구현 속성)
56
+ startingType 설정된 액티비티는 'issue' 또는 'post' 이 될 수 있다. 'post' 타입은 혼자서 start, assign, end 까지 한번에 다하는 특성을 갖는다. 이 액티비티를 수행하는 사용자는 draft(초안)과 post(완료)단계만 인식하게 된다.
57
+ 이 경우의 모델은 모두 'in' 또는 'inout'의 속성을 갖는 것이 좋다. 'out' 속성의 데이타는 입력될 기회를 갖지 못한다.
58
+ 이 경우의 assignees 설정은 의미가 없다.
59
+ 이 경우에도 approval-line이 설정되어 있다면, 승인 프로세스에 의해서 처리된다.
60
+ 'issue' 타입인 경우에는 모델의 'in' 또는 'inout' 속성을 채워서 assignee에게 할당하는 방식이므로 assignee가 설정되어야 한다.
61
+ */
62
+ startingType: 'post',
63
+ /* (미구현 속성)
64
+ multiple 속성은 'parallel', 'sequential' 값을 설정할 수 있다. parallel로 설정하면, 다중 인스턴스(여기서는 다중 쓰레드)로 처리하되 병렬처리되며,
65
+ sequential로 설정하면 순차적으로 다중 인스턴스가 수행된다.
66
+ 설정하지 않으면, single 인스턴스로 수행된다는 의미이며, 이 경우 assignees가 여럿이 설정되어있어도 1명에게만 할당되게 된다.
67
+ 이 경우에는 액티비티 인스턴스의 결과 데이타(output)도 단일 쓰레드의 output이 그대로 적용된다.
68
+ */
69
+ multiple: null,
70
+ model: [
71
+ {
72
+ name: 'name',
73
+ description: 'name',
74
+ tag: 'name',
75
+ hidden: false,
76
+ mandatory: true,
77
+ inout: 'in',
78
+ type: 'select',
79
+ options: {
80
+ options: ['KRW', 'USD', 'CNY']
81
+ },
82
+ unit: null,
83
+ quantifier: [1],
84
+ spec: {}
85
+ },
86
+ {
87
+ name: 'currency',
88
+ description: 'currency',
89
+ tag: 'currency',
90
+ hidden: false,
91
+ mandatory: true,
92
+ inout: 'in',
93
+ type: 'select',
94
+ options: {
95
+ options: ['KRW', 'USD', 'CNY']
96
+ },
97
+ unit: null,
98
+ quantifier: [1],
99
+ spec: {}
100
+ },
101
+ {
102
+ name: 'amount',
103
+ description: 'amount',
104
+ tag: 'amount',
105
+ hidden: false,
106
+ mandatory: true,
107
+ inout: 'in',
108
+ type: 'number',
109
+ options: {},
110
+ unit: null,
111
+ quantifier: [1],
112
+ spec: {}
113
+ },
114
+ {
115
+ name: 'category',
116
+ description: 'expense category',
117
+ tag: 'category',
118
+ hidden: true,
119
+ mandatory: true,
120
+ inout: 'in',
121
+ type: 'string',
122
+ options: {},
123
+ unit: null,
124
+ quantifier: [1],
125
+ spec: {}
126
+ },
127
+ {
128
+ name: 'date',
129
+ description: 'expense spent date',
130
+ tag: 'date',
131
+ hidden: true,
132
+ mandatory: true,
133
+ inout: 'in',
134
+ type: 'string',
135
+ options: {},
136
+ unit: null,
137
+ quantifier: [1],
138
+ spec: {}
139
+ }
140
+ ],
141
+ uiType: 'generated',
142
+ uiSource: '',
143
+ viewType: 'generated',
144
+ viewSource: '',
145
+ reportType: 'custom-element',
146
+ reportSource: 'activity-expense-report',
147
+ thumbnail: '/assets/images/expense-activity.jpg',
148
+ callback /* Called when there is a change in the lifecycle of a task (activity-instance). */
149
+ }
@@ -0,0 +1,19 @@
1
+ import { ActivityInstallations } from '@things-factory/worklist'
2
+
3
+ /* IMPORT ACTIVITY TEMPLATES */
4
+ import { ActivityExpense } from './activity-expense'
5
+ import { ActivityBook } from './activity-book'
6
+
7
+ ;[
8
+ /* ACTIVITY TEMPLATES */
9
+ ActivityExpense,
10
+ ActivityBook,
11
+ ].forEach(template => {
12
+ ActivityInstallations.installActivityTemplate(template)
13
+ })
14
+
15
+ /*
16
+ Add the following line to server/index.ts so that activities can be registered when loading a module.
17
+ --
18
+ import './activities'
19
+ */
File without changes
@@ -0,0 +1,4 @@
1
+ export * from './migrations'
2
+ export * from './middlewares'
3
+
4
+ import './routes'
@@ -0,0 +1,3 @@
1
+ export function initMiddlewares(app) {
2
+ /* can add middlewares into app */
3
+ }
@@ -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
+ })
@@ -0,0 +1,28 @@
1
+ const debug = require('debug')('things-factory:accounting: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,103 @@
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 { Account } from './account'
15
+
16
+ const ORMCONFIG = config.get('ormconfig', {})
17
+ const DATABASE_TYPE = ORMCONFIG.type
18
+
19
+ @Entity()
20
+ @Index(
21
+ 'ix_account_history_0',
22
+ (accountHistory: AccountHistory) => [accountHistory.originalId, accountHistory.version],
23
+ { unique: true }
24
+ )
25
+ @Index(
26
+ 'ix_account_history_1',
27
+ (accountHistory: AccountHistory) => [accountHistory.domain, accountHistory.originalId, accountHistory.version],
28
+ { unique: true }
29
+ )
30
+ @ObjectType({ description: 'History Entity of Account' })
31
+ export class AccountHistory implements HistoryEntityInterface<Account> {
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((account: Account) => account.domain)
45
+ domainId?: string
46
+
47
+ @Column({ nullable: true })
48
+ @Field({ nullable: true })
49
+ controlNumber?: string
50
+
51
+ @Column({ nullable: true })
52
+ @Field({ nullable: true })
53
+ name?: string
54
+
55
+ @Column({ nullable: true })
56
+ @Field({ nullable: true })
57
+ description?: string
58
+
59
+ @Column({ nullable: true })
60
+ @Field({ nullable: true })
61
+ active?: boolean
62
+
63
+ @Column({ nullable: true })
64
+ @Field({ nullable: true })
65
+ createdAt?: Date
66
+
67
+ @Column({ nullable: true })
68
+ @Field({ nullable: true })
69
+ updatedAt?: Date
70
+
71
+ @Column({ nullable: true })
72
+ @Field({ nullable: true })
73
+ deletedAt?: Date
74
+
75
+ @ManyToOne(type => User, { nullable: true })
76
+ @Field({ nullable: true })
77
+ creator?: User
78
+
79
+ @RelationId((account: Account) => account.creator)
80
+ creatorId?: string
81
+
82
+ @ManyToOne(type => User, { nullable: true })
83
+ @Field({ nullable: true })
84
+ updater?: User
85
+
86
+ @RelationId((account: Account) => account.updater)
87
+ updaterId?: string
88
+
89
+ @HistoryOriginalIdColumn()
90
+ public originalId!: string
91
+
92
+ @HistoryActionColumn({
93
+ nullable: false,
94
+ type:
95
+ DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
96
+ ? 'enum'
97
+ : DATABASE_TYPE == 'oracle'
98
+ ? 'varchar2'
99
+ : 'smallint',
100
+ enum: HistoryActionType
101
+ })
102
+ public action!: HistoryActionType
103
+ }