@things-factory/accounting 8.0.0-alpha.1 → 8.0.0-alpha.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (362) hide show
  1. package/client/bootstrap.ts +10 -1
  2. package/client/components/accounting-category-selector.ts +136 -0
  3. package/client/components/accounting-category-view.ts +75 -0
  4. package/client/grist-editors/grist-editor-accounting-category-object.ts +83 -0
  5. package/client/grist-editors/grist-renderer-accounting-category-object.ts +13 -0
  6. package/client/pages/account/account-list-page.ts +33 -2
  7. package/client/pages/accounting-category/accounting-category-list-page.ts +31 -1
  8. package/client/pages/accounting-category/accounting-category-tree-page.ts +338 -0
  9. package/client/pages/accounting-document/accounting-document-importer.ts +90 -0
  10. package/client/pages/accounting-document/accounting-document-list-page.ts +398 -0
  11. package/client/pages/bank/bank-importer.ts +90 -0
  12. package/client/pages/{ledger/ledger-list-page.ts → bank/bank-list-page.ts} +118 -57
  13. package/client/pages/{ledger/ledger-importer.ts → bank-account/bank-account-importer.ts} +10 -17
  14. package/client/pages/bank-account/bank-account-list-page.ts +398 -0
  15. package/client/pages/financial-institution/financial-institution-importer.ts +90 -0
  16. package/client/pages/financial-institution/financial-institution-list-page.ts +398 -0
  17. package/client/pages/payment/payment-importer.ts +90 -0
  18. package/client/pages/payment/payment-list-page.ts +398 -0
  19. package/client/route.ts +0 -4
  20. package/client/types/accounting-category.ts +23 -0
  21. package/client/types/index.ts +1 -0
  22. package/dist-client/bootstrap.js +7 -1
  23. package/dist-client/bootstrap.js.map +1 -1
  24. package/dist-client/components/accounting-category-selector.d.ts +16 -0
  25. package/dist-client/components/accounting-category-selector.js +134 -0
  26. package/dist-client/components/accounting-category-selector.js.map +1 -0
  27. package/dist-client/components/accounting-category-view.d.ts +14 -0
  28. package/dist-client/components/accounting-category-view.js +81 -0
  29. package/dist-client/components/accounting-category-view.js.map +1 -0
  30. package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
  31. package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
  32. package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
  33. package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
  34. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
  35. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
  36. package/dist-client/pages/account/account-list-page.js +33 -2
  37. package/dist-client/pages/account/account-list-page.js.map +1 -1
  38. package/dist-client/pages/accounting-category/accounting-category-list-page.js +31 -1
  39. package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
  40. package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
  41. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
  42. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
  43. package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
  44. package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
  45. package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
  46. package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
  47. package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
  48. package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
  49. package/dist-client/pages/{ledger/ledger-importer.d.ts → bank/bank-importer.d.ts} +3 -2
  50. package/dist-client/pages/{ledger/ledger-importer.js → bank/bank-importer.js} +14 -21
  51. package/dist-client/pages/bank/bank-importer.js.map +1 -0
  52. package/dist-client/pages/{ledger/ledger-list-page.d.ts → bank/bank-list-page.d.ts} +12 -8
  53. package/dist-client/pages/{ledger/ledger-list-page.js → bank/bank-list-page.js} +114 -67
  54. package/dist-client/pages/bank/bank-list-page.js.map +1 -0
  55. package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
  56. package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
  57. package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
  58. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
  59. package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
  60. package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
  61. package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
  62. package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
  63. package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
  64. package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
  65. package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
  66. package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
  67. package/dist-client/pages/payment/payment-importer.d.ts +23 -0
  68. package/dist-client/pages/payment/payment-importer.js +93 -0
  69. package/dist-client/pages/payment/payment-importer.js.map +1 -0
  70. package/dist-client/pages/payment/payment-list-page.d.ts +66 -0
  71. package/dist-client/pages/payment/payment-list-page.js +370 -0
  72. package/dist-client/pages/payment/payment-list-page.js.map +1 -0
  73. package/dist-client/route.d.ts +1 -1
  74. package/dist-client/route.js +0 -3
  75. package/dist-client/route.js.map +1 -1
  76. package/dist-client/tsconfig.tsbuildinfo +1 -1
  77. package/dist-client/types/accounting-category.d.ts +16 -0
  78. package/dist-client/types/accounting-category.js +3 -0
  79. package/dist-client/types/accounting-category.js.map +1 -0
  80. package/dist-client/types/index.d.ts +1 -0
  81. package/dist-client/types/index.js +2 -0
  82. package/dist-client/types/index.js.map +1 -0
  83. package/dist-server/activities/activity-book.js +31 -19
  84. package/dist-server/activities/activity-book.js.map +1 -1
  85. package/dist-server/controllers/summary-statements.js +13 -7
  86. package/dist-server/controllers/summary-statements.js.map +1 -1
  87. package/dist-server/index.d.ts +1 -0
  88. package/dist-server/index.js +1 -0
  89. package/dist-server/index.js.map +1 -1
  90. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +3 -3
  91. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -1
  92. package/dist-server/migrations/1725201467183-seed-accounts.js +31 -31
  93. package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -1
  94. package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
  95. package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
  96. package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
  97. package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
  98. package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
  99. package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
  100. package/dist-server/routes.d.ts +0 -1
  101. package/dist-server/routes.js +0 -1
  102. package/dist-server/routes.js.map +1 -1
  103. package/dist-server/service/account/account-history.d.ts +4 -1
  104. package/dist-server/service/account/account-history.js +14 -4
  105. package/dist-server/service/account/account-history.js.map +1 -1
  106. package/dist-server/service/account/account-mutation.js +13 -9
  107. package/dist-server/service/account/account-mutation.js.map +1 -1
  108. package/dist-server/service/account/account-query.js +2 -0
  109. package/dist-server/service/account/account-query.js.map +1 -1
  110. package/dist-server/service/account/account.d.ts +1 -1
  111. package/dist-server/service/account/account.js +15 -4
  112. package/dist-server/service/account/account.js.map +1 -1
  113. package/dist-server/service/account/index.d.ts +1 -2
  114. package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
  115. package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
  116. package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
  117. package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
  118. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  119. package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
  120. package/dist-server/service/accounting-category/accounting-category-query.js +23 -0
  121. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
  122. package/dist-server/service/accounting-category/accounting-category.d.ts +1 -0
  123. package/dist-server/service/accounting-category/accounting-category.js +14 -3
  124. package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
  125. package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
  126. package/dist-server/service/accounting-category/event-subscriber.js +21 -0
  127. package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
  128. package/dist-server/service/accounting-category/index.d.ts +2 -1
  129. package/dist-server/service/accounting-category/index.js +4 -2
  130. package/dist-server/service/accounting-category/index.js.map +1 -1
  131. package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
  132. package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
  133. package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
  134. package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
  135. package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
  136. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
  137. package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
  138. package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
  139. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
  140. package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
  141. package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
  142. package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
  143. package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
  144. package/dist-server/service/accounting-document/accounting-document.js +104 -0
  145. package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
  146. package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
  147. package/dist-server/service/accounting-document/event-subscriber.js +21 -0
  148. package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
  149. package/dist-server/service/accounting-document/index.d.ts +7 -0
  150. package/dist-server/service/accounting-document/index.js +12 -0
  151. package/dist-server/service/accounting-document/index.js.map +1 -0
  152. package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
  153. package/dist-server/service/bank-account/bank-account-history.js +172 -0
  154. package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
  155. package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
  156. package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
  157. package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
  158. package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
  159. package/dist-server/service/bank-account/bank-account-query.js +79 -0
  160. package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
  161. package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
  162. package/dist-server/service/bank-account/bank-account-type.js +153 -0
  163. package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
  164. package/dist-server/service/bank-account/bank-account.d.ts +38 -0
  165. package/dist-server/service/bank-account/bank-account.js +164 -0
  166. package/dist-server/service/bank-account/bank-account.js.map +1 -0
  167. package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
  168. package/dist-server/service/bank-account/event-subscriber.js +21 -0
  169. package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
  170. package/dist-server/service/bank-account/index.d.ts +7 -0
  171. package/dist-server/service/bank-account/index.js +12 -0
  172. package/dist-server/service/bank-account/index.js.map +1 -0
  173. package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
  174. package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
  175. package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
  176. package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
  177. package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
  178. package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
  179. package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
  180. package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
  181. package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
  182. package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
  183. package/dist-server/service/financial-institution/financial-institution.js +137 -0
  184. package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
  185. package/dist-server/service/financial-institution/index.d.ts +6 -0
  186. package/dist-server/service/financial-institution/index.js +10 -0
  187. package/dist-server/service/financial-institution/index.js.map +1 -0
  188. package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
  189. package/dist-server/service/financial-statement/financial-statement-history.js +30 -20
  190. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  191. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
  192. package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
  193. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
  194. package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
  195. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  196. package/dist-server/service/financial-statement/financial-statement-query.js +2 -0
  197. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  198. package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
  199. package/dist-server/service/financial-statement/financial-statement.js +45 -24
  200. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  201. package/dist-server/service/financial-statement/index.d.ts +2 -2
  202. package/dist-server/service/financial-statement/index.js +2 -1
  203. package/dist-server/service/financial-statement/index.js.map +1 -1
  204. package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -0
  205. package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
  206. package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -0
  207. package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
  208. package/dist-server/service/fiscal-month/fiscal-month.js +1 -1
  209. package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -1
  210. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -0
  211. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
  212. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -0
  213. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
  214. package/dist-server/service/fiscal-quarter/fiscal-quarter.js +1 -1
  215. package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -1
  216. package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -0
  217. package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
  218. package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -0
  219. package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
  220. package/dist-server/service/fiscal-year/fiscal-year.js +1 -1
  221. package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -1
  222. package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
  223. package/dist-server/service/income-statement/income-statement-history.js +35 -20
  224. package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
  225. package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
  226. package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
  227. package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
  228. package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
  229. package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
  230. package/dist-server/service/income-statement/income-statement-query.js +2 -0
  231. package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
  232. package/dist-server/service/income-statement/income-statement.d.ts +2 -0
  233. package/dist-server/service/income-statement/income-statement.js +46 -26
  234. package/dist-server/service/income-statement/income-statement.js.map +1 -1
  235. package/dist-server/service/income-statement/index.d.ts +2 -2
  236. package/dist-server/service/income-statement/index.js +2 -1
  237. package/dist-server/service/income-statement/index.js.map +1 -1
  238. package/dist-server/service/index.d.ts +4 -2
  239. package/dist-server/service/index.js +10 -0
  240. package/dist-server/service/index.js.map +1 -1
  241. package/dist-server/service/payment/event-subscriber.d.ts +7 -0
  242. package/dist-server/service/payment/event-subscriber.js +21 -0
  243. package/dist-server/service/payment/event-subscriber.js.map +1 -0
  244. package/dist-server/service/payment/index.d.ts +7 -0
  245. package/dist-server/service/payment/index.js +12 -0
  246. package/dist-server/service/payment/index.js.map +1 -0
  247. package/dist-server/service/payment/payment-history.d.ts +37 -0
  248. package/dist-server/service/payment/payment-history.js +174 -0
  249. package/dist-server/service/payment/payment-history.js.map +1 -0
  250. package/dist-server/service/payment/payment-mutation.d.ts +10 -0
  251. package/dist-server/service/payment/payment-mutation.js +134 -0
  252. package/dist-server/service/payment/payment-mutation.js.map +1 -0
  253. package/dist-server/service/payment/payment-query.d.ts +11 -0
  254. package/dist-server/service/payment/payment-query.js +81 -0
  255. package/dist-server/service/payment/payment-query.js.map +1 -0
  256. package/dist-server/service/payment/payment-type.d.ts +30 -0
  257. package/dist-server/service/payment/payment-type.js +114 -0
  258. package/dist-server/service/payment/payment-type.js.map +1 -0
  259. package/dist-server/service/payment/payment.d.ts +42 -0
  260. package/dist-server/service/payment/payment.js +181 -0
  261. package/dist-server/service/payment/payment.js.map +1 -0
  262. package/dist-server/service/transaction/index.d.ts +2 -1
  263. package/dist-server/service/transaction/transaction-history.d.ts +6 -2
  264. package/dist-server/service/transaction/transaction-history.js +28 -9
  265. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  266. package/dist-server/service/transaction/transaction-mutation.js +13 -9
  267. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  268. package/dist-server/service/transaction/transaction-query.js +2 -0
  269. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  270. package/dist-server/service/transaction/transaction.d.ts +28 -6
  271. package/dist-server/service/transaction/transaction.js +119 -31
  272. package/dist-server/service/transaction/transaction.js.map +1 -1
  273. package/dist-server/tsconfig.tsbuildinfo +1 -1
  274. package/helps/accounting/accounting-document.md +160 -0
  275. package/helps/accounting/bank-account.md +160 -0
  276. package/helps/accounting/bank.md +160 -0
  277. package/helps/accounting/contract.md +160 -0
  278. package/helps/accounting/financial-institution.md +160 -0
  279. package/helps/accounting/payment.md +160 -0
  280. package/package.json +5 -5
  281. package/server/activities/activity-book.ts +31 -19
  282. package/server/controllers/summary-statements.ts +13 -7
  283. package/server/index.ts +1 -0
  284. package/server/migrations/1725200507196-seed-fiscal-entities.ts +3 -3
  285. package/server/migrations/1725201467183-seed-accounts.ts +31 -31
  286. package/server/migrations/1725201567284-seed-country-codes.ts +261 -0
  287. package/server/migrations/1725201667385-seed-financial-institutions.ts +348 -0
  288. package/server/routes.ts +0 -2
  289. package/server/service/account/account-history.ts +14 -6
  290. package/server/service/account/account-mutation.ts +13 -10
  291. package/server/service/account/account-query.ts +2 -0
  292. package/server/service/account/account.ts +15 -4
  293. package/server/service/accounting-category/accounting-category-history.ts +123 -0
  294. package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
  295. package/server/service/accounting-category/accounting-category-query.ts +23 -0
  296. package/server/service/accounting-category/accounting-category.ts +14 -3
  297. package/server/service/accounting-category/event-subscriber.ts +20 -0
  298. package/server/service/accounting-category/index.ts +4 -2
  299. package/server/service/accounting-document/accounting-document-history.ts +117 -0
  300. package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
  301. package/server/service/accounting-document/accounting-document-query.ts +48 -0
  302. package/server/service/accounting-document/accounting-document-type.ts +52 -0
  303. package/server/service/accounting-document/accounting-document.ts +93 -0
  304. package/server/service/accounting-document/event-subscriber.ts +17 -0
  305. package/server/service/accounting-document/index.ts +9 -0
  306. package/server/service/bank-account/bank-account-history.ts +149 -0
  307. package/server/service/bank-account/bank-account-mutation.ts +137 -0
  308. package/server/service/bank-account/bank-account-query.ts +48 -0
  309. package/server/service/bank-account/bank-account-type.ts +112 -0
  310. package/server/service/bank-account/bank-account.ts +142 -0
  311. package/server/service/bank-account/event-subscriber.ts +17 -0
  312. package/server/service/bank-account/index.ts +9 -0
  313. package/server/service/financial-institution/financial-institution-mutation.ts +198 -0
  314. package/server/service/financial-institution/financial-institution-query.ts +62 -0
  315. package/server/service/financial-institution/financial-institution-type.ts +91 -0
  316. package/server/service/financial-institution/financial-institution.ts +122 -0
  317. package/server/service/financial-institution/index.ts +7 -0
  318. package/server/service/financial-statement/financial-statement-history.ts +27 -18
  319. package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
  320. package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
  321. package/server/service/financial-statement/financial-statement-query.ts +2 -0
  322. package/server/service/financial-statement/financial-statement.ts +52 -36
  323. package/server/service/financial-statement/index.ts +2 -1
  324. package/server/service/fiscal-month/fiscal-month-mutation.ts +10 -2
  325. package/server/service/fiscal-month/fiscal-month-query.ts +3 -1
  326. package/server/service/fiscal-month/fiscal-month.ts +1 -1
  327. package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +14 -3
  328. package/server/service/fiscal-quarter/fiscal-quarter-query.ts +2 -0
  329. package/server/service/fiscal-quarter/fiscal-quarter.ts +1 -1
  330. package/server/service/fiscal-year/fiscal-year-mutation.ts +10 -2
  331. package/server/service/fiscal-year/fiscal-year-query.ts +2 -0
  332. package/server/service/fiscal-year/fiscal-year.ts +1 -1
  333. package/server/service/income-statement/income-statement-history.ts +30 -17
  334. package/server/service/income-statement/income-statement-line-item.ts +84 -0
  335. package/server/service/income-statement/income-statement-mutation.ts +12 -10
  336. package/server/service/income-statement/income-statement-query.ts +2 -0
  337. package/server/service/income-statement/income-statement.ts +54 -39
  338. package/server/service/income-statement/index.ts +2 -1
  339. package/server/service/index.ts +18 -0
  340. package/server/service/payment/event-subscriber.ts +17 -0
  341. package/server/service/payment/index.ts +9 -0
  342. package/server/service/payment/payment-history.ts +149 -0
  343. package/server/service/payment/payment-mutation.ts +139 -0
  344. package/server/service/payment/payment-query.ts +50 -0
  345. package/server/service/payment/payment-type.ts +82 -0
  346. package/server/service/payment/payment.ts +154 -0
  347. package/server/service/transaction/transaction-history.ts +24 -8
  348. package/server/service/transaction/transaction-mutation.ts +13 -10
  349. package/server/service/transaction/transaction-query.ts +2 -0
  350. package/server/service/transaction/transaction.ts +130 -34
  351. package/things-factory.config.js +0 -1
  352. package/translations/en.json +9 -1
  353. package/translations/ja.json +9 -1
  354. package/translations/ko.json +9 -1
  355. package/translations/ms.json +9 -1
  356. package/translations/zh.json +9 -1
  357. package/client/pages/main.ts +0 -24
  358. package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
  359. package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
  360. package/dist-client/pages/main.d.ts +0 -1
  361. package/dist-client/pages/main.js +0 -27
  362. package/dist-client/pages/main.js.map +0 -1
@@ -4,18 +4,18 @@ exports.TransactionMutation = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const typeorm_1 = require("typeorm");
7
- const attachment_base_1 = require("@things-factory/attachment-base");
7
+ const shell_1 = require("@things-factory/shell");
8
8
  const transaction_1 = require("./transaction");
9
9
  const transaction_type_1 = require("./transaction-type");
10
10
  let TransactionMutation = class TransactionMutation {
11
11
  async createTransaction(transaction, context) {
12
12
  const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(transaction_1.Transaction).save(Object.assign(Object.assign({}, transaction), { domain, creator: user, updater: user }));
13
+ const result = await (0, shell_1.getRepository)(transaction_1.Transaction, tx).save(Object.assign(Object.assign({}, transaction), { domain, creator: user, updater: user }));
14
14
  return result;
15
15
  }
16
16
  async updateTransaction(id, patch, context) {
17
17
  const { domain, user, tx } = context.state;
18
- const repository = tx.getRepository(transaction_1.Transaction);
18
+ const repository = (0, shell_1.getRepository)(transaction_1.Transaction, tx);
19
19
  const transaction = await repository.findOne({
20
20
  where: { domain: { id: domain.id }, id }
21
21
  });
@@ -27,7 +27,7 @@ let TransactionMutation = class TransactionMutation {
27
27
  let results = [];
28
28
  const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
29
29
  const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
30
- const transactionRepo = tx.getRepository(transaction_1.Transaction);
30
+ const transactionRepo = (0, shell_1.getRepository)(transaction_1.Transaction, tx);
31
31
  if (_createRecords.length > 0) {
32
32
  for (let i = 0; i < _createRecords.length; i++) {
33
33
  const newRecord = _createRecords[i];
@@ -47,23 +47,21 @@ let TransactionMutation = class TransactionMutation {
47
47
  }
48
48
  async deleteTransaction(id, context) {
49
49
  const { domain, tx } = context.state;
50
- await tx.getRepository(transaction_1.Transaction).delete({ domain: { id: domain.id }, id });
51
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
50
+ await (0, shell_1.getRepository)(transaction_1.Transaction, tx).delete({ domain: { id: domain.id }, id });
52
51
  return true;
53
52
  }
54
53
  async deleteTransactions(ids, context) {
55
54
  const { domain, tx } = context.state;
56
- await tx.getRepository(transaction_1.Transaction).delete({
55
+ await (0, shell_1.getRepository)(transaction_1.Transaction, tx).delete({
57
56
  domain: { id: domain.id },
58
57
  id: (0, typeorm_1.In)(ids)
59
58
  });
60
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
61
59
  return true;
62
60
  }
63
61
  async importTransactions(transactions, context) {
64
62
  const { domain, tx } = context.state;
65
63
  await Promise.all(transactions.map(async (transaction) => {
66
- const createdTransaction = await tx.getRepository(transaction_1.Transaction).save(Object.assign({ domain }, transaction));
64
+ const createdTransaction = await (0, shell_1.getRepository)(transaction_1.Transaction, tx).save(Object.assign({ domain }, transaction));
67
65
  }));
68
66
  return true;
69
67
  }
@@ -71,6 +69,7 @@ let TransactionMutation = class TransactionMutation {
71
69
  exports.TransactionMutation = TransactionMutation;
72
70
  tslib_1.__decorate([
73
71
  (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
74
73
  (0, type_graphql_1.Mutation)(returns => transaction_1.Transaction, { description: 'To create new Transaction' }),
75
74
  tslib_1.__param(0, (0, type_graphql_1.Arg)('transaction')),
76
75
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -80,6 +79,7 @@ tslib_1.__decorate([
80
79
  ], TransactionMutation.prototype, "createTransaction", null);
81
80
  tslib_1.__decorate([
82
81
  (0, type_graphql_1.Directive)('@transaction'),
82
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
83
83
  (0, type_graphql_1.Mutation)(returns => transaction_1.Transaction, { description: 'To modify Transaction information' }),
84
84
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
85
85
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -90,6 +90,7 @@ tslib_1.__decorate([
90
90
  ], TransactionMutation.prototype, "updateTransaction", null);
91
91
  tslib_1.__decorate([
92
92
  (0, type_graphql_1.Directive)('@transaction'),
93
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
93
94
  (0, type_graphql_1.Mutation)(returns => [transaction_1.Transaction], { description: "To modify multiple Transactions' information" }),
94
95
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [transaction_type_1.TransactionPatch])),
95
96
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -99,6 +100,7 @@ tslib_1.__decorate([
99
100
  ], TransactionMutation.prototype, "updateMultipleTransaction", null);
100
101
  tslib_1.__decorate([
101
102
  (0, type_graphql_1.Directive)('@transaction'),
103
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
102
104
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Transaction' }),
103
105
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
104
106
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -108,6 +110,7 @@ tslib_1.__decorate([
108
110
  ], TransactionMutation.prototype, "deleteTransaction", null);
109
111
  tslib_1.__decorate([
110
112
  (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
111
114
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Transactions' }),
112
115
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
113
116
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -117,6 +120,7 @@ tslib_1.__decorate([
117
120
  ], TransactionMutation.prototype, "deleteTransactions", null);
118
121
  tslib_1.__decorate([
119
122
  (0, type_graphql_1.Directive)('@transaction'),
123
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
120
124
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Transactions' }),
121
125
  tslib_1.__param(0, (0, type_graphql_1.Arg)('transactions', type => [transaction_type_1.TransactionPatch])),
122
126
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-mutation.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,+CAA2C;AAC3C,yDAAqE;AAG9D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CACD,WAA2B,EACxC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAC,IAAI,iCAClD,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAA;QAChD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,+CAC/B,WAAW,GACX,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,yBA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BAAG,GAAE,CAAA;;;;oEAwCP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAOpD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BApIU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAqI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Transaction } from './transaction'\nimport { NewTransaction, TransactionPatch } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionMutation {\n @Directive('@transaction')\n @Mutation(returns => Transaction, { description: 'To create new Transaction' })\n async createTransaction(\n @Arg('transaction') transaction: NewTransaction,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Transaction).save({\n ...transaction,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Transaction, { description: 'To modify Transaction information' })\n async updateTransaction(\n @Arg('id') id: string,\n @Arg('patch') patch: TransactionPatch,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Transaction)\n const transaction = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...transaction,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Transaction], { description: \"To modify multiple Transactions' information\" })\n async updateMultipleTransaction(\n @Arg('patches', type => [TransactionPatch]) patches: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Transaction[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const transactionRepo = tx.getRepository(Transaction)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await transactionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const transaction = await transactionRepo.findOneBy({ id: updateRecord.id })\n\n const result = await transactionRepo.save({\n ...transaction,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Transaction' })\n async deleteTransaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Transaction).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Transactions' })\n async deleteTransactions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Transaction).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Transactions' })\n async importTransactions(\n @Arg('transactions', type => [TransactionPatch]) transactions: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n transactions.map(async (transaction: TransactionPatch) => {\n const createdTransaction: Transaction = await tx.getRepository(Transaction).save({ domain, ...transaction })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"transaction-mutation.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+CAA2C;AAC3C,yDAAqE;AAG9D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAIxB,AAAN,KAAK,CAAC,iBAAiB,CACD,WAA2B,EACxC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,yBAAW,EAAE,EAAE,CAAC,CAAC,IAAI,iCACnD,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP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AC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BAvIU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAwI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { Transaction } from './transaction'\nimport { NewTransaction, TransactionPatch } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Transaction, { description: 'To create new Transaction' })\n async createTransaction(\n @Arg('transaction') transaction: NewTransaction,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(Transaction, tx).save({\n ...transaction,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Transaction, { description: 'To modify Transaction information' })\n async updateTransaction(\n @Arg('id') id: string,\n @Arg('patch') patch: TransactionPatch,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Transaction, tx)\n const transaction = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...transaction,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => [Transaction], { description: \"To modify multiple Transactions' information\" })\n async updateMultipleTransaction(\n @Arg('patches', type => [TransactionPatch]) patches: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Transaction[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const transactionRepo = getRepository(Transaction, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await transactionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const transaction = await transactionRepo.findOneBy({ id: updateRecord.id })\n\n const result = await transactionRepo.save({\n ...transaction,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete Transaction' })\n async deleteTransaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Transaction, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete multiple Transactions' })\n async deleteTransactions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Transaction, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To import multiple Transactions' })\n async importTransactions(\n @Arg('transactions', type => [TransactionPatch]) transactions: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n transactions.map(async (transaction: TransactionPatch) => {\n const createdTransaction: Transaction = await getRepository(Transaction, tx).save({ domain, ...transaction })\n })\n )\n\n return true\n }\n}\n"]}
@@ -37,6 +37,7 @@ let TransactionQuery = class TransactionQuery {
37
37
  };
38
38
  exports.TransactionQuery = TransactionQuery;
39
39
  tslib_1.__decorate([
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
40
41
  (0, type_graphql_1.Query)(returns => transaction_1.Transaction, { nullable: true, description: 'To fetch a Transaction' }),
41
42
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
43
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -45,6 +46,7 @@ tslib_1.__decorate([
45
46
  tslib_1.__metadata("design:returntype", Promise)
46
47
  ], TransactionQuery.prototype, "transaction", null);
47
48
  tslib_1.__decorate([
49
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
48
50
  (0, type_graphql_1.Query)(returns => transaction_type_1.TransactionList, { description: 'To fetch multiple Transactions' }),
49
51
  tslib_1.__param(0, (0, type_graphql_1.Args)()),
50
52
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-query.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAwB;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE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AC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;mDAM9C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,kCAAe,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACjE,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;oDAa3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;2BAvCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,gBAAgB,CAwC5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from './transaction'\nimport { TransactionList } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionQuery {\n @Query(returns => Transaction!, { nullable: true, description: 'To fetch a Transaction' })\n async transaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Transaction> {\n const { domain } = context.state\n\n return await getRepository(Transaction).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => TransactionList, { description: 'To fetch multiple Transactions' })\n async transactions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TransactionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Transaction),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() transaction: Transaction): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: transaction.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.creatorId })\n }\n}\n"]}
1
+ {"version":3,"file":"transaction-query.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAwB;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,YAAY,CAAS,MAAiB,EAAS,OAAwB;QAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC;YAC5C,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SAC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AAjB,iBAAS;;oDAa3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;2BAzCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,gBAAgB,CA0C5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from './transaction'\nimport { TransactionList } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => Transaction!, { nullable: true, description: 'To fetch a Transaction' })\n async transaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Transaction> {\n const { domain } = context.state\n\n return await getRepository(Transaction).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => TransactionList, { description: 'To fetch multiple Transactions' })\n async transactions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TransactionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Transaction),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() transaction: Transaction): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: transaction.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.creatorId })\n }\n}\n"]}
@@ -1,12 +1,28 @@
1
1
  import { Domain } from '@things-factory/shell';
2
2
  import { User } from '@things-factory/auth-base';
3
3
  import { Account } from '../account/account';
4
+ import { Payment } from '../payment/payment';
5
+ import { AccountingDocument } from '../accounting-document/accounting-document';
4
6
  export declare enum TransactionType {
5
- Income = 0,
6
- Expense = 1,
7
- Asset = 2,
8
- Liability = 3,
9
- Equity = 4
7
+ SalesIncome = 0,// 매출
8
+ PurchaseExpense = 1,// 매입
9
+ Asset = 2,// 자산
10
+ Liability = 3,// 부채
11
+ Equity = 4,// 자본
12
+ OtherIncome = 5,// 기타 수익
13
+ OtherExpense = 6
14
+ }
15
+ export declare enum TransactionCategory {
16
+ Confirmed = "Confirmed",// 확정된 건
17
+ Forecast = "Forecast"
18
+ }
19
+ export declare enum TransactionStatus {
20
+ Pending = "Pending",// 처리 대기 중
21
+ Paid = "Paid",// 전액 결제됨
22
+ PartiallyPaid = "PartiallyPaid",// 일부만 결제됨
23
+ Cancelled = "Cancelled",// 취소됨
24
+ Delayed = "Delayed",// 지연됨
25
+ ForecastFailed = "ForecastFailed"
10
26
  }
11
27
  export declare class Transaction {
12
28
  readonly id: string;
@@ -19,12 +35,18 @@ export declare class Transaction {
19
35
  amount?: number;
20
36
  active?: boolean;
21
37
  type?: TransactionType;
38
+ category: TransactionCategory;
39
+ status: TransactionStatus;
40
+ probability?: number;
41
+ forecastNotes?: string;
22
42
  account?: Account;
23
43
  accountId?: string;
24
44
  year?: number;
25
45
  quarter?: number;
26
46
  month?: number;
27
- occurredAt: Date;
47
+ transactionDate: string;
48
+ payments?: Payment[];
49
+ documents?: AccountingDocument[];
28
50
  createdAt?: Date;
29
51
  updatedAt?: Date;
30
52
  deletedAt?: Date;
@@ -1,23 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Transaction = exports.TransactionType = void 0;
3
+ exports.Transaction = exports.TransactionStatus = exports.TransactionCategory = exports.TransactionType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const typeorm_1 = require("typeorm");
6
6
  const type_graphql_1 = require("type-graphql");
7
7
  const shell_1 = require("@things-factory/shell");
8
8
  const auth_base_1 = require("@things-factory/auth-base");
9
9
  const account_1 = require("../account/account");
10
+ const payment_1 = require("../payment/payment");
11
+ const accounting_document_1 = require("../accounting-document/accounting-document");
10
12
  var TransactionType;
11
13
  (function (TransactionType) {
12
- TransactionType[TransactionType["Income"] = 0] = "Income";
13
- TransactionType[TransactionType["Expense"] = 1] = "Expense";
14
+ TransactionType[TransactionType["SalesIncome"] = 0] = "SalesIncome";
15
+ TransactionType[TransactionType["PurchaseExpense"] = 1] = "PurchaseExpense";
14
16
  TransactionType[TransactionType["Asset"] = 2] = "Asset";
15
17
  TransactionType[TransactionType["Liability"] = 3] = "Liability";
16
18
  TransactionType[TransactionType["Equity"] = 4] = "Equity";
19
+ TransactionType[TransactionType["OtherIncome"] = 5] = "OtherIncome";
20
+ TransactionType[TransactionType["OtherExpense"] = 6] = "OtherExpense"; // 기타 비용
17
21
  })(TransactionType || (exports.TransactionType = TransactionType = {}));
18
22
  (0, type_graphql_1.registerEnumType)(TransactionType, {
19
23
  name: 'TransactionType',
20
- description: 'Type enumeration of a transaction'
24
+ description: 'Type enumeration of a transaction, indicating the nature of the transaction (e.g., Sales, Purchase, etc.)'
25
+ });
26
+ var TransactionCategory;
27
+ (function (TransactionCategory) {
28
+ TransactionCategory["Confirmed"] = "Confirmed";
29
+ TransactionCategory["Forecast"] = "Forecast"; // 예상 전망 건
30
+ })(TransactionCategory || (exports.TransactionCategory = TransactionCategory = {}));
31
+ (0, type_graphql_1.registerEnumType)(TransactionCategory, {
32
+ name: 'TransactionCategory',
33
+ description: 'Category of a transaction, indicating whether it is confirmed or a forecast'
34
+ });
35
+ var TransactionStatus;
36
+ (function (TransactionStatus) {
37
+ TransactionStatus["Pending"] = "Pending";
38
+ TransactionStatus["Paid"] = "Paid";
39
+ TransactionStatus["PartiallyPaid"] = "PartiallyPaid";
40
+ TransactionStatus["Cancelled"] = "Cancelled";
41
+ TransactionStatus["Delayed"] = "Delayed";
42
+ TransactionStatus["ForecastFailed"] = "ForecastFailed"; // 전망이 틀린 경우
43
+ })(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
44
+ (0, type_graphql_1.registerEnumType)(TransactionStatus, {
45
+ name: 'TransactionStatus',
46
+ description: 'Status of a transaction, indicating its processing state (e.g., Paid, Delayed, etc.)'
21
47
  });
22
48
  let Transaction = class Transaction {
23
49
  constructor() {
@@ -28,17 +54,17 @@ let Transaction = class Transaction {
28
54
  exports.Transaction = Transaction;
29
55
  tslib_1.__decorate([
30
56
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
31
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
57
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the transaction' }),
32
58
  tslib_1.__metadata("design:type", String)
33
59
  ], Transaction.prototype, "id", void 0);
34
60
  tslib_1.__decorate([
35
61
  (0, typeorm_1.VersionColumn)(),
36
- (0, type_graphql_1.Field)({ nullable: true }),
62
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Version number for optimistic locking' }),
37
63
  tslib_1.__metadata("design:type", Number)
38
64
  ], Transaction.prototype, "version", void 0);
39
65
  tslib_1.__decorate([
40
66
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
41
- (0, type_graphql_1.Field)({ nullable: true }),
67
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The domain in which this transaction belongs' }),
42
68
  tslib_1.__metadata("design:type", shell_1.Domain)
43
69
  ], Transaction.prototype, "domain", void 0);
44
70
  tslib_1.__decorate([
@@ -47,37 +73,63 @@ tslib_1.__decorate([
47
73
  ], Transaction.prototype, "domainId", void 0);
48
74
  tslib_1.__decorate([
49
75
  (0, typeorm_1.Column)(),
50
- (0, type_graphql_1.Field)({ nullable: true }),
76
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Name or title of the transaction' }),
51
77
  tslib_1.__metadata("design:type", String)
52
78
  ], Transaction.prototype, "name", void 0);
53
79
  tslib_1.__decorate([
54
80
  (0, typeorm_1.Column)({ nullable: true }),
55
- (0, type_graphql_1.Field)({ nullable: true }),
81
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of the transaction' }),
56
82
  tslib_1.__metadata("design:type", String)
57
83
  ], Transaction.prototype, "description", void 0);
58
84
  tslib_1.__decorate([
59
85
  (0, typeorm_1.Column)({ nullable: true }),
60
- (0, type_graphql_1.Field)({ nullable: true }),
86
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Currency in which the transaction is denominated' }),
61
87
  tslib_1.__metadata("design:type", String)
62
88
  ], Transaction.prototype, "currency", void 0);
63
89
  tslib_1.__decorate([
64
90
  (0, typeorm_1.Column)({ nullable: true }),
65
- (0, type_graphql_1.Field)({ nullable: true }),
91
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Amount involved in the transaction' }),
66
92
  tslib_1.__metadata("design:type", Number)
67
93
  ], Transaction.prototype, "amount", void 0);
68
94
  tslib_1.__decorate([
69
95
  (0, typeorm_1.Column)({ nullable: true }),
70
- (0, type_graphql_1.Field)({ nullable: true }),
96
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether the transaction is currently active or not' }),
71
97
  tslib_1.__metadata("design:type", Boolean)
72
98
  ], Transaction.prototype, "active", void 0);
73
99
  tslib_1.__decorate([
74
100
  (0, typeorm_1.Column)({ nullable: true }),
75
- (0, type_graphql_1.Field)({ nullable: true }),
101
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Type of the transaction (e.g., SalesIncome, PurchaseExpense)' }),
76
102
  tslib_1.__metadata("design:type", Number)
77
103
  ], Transaction.prototype, "type", void 0);
104
+ tslib_1.__decorate([
105
+ (0, typeorm_1.Column)({ nullable: false }),
106
+ (0, type_graphql_1.Field)(type => TransactionCategory, {
107
+ nullable: false,
108
+ description: 'Category of the transaction (Confirmed or Forecast)'
109
+ }),
110
+ tslib_1.__metadata("design:type", String)
111
+ ], Transaction.prototype, "category", void 0);
112
+ tslib_1.__decorate([
113
+ (0, typeorm_1.Column)({ nullable: false }),
114
+ (0, type_graphql_1.Field)(type => TransactionStatus, {
115
+ nullable: false,
116
+ description: 'Current status of the transaction (e.g., Paid, Delayed)'
117
+ }),
118
+ tslib_1.__metadata("design:type", String)
119
+ ], Transaction.prototype, "status", void 0);
120
+ tslib_1.__decorate([
121
+ (0, typeorm_1.Column)({ nullable: true }),
122
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The probability of the forecast being realized (0 to 100)' }),
123
+ tslib_1.__metadata("design:type", Number)
124
+ ], Transaction.prototype, "probability", void 0);
125
+ tslib_1.__decorate([
126
+ (0, typeorm_1.Column)({ nullable: true }),
127
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Additional notes or comments about the forecast' }),
128
+ tslib_1.__metadata("design:type", String)
129
+ ], Transaction.prototype, "forecastNotes", void 0);
78
130
  tslib_1.__decorate([
79
131
  (0, typeorm_1.ManyToOne)(type => account_1.Account),
80
- (0, type_graphql_1.Field)({ nullable: true }),
132
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Associated account for this transaction' }),
81
133
  tslib_1.__metadata("design:type", account_1.Account)
82
134
  ], Transaction.prototype, "account", void 0);
83
135
  tslib_1.__decorate([
@@ -86,43 +138,55 @@ tslib_1.__decorate([
86
138
  ], Transaction.prototype, "accountId", void 0);
87
139
  tslib_1.__decorate([
88
140
  (0, typeorm_1.Column)({ nullable: true }),
89
- (0, type_graphql_1.Field)({ nullable: true, description: 'fiscal year' }),
141
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year in which the transaction occurs' }),
90
142
  tslib_1.__metadata("design:type", Number)
91
143
  ], Transaction.prototype, "year", void 0);
92
144
  tslib_1.__decorate([
93
145
  (0, typeorm_1.Column)({ nullable: true }),
94
- (0, type_graphql_1.Field)({ nullable: true, description: 'fiscal quarter' }),
146
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter in which the transaction occurs' }),
95
147
  tslib_1.__metadata("design:type", Number)
96
148
  ], Transaction.prototype, "quarter", void 0);
97
149
  tslib_1.__decorate([
98
150
  (0, typeorm_1.Column)({ nullable: true }),
99
- (0, type_graphql_1.Field)({ nullable: true, description: 'fiscal month' }),
151
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month in which the transaction occurs' }),
100
152
  tslib_1.__metadata("design:type", Number)
101
153
  ], Transaction.prototype, "month", void 0);
102
154
  tslib_1.__decorate([
103
- (0, typeorm_1.Column)({ type: 'timestamp', nullable: false }),
104
- (0, type_graphql_1.Field)({ nullable: false, description: 'The exact date and time the transaction occurred' }),
105
- tslib_1.__metadata("design:type", Date // 트랜잭션이 발생한 실제 시점(날짜와 시간)
106
- )
107
- ], Transaction.prototype, "occurredAt", void 0);
155
+ (0, typeorm_1.Column)({ nullable: false }),
156
+ (0, type_graphql_1.Field)({ nullable: false, description: 'The date the transaction occurs or is scheduled (in string format)' }),
157
+ tslib_1.__metadata("design:type", String)
158
+ ], Transaction.prototype, "transactionDate", void 0);
159
+ tslib_1.__decorate([
160
+ (0, typeorm_1.OneToMany)(type => payment_1.Payment, payment => payment.transaction),
161
+ (0, type_graphql_1.Field)(type => [payment_1.Payment], { nullable: true, description: 'List of payments associated with this transaction' }),
162
+ tslib_1.__metadata("design:type", Array)
163
+ ], Transaction.prototype, "payments", void 0);
164
+ tslib_1.__decorate([
165
+ (0, typeorm_1.OneToMany)(type => accounting_document_1.AccountingDocument, document => document.transaction),
166
+ (0, type_graphql_1.Field)(type => [accounting_document_1.AccountingDocument], {
167
+ nullable: true,
168
+ description: 'List of accounting documents linked to this transaction'
169
+ }),
170
+ tslib_1.__metadata("design:type", Array)
171
+ ], Transaction.prototype, "documents", void 0);
108
172
  tslib_1.__decorate([
109
173
  (0, typeorm_1.CreateDateColumn)(),
110
- (0, type_graphql_1.Field)({ nullable: true }),
174
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when the transaction record was created' }),
111
175
  tslib_1.__metadata("design:type", Date)
112
176
  ], Transaction.prototype, "createdAt", void 0);
113
177
  tslib_1.__decorate([
114
178
  (0, typeorm_1.UpdateDateColumn)(),
115
- (0, type_graphql_1.Field)({ nullable: true }),
179
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when the transaction record was last updated' }),
116
180
  tslib_1.__metadata("design:type", Date)
117
181
  ], Transaction.prototype, "updatedAt", void 0);
118
182
  tslib_1.__decorate([
119
183
  (0, typeorm_1.DeleteDateColumn)(),
120
- (0, type_graphql_1.Field)({ nullable: true }),
184
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when the transaction record was deleted (soft delete)' }),
121
185
  tslib_1.__metadata("design:type", Date)
122
186
  ], Transaction.prototype, "deletedAt", void 0);
123
187
  tslib_1.__decorate([
124
188
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
125
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
189
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who created the transaction record' }),
126
190
  tslib_1.__metadata("design:type", auth_base_1.User)
127
191
  ], Transaction.prototype, "creator", void 0);
128
192
  tslib_1.__decorate([
@@ -131,7 +195,7 @@ tslib_1.__decorate([
131
195
  ], Transaction.prototype, "creatorId", void 0);
132
196
  tslib_1.__decorate([
133
197
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
134
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
198
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who last updated the transaction record' }),
135
199
  tslib_1.__metadata("design:type", auth_base_1.User)
136
200
  ], Transaction.prototype, "updater", void 0);
137
201
  tslib_1.__decorate([
@@ -139,13 +203,37 @@ tslib_1.__decorate([
139
203
  tslib_1.__metadata("design:type", String)
140
204
  ], Transaction.prototype, "updaterId", void 0);
141
205
  exports.Transaction = Transaction = tslib_1.__decorate([
142
- (0, type_graphql_1.ObjectType)({ description: 'Entity for Transaction' }),
206
+ (0, type_graphql_1.ObjectType)({
207
+ description: 'Entity representing a financial transaction, which could be sales, purchase, or other types of financial operations.'
208
+ }),
143
209
  (0, typeorm_1.Entity)(),
144
- (0, typeorm_1.Index)('ix_transaction_0', (transaction) => [transaction.domain, transaction.occurredAt], {
145
- unique: true,
210
+ (0, typeorm_1.Index)('ix_transaction_0', (transaction) => [
211
+ transaction.domain,
212
+ transaction.transactionDate,
213
+ transaction.type,
214
+ transaction.account
215
+ ], {
216
+ unique: false,
217
+ where: '"deleted_at" IS NULL'
218
+ }),
219
+ (0, typeorm_1.Index)('ix_transaction_1', (transaction) => [
220
+ transaction.domain,
221
+ transaction.type,
222
+ transaction.account,
223
+ transaction.transactionDate
224
+ ], {
225
+ unique: false,
146
226
  where: '"deleted_at" IS NULL'
147
227
  }),
148
- (0, typeorm_1.Index)('ix_transaction_1', (transaction) => [transaction.domain, transaction.year, transaction.quarter, transaction.month], {
228
+ (0, typeorm_1.Index)('ix_transaction_2', (transaction) => [
229
+ transaction.domain,
230
+ transaction.year,
231
+ transaction.quarter,
232
+ transaction.month,
233
+ transaction.transactionDate,
234
+ transaction.type,
235
+ transaction.account
236
+ ], {
149
237
  unique: true,
150
238
  where: '"deleted_at" IS NULL'
151
239
  })
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAChD,gDAA4C;AAE5C,IAAY,eAM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EAAE,wBAAwB,EAAE,CAAC;IACrD,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE;QACrG,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,eAAK,EACJ,kBAAkB,EAClB,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,EAC5G;QACE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CACF;GACY,WAAW,CAwFvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from '../account/account'\n\nexport enum TransactionType {\n Income,\n Expense,\n Asset,\n Liability,\n Equity\n}\n\nregisterEnumType(TransactionType, {\n name: 'TransactionType',\n description: 'Type enumeration of a transaction'\n})\n\n@ObjectType({ description: 'Entity for Transaction' })\n@Entity()\n@Index('ix_transaction_0', (transaction: Transaction) => [transaction.domain, transaction.occurredAt], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@Index(\n 'ix_transaction_1',\n (transaction: Transaction) => [transaction.domain, transaction.year, transaction.quarter, transaction.month],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\nexport class Transaction {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((transaction: Transaction) => transaction.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n currency?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n amount?: number = 0\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: TransactionType\n\n @ManyToOne(type => Account)\n @Field({ nullable: true })\n account?: Account\n\n @RelationId((transaction: Transaction) => transaction.account)\n accountId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal year' })\n year?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal quarter' })\n quarter?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal month' })\n month?: number\n\n @Column({ type: 'timestamp', nullable: false })\n @Field({ nullable: false, description: 'The exact date and time the transaction occurred' })\n occurredAt: Date // 트랜잭션이 발생한 실제 시점(날짜와 시간)\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((transaction: Transaction) => transaction.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((transaction: Transaction) => transaction.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAAsE;AAEtE,iDAA8C;AAC9C,yDAAgD;AAChD,gDAA4C;AAC5C,gDAA4C;AAC5C,oFAA+E;AAE/E,IAA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AAW,CAAC,eAAe;QAC3B,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,OAAO;KACpB,EACD;QACE,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,eAAK,EACJ,kBAAkB,EAClB,CAAC,WAAwB,EAAE,EAAE,CAAC;QAC5B,WAAW,CAAC,MAAM;QAClB,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,OAAO;QACnB,WAAW,CAAC,eAAe;KAC5B,EACD;QACE,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,eAAK,EACJ,kBAAkB,EAClB,CAAC,WAAwB,EAAE,EAAE,CAAC;QAC5B,WAAW,CAAC,MAAM;QAClB,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,OAAO;QACnB,WAAW,CAAC,KAAK;QACjB,WAAW,CAAC,eAAe;QAC3B,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,OAAO;KACpB,EACD;QACE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CACF;GACY,WAAW,CAyHvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from '../account/account'\nimport { Payment } from '../payment/payment'\nimport { AccountingDocument } from '../accounting-document/accounting-document'\n\nexport enum TransactionType {\n SalesIncome, // 매출\n PurchaseExpense, // 매입\n Asset, // 자산\n Liability, // 부채\n Equity, // 자본\n OtherIncome, // 기타 수익\n OtherExpense // 기타 비용\n}\n\nregisterEnumType(TransactionType, {\n name: 'TransactionType',\n description:\n 'Type enumeration of a transaction, indicating the nature of the transaction (e.g., Sales, Purchase, etc.)'\n})\n\nexport enum TransactionCategory {\n Confirmed = 'Confirmed', // 확정된 건\n Forecast = 'Forecast' // 예상 전망 건\n}\n\nregisterEnumType(TransactionCategory, {\n name: 'TransactionCategory',\n description: 'Category of a transaction, indicating whether it is confirmed or a forecast'\n})\n\nexport enum TransactionStatus {\n Pending = 'Pending', // 처리 대기 중\n Paid = 'Paid', // 전액 결제됨\n PartiallyPaid = 'PartiallyPaid', // 일부만 결제됨\n Cancelled = 'Cancelled', // 취소됨\n Delayed = 'Delayed', // 지연됨\n ForecastFailed = 'ForecastFailed' // 전망이 틀린 경우\n}\n\nregisterEnumType(TransactionStatus, {\n name: 'TransactionStatus',\n description: 'Status of a transaction, indicating its processing state (e.g., Paid, Delayed, etc.)'\n})\n\n@ObjectType({\n description:\n 'Entity representing a financial transaction, which could be sales, purchase, or other types of financial operations.'\n})\n@Entity()\n@Index(\n 'ix_transaction_0',\n (transaction: Transaction) => [\n transaction.domain,\n transaction.transactionDate,\n transaction.type,\n transaction.account\n ],\n {\n unique: false,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@Index(\n 'ix_transaction_1',\n (transaction: Transaction) => [\n transaction.domain,\n transaction.type,\n transaction.account,\n transaction.transactionDate\n ],\n {\n unique: false,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@Index(\n 'ix_transaction_2',\n (transaction: Transaction) => [\n transaction.domain,\n transaction.year,\n transaction.quarter,\n transaction.month,\n transaction.transactionDate,\n transaction.type,\n transaction.account\n ],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\nexport class Transaction {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the transaction' })\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true, description: 'Version number for optimistic locking' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'The domain in which this transaction belongs' })\n domain?: Domain\n\n @RelationId((transaction: Transaction) => transaction.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Name or title of the transaction' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Detailed description of the transaction' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Currency in which the transaction is denominated' })\n currency?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Amount involved in the transaction' })\n amount?: number = 0\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Indicates whether the transaction is currently active or not' })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Type of the transaction (e.g., SalesIncome, PurchaseExpense)' })\n type?: TransactionType\n\n @Column({ nullable: false })\n @Field(type => TransactionCategory, {\n nullable: false,\n description: 'Category of the transaction (Confirmed or Forecast)'\n })\n category: TransactionCategory // 트랜잭션의 카테고리 (확정, 전망)\n\n @Column({ nullable: false })\n @Field(type => TransactionStatus, {\n nullable: false,\n description: 'Current status of the transaction (e.g., Paid, Delayed)'\n })\n status: TransactionStatus // 트랜잭션의 상태 (예: Paid, Delayed 등)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The probability of the forecast being realized (0 to 100)' })\n probability?: number // 예측이 실현될 확률 (0 ~ 100)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Additional notes or comments about the forecast' })\n forecastNotes?: string // 전망에 대한 추가 설명이나 메모\n\n @ManyToOne(type => Account)\n @Field({ nullable: true, description: 'Associated account for this transaction' })\n account?: Account\n\n @RelationId((transaction: Transaction) => transaction.account)\n accountId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal year in which the transaction occurs' })\n year?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal quarter in which the transaction occurs' })\n quarter?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal month in which the transaction occurs' })\n month?: number\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The date the transaction occurs or is scheduled (in string format)' })\n transactionDate: string // 트랜잭션이 발생하거나 발생할 날짜\n\n @OneToMany(type => Payment, payment => payment.transaction)\n @Field(type => [Payment], { nullable: true, description: 'List of payments associated with this transaction' })\n payments?: Payment[]\n\n @OneToMany(type => AccountingDocument, document => document.transaction)\n @Field(type => [AccountingDocument], {\n nullable: true,\n description: 'List of accounting documents linked to this transaction'\n })\n documents?: AccountingDocument[] // 트랜잭션과 연결된 회계 문서\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when the transaction record was created' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when the transaction record was last updated' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Timestamp when the transaction record was deleted (soft delete)' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created the transaction record' })\n creator?: User\n\n @RelationId((transaction: Transaction) => transaction.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated the transaction record' })\n updater?: User\n\n @RelationId((transaction: Transaction) => transaction.updater)\n updaterId?: string\n}\n"]}