@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"financial-statement-line-item.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-line-item.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAoD;AAGpD,yDAAgD;AAChD,gDAA4C;AAC5C,+DAA0D;AAYnD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;CAoDtC,CAAA;AApDY,gEAA0B;AAG5B;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;sDACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,wCAAkB,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC;IACvE,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,wCAAkB,EAAE,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;sCACrG,wCAAkB,CAAC,WAAW;;6DAAZ;AAG7B;IADC,IAAA,oBAAU,EAAC,CAAC,QAAoC,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;;+DACtD;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAC1B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,EAAE,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC;sCACvF,iBAAO,CAAC,iBAAiB;;2DAAlB;AAGhB;IADC,IAAA,oBAAU,EAAC,CAAC,QAAoC,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;6DACtD;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,yEAAyE,EAAE,CAAC;;0DACrG;AAId;IAFC,IAAA,gBA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vF,gBAAI,CAAC,0BAA0B;;2DAA3B;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAoC,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;6DACrD;qCAnDP,0BAA0B;IAVtC,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uFAAuF,EAAE,CAAC;IACpH,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,oCAAoC,EACpC,CAAC,QAAoC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAChF;QACE,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,sBAAsB;KAC9B,CACF;GACY,0BAA0B,CAoDtC","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, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from '../account/account'\nimport { FinancialStatement } from './financial-statement'\n\n@ObjectType({ description: 'Line item for a financial statement, representing the breakdown of financial accounts' })\n@Entity()\n@Index(\n 'ix_financial_statement_line_item_0',\n (lineItem: FinancialStatementLineItem) => [lineItem.statement, lineItem.account],\n {\n unique: false,\n where: '\"deleted_at\" IS NULL'\n }\n)\nexport class FinancialStatementLineItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string // 고유 식별자 (UUID)\n\n @ManyToOne(type => FinancialStatement, statement => statement.lineItems)\n @Field(type => FinancialStatement, { description: 'The financial statement this line item is associated with' })\n statement: FinancialStatement // 연결된 재무제표\n\n @RelationId((lineItem: FinancialStatementLineItem) => lineItem.statement)\n statementId: string // 재무제표의 ID\n\n @ManyToOne(type => Account)\n @Field(type => Account, { description: 'The financial account associated with this line item' })\n account: Account // 라인 아이템과 연결된 계정\n\n @RelationId((lineItem: FinancialStatementLineItem) => lineItem.account)\n accountId: string // 계정의 ID\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The monetary amount related to the financial account for this line item' })\n amount: number // 계정에 대한 금액\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Optional description or notes for this line item' })\n description?: string // 라인 아이템에 대한 선택적 설명 또는 메모\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when this line item was created' })\n createdAt?: Date // 라인 아이템이 생성된 날짜 및 시간\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when this line item was last updated' })\n updatedAt?: Date // 라인 아이템이 마지막으로 업데이트된 날짜 및 시간\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'The date and time when this line item was deleted' })\n deletedAt?: Date // 라인 아이템이 삭제된 날짜 및 시간\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created this line item' })\n creator?: User // 라인 아이템을 생성한 사용자\n\n @RelationId((lineItem: FinancialStatementLineItem) => lineItem.creator)\n creatorId?: string // 생성자의 ID\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated this line item' })\n updater?: User // 라인 아이템을 마지막으로 업데이트한 사용자\n\n @RelationId((lineItem: FinancialStatementLineItem) => lineItem.updater)\n updaterId?: string // 업데이트한 사용자의 ID\n}\n"]}
@@ -4,18 +4,18 @@ exports.FinancialStatementMutation = 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 financial_statement_1 = require("./financial-statement");
9
9
  const financial_statement_type_1 = require("./financial-statement-type");
10
10
  let FinancialStatementMutation = class FinancialStatementMutation {
11
11
  async createFinancialStatement(financialStatement, context) {
12
12
  const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(financial_statement_1.FinancialStatement).save(Object.assign(Object.assign({}, financialStatement), { domain, creator: user, updater: user }));
13
+ const result = await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement, tx).save(Object.assign(Object.assign({}, financialStatement), { domain, creator: user, updater: user }));
14
14
  return result;
15
15
  }
16
16
  async updateFinancialStatement(id, patch, context) {
17
17
  const { domain, user, tx } = context.state;
18
- const repository = tx.getRepository(financial_statement_1.FinancialStatement);
18
+ const repository = (0, shell_1.getRepository)(financial_statement_1.FinancialStatement, tx);
19
19
  const financialStatement = await repository.findOne({
20
20
  where: { domain: { id: domain.id }, id }
21
21
  });
@@ -27,7 +27,7 @@ let FinancialStatementMutation = class FinancialStatementMutation {
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 financialStatementRepo = tx.getRepository(financial_statement_1.FinancialStatement);
30
+ const financialStatementRepo = (0, shell_1.getRepository)(financial_statement_1.FinancialStatement, tx);
31
31
  if (_createRecords.length > 0) {
32
32
  for (let i = 0; i < _createRecords.length; i++) {
33
33
  const newRecord = _createRecords[i];
@@ -47,17 +47,15 @@ let FinancialStatementMutation = class FinancialStatementMutation {
47
47
  }
48
48
  async deleteFinancialStatement(id, context) {
49
49
  const { domain, tx } = context.state;
50
- await tx.getRepository(financial_statement_1.FinancialStatement).delete({ domain: { id: domain.id }, id });
51
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
50
+ await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement, tx).delete({ domain: { id: domain.id }, id });
52
51
  return true;
53
52
  }
54
53
  async deleteFinancialStatements(ids, context) {
55
54
  const { domain, tx } = context.state;
56
- await tx.getRepository(financial_statement_1.FinancialStatement).delete({
55
+ await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement, 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 importFinancialStatements(financialStatements, context) {
@@ -73,6 +71,7 @@ let FinancialStatementMutation = class FinancialStatementMutation {
73
71
  exports.FinancialStatementMutation = FinancialStatementMutation;
74
72
  tslib_1.__decorate([
75
73
  (0, type_graphql_1.Directive)('@transaction'),
74
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
76
75
  (0, type_graphql_1.Mutation)(returns => financial_statement_1.FinancialStatement, { description: 'To create new FinancialStatement' }),
77
76
  tslib_1.__param(0, (0, type_graphql_1.Arg)('financialStatement')),
78
77
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -82,6 +81,7 @@ tslib_1.__decorate([
82
81
  ], FinancialStatementMutation.prototype, "createFinancialStatement", null);
83
82
  tslib_1.__decorate([
84
83
  (0, type_graphql_1.Directive)('@transaction'),
84
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
85
85
  (0, type_graphql_1.Mutation)(returns => financial_statement_1.FinancialStatement, { description: 'To modify FinancialStatement information' }),
86
86
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
87
87
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -92,6 +92,7 @@ tslib_1.__decorate([
92
92
  ], FinancialStatementMutation.prototype, "updateFinancialStatement", null);
93
93
  tslib_1.__decorate([
94
94
  (0, type_graphql_1.Directive)('@transaction'),
95
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
95
96
  (0, type_graphql_1.Mutation)(returns => [financial_statement_1.FinancialStatement], { description: "To modify multiple FinancialStatements' information" }),
96
97
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [financial_statement_type_1.FinancialStatementPatch])),
97
98
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -101,6 +102,7 @@ tslib_1.__decorate([
101
102
  ], FinancialStatementMutation.prototype, "updateMultipleFinancialStatement", null);
102
103
  tslib_1.__decorate([
103
104
  (0, type_graphql_1.Directive)('@transaction'),
105
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
104
106
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete FinancialStatement' }),
105
107
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
106
108
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -110,6 +112,7 @@ tslib_1.__decorate([
110
112
  ], FinancialStatementMutation.prototype, "deleteFinancialStatement", null);
111
113
  tslib_1.__decorate([
112
114
  (0, type_graphql_1.Directive)('@transaction'),
115
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
113
116
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple FinancialStatements' }),
114
117
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
115
118
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -119,6 +122,7 @@ tslib_1.__decorate([
119
122
  ], FinancialStatementMutation.prototype, "deleteFinancialStatements", null);
120
123
  tslib_1.__decorate([
121
124
  (0, type_graphql_1.Directive)('@transaction'),
125
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
122
126
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple FinancialStatements' }),
123
127
  tslib_1.__param(0, (0, type_graphql_1.Arg)('financialStatements', type => [financial_statement_type_1.FinancialStatementPatch])),
124
128
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"financial-statement-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,C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S,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAaP;qCAtIU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAuItC","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 { FinancialStatement } from './financial-statement'\nimport { NewFinancialStatement, FinancialStatementPatch } from './financial-statement-type'\n\n@Resolver(FinancialStatement)\nexport class FinancialStatementMutation {\n @Directive('@transaction')\n @Mutation(returns => FinancialStatement, { description: 'To create new FinancialStatement' })\n async createFinancialStatement(\n @Arg('financialStatement') financialStatement: NewFinancialStatement,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(FinancialStatement).save({\n ...financialStatement,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => FinancialStatement, { description: 'To modify FinancialStatement information' })\n async updateFinancialStatement(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialStatementPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(FinancialStatement)\n const financialStatement = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialStatement,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [FinancialStatement], { description: \"To modify multiple FinancialStatements' information\" })\n async updateMultipleFinancialStatement(\n @Arg('patches', type => [FinancialStatementPatch]) patches: FinancialStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement[]> {\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 financialStatementRepo = tx.getRepository(FinancialStatement)\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 financialStatementRepo.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 financialStatement = await financialStatementRepo.findOneBy({ id: updateRecord.id })\n\n const result = await financialStatementRepo.save({\n ...financialStatement,\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 FinancialStatement' })\n async deleteFinancialStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(FinancialStatement).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 FinancialStatements' })\n async deleteFinancialStatements(\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(FinancialStatement).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 FinancialStatements' })\n async importFinancialStatements(\n @Arg('financialStatements', type => [FinancialStatementPatch]) financialStatements: FinancialStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialStatements.map(async (financialStatement: FinancialStatementPatch) => {\n const createdFinancialStatement: FinancialStatement = await tx\n .getRepository(FinancialStatement)\n .save({ domain, ...financialStatement })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"financial-statement-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAI/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,iCAC1D,kBAAkB,KACrB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,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IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAaP;qCAzIU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CA0ItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { FinancialStatement } from './financial-statement'\nimport { NewFinancialStatement, FinancialStatementPatch } from './financial-statement-type'\n\n@Resolver(FinancialStatement)\nexport class FinancialStatementMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => FinancialStatement, { description: 'To create new FinancialStatement' })\n async createFinancialStatement(\n @Arg('financialStatement') financialStatement: NewFinancialStatement,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FinancialStatement, tx).save({\n ...financialStatement,\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 => FinancialStatement, { description: 'To modify FinancialStatement information' })\n async updateFinancialStatement(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialStatementPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FinancialStatement, tx)\n const financialStatement = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialStatement,\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 => [FinancialStatement], { description: \"To modify multiple FinancialStatements' information\" })\n async updateMultipleFinancialStatement(\n @Arg('patches', type => [FinancialStatementPatch]) patches: FinancialStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement[]> {\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 financialStatementRepo = getRepository(FinancialStatement, 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 financialStatementRepo.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 financialStatement = await financialStatementRepo.findOneBy({ id: updateRecord.id })\n\n const result = await financialStatementRepo.save({\n ...financialStatement,\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 FinancialStatement' })\n async deleteFinancialStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialStatement, 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 FinancialStatements' })\n async deleteFinancialStatements(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialStatement, 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 FinancialStatements' })\n async importFinancialStatements(\n @Arg('financialStatements', type => [FinancialStatementPatch]) financialStatements: FinancialStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialStatements.map(async (financialStatement: FinancialStatementPatch) => {\n const createdFinancialStatement: FinancialStatement = await tx\n .getRepository(FinancialStatement)\n .save({ domain, ...financialStatement })\n })\n )\n\n return true\n }\n}\n"]}
@@ -37,6 +37,7 @@ let FinancialStatementQuery = class FinancialStatementQuery {
37
37
  };
38
38
  exports.FinancialStatementQuery = FinancialStatementQuery;
39
39
  tslib_1.__decorate([
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
40
41
  (0, type_graphql_1.Query)(returns => financial_statement_1.FinancialStatement, { nullable: true, description: 'To fetch a FinancialStatement' }),
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
  ], FinancialStatementQuery.prototype, "financialStatement", 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 => financial_statement_type_1.FinancialStatementList, { description: 'To fetch multiple FinancialStatements' }),
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":"financial-statement-query.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAE5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAS,OAAwB;QAC7E,MAAM,EAAE,MAAM,EAAE,GAA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CAAA;AA3CY,0DAAuB;AAE5B;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,wCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC9E,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMrD;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEhG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;kEAe1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCA1CU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CA2CnC","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 { FinancialStatement } from './financial-statement'\nimport { FinancialStatementList } from './financial-statement-type'\n\n@Resolver(FinancialStatement)\nexport class FinancialStatementQuery {\n @Query(returns => FinancialStatement!, { nullable: true, description: 'To fetch a FinancialStatement' })\n async financialStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialStatement> {\n const { domain } = context.state\n\n return await getRepository(FinancialStatement).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => FinancialStatementList, { description: 'To fetch multiple FinancialStatements' })\n async financialStatements(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatementList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FinancialStatement),\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() financialStatement: FinancialStatement): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: financialStatement.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() financialStatement: FinancialStatement): Promise<User> {\n return await getRepository(User).findOneBy({ id: financialStatement.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() financialStatement: FinancialStatement): Promise<User> {\n return await getRepository(User).findOneBy({ id: financialStatement.creatorId })\n }\n}\n"]}
1
+ {"version":3,"file":"financial-statement-query.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAS,OAAwB;QAC7E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YACrD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK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,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMrD;AAIK;IAFL,IAAA,wBAAS,EAAC,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEhG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;kEAe1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCA5CU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CA6CnC","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 { FinancialStatement } from './financial-statement'\nimport { FinancialStatementList } from './financial-statement-type'\n\n@Resolver(FinancialStatement)\nexport class FinancialStatementQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FinancialStatement!, { nullable: true, description: 'To fetch a FinancialStatement' })\n async financialStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialStatement> {\n const { domain } = context.state\n\n return await getRepository(FinancialStatement).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FinancialStatementList, { description: 'To fetch multiple FinancialStatements' })\n async financialStatements(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatementList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FinancialStatement),\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() financialStatement: FinancialStatement): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: financialStatement.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() financialStatement: FinancialStatement): Promise<User> {\n return await getRepository(User).findOneBy({ id: financialStatement.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() financialStatement: FinancialStatement): Promise<User> {\n return await getRepository(User).findOneBy({ id: financialStatement.creatorId })\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Domain } from '@things-factory/shell';
2
2
  import { User } from '@things-factory/auth-base';
3
+ import { FinancialStatementLineItem } from './financial-statement-line-item';
3
4
  export declare enum FinancialStatementStatus {
4
5
  STATUS_A = "STATUS_A",
5
6
  STATUS_B = "STATUS_B"
@@ -15,6 +16,7 @@ export declare class FinancialStatement {
15
16
  asset?: number;
16
17
  liability?: number;
17
18
  equity?: number;
19
+ lineItems?: FinancialStatementLineItem[];
18
20
  createdAt?: Date;
19
21
  updatedAt?: Date;
20
22
  deletedAt?: Date;
@@ -6,6 +6,7 @@ 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
+ const financial_statement_line_item_1 = require("./financial-statement-line-item");
9
10
  var FinancialStatementStatus;
10
11
  (function (FinancialStatementStatus) {
11
12
  FinancialStatementStatus["STATUS_A"] = "STATUS_A";
@@ -13,28 +14,30 @@ var FinancialStatementStatus;
13
14
  })(FinancialStatementStatus || (exports.FinancialStatementStatus = FinancialStatementStatus = {}));
14
15
  (0, type_graphql_1.registerEnumType)(FinancialStatementStatus, {
15
16
  name: 'FinancialStatementStatus',
16
- description: 'state enumeration of a financialStatement'
17
+ description: 'State enumeration of a financial statement' // 재무제표 상태 열거형
17
18
  });
19
+ // 재무제표 (Financial Statement)
18
20
  let FinancialStatement = class FinancialStatement {
19
21
  constructor() {
20
- this.version = 1;
22
+ this.version = 1; // 낙관적 잠금을 위한 버전 관리 필드
21
23
  }
22
24
  };
23
25
  exports.FinancialStatement = FinancialStatement;
24
26
  tslib_1.__decorate([
25
27
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
26
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
28
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the financial statement' }),
27
29
  tslib_1.__metadata("design:type", String)
28
30
  ], FinancialStatement.prototype, "id", void 0);
29
31
  tslib_1.__decorate([
30
32
  (0, typeorm_1.VersionColumn)(),
31
- (0, type_graphql_1.Field)({ nullable: true }),
33
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Version number for optimistic locking' }),
32
34
  tslib_1.__metadata("design:type", Number)
33
35
  ], FinancialStatement.prototype, "version", void 0);
34
36
  tslib_1.__decorate([
35
37
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
36
- (0, type_graphql_1.Field)({ nullable: true }),
37
- tslib_1.__metadata("design:type", shell_1.Domain)
38
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The domain to which this financial statement belongs' }),
39
+ tslib_1.__metadata("design:type", shell_1.Domain // 이 재무제표가 속한 도메인
40
+ )
38
41
  ], FinancialStatement.prototype, "domain", void 0);
39
42
  tslib_1.__decorate([
40
43
  (0, typeorm_1.RelationId)((financialStatement) => financialStatement.domain),
@@ -42,53 +45,62 @@ tslib_1.__decorate([
42
45
  ], FinancialStatement.prototype, "domainId", void 0);
43
46
  tslib_1.__decorate([
44
47
  (0, typeorm_1.Column)({ nullable: true }),
45
- (0, type_graphql_1.Field)({ nullable: true, description: 'fiscal year' }),
48
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year of the financial statement' }),
46
49
  tslib_1.__metadata("design:type", Number)
47
50
  ], FinancialStatement.prototype, "year", void 0);
48
51
  tslib_1.__decorate([
49
52
  (0, typeorm_1.Column)({ nullable: true }),
50
- (0, type_graphql_1.Field)({ nullable: true, description: 'fiscal quarter' }),
53
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter of the financial statement' }),
51
54
  tslib_1.__metadata("design:type", Number)
52
55
  ], FinancialStatement.prototype, "quarter", void 0);
53
56
  tslib_1.__decorate([
54
57
  (0, typeorm_1.Column)({ nullable: true }),
55
- (0, type_graphql_1.Field)({ nullable: true }),
58
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month of the financial statement' }),
56
59
  tslib_1.__metadata("design:type", Number)
57
60
  ], FinancialStatement.prototype, "month", void 0);
58
61
  tslib_1.__decorate([
59
62
  (0, typeorm_1.Column)({ nullable: true }),
60
- (0, type_graphql_1.Field)({ nullable: true }),
63
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Total assets recorded in the financial statement' }),
61
64
  tslib_1.__metadata("design:type", Number)
62
65
  ], FinancialStatement.prototype, "asset", void 0);
63
66
  tslib_1.__decorate([
64
67
  (0, typeorm_1.Column)({ nullable: true }),
65
- (0, type_graphql_1.Field)({ nullable: true }),
68
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Total liabilities recorded in the financial statement' }),
66
69
  tslib_1.__metadata("design:type", Number)
67
70
  ], FinancialStatement.prototype, "liability", void 0);
68
71
  tslib_1.__decorate([
69
72
  (0, typeorm_1.Column)({ nullable: true }),
70
- (0, type_graphql_1.Field)({ nullable: true }),
73
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Total equity recorded in the financial statement' }),
71
74
  tslib_1.__metadata("design:type", Number)
72
75
  ], FinancialStatement.prototype, "equity", void 0);
76
+ tslib_1.__decorate([
77
+ (0, typeorm_1.OneToMany)(type => financial_statement_line_item_1.FinancialStatementLineItem, lineItem => lineItem.statement),
78
+ (0, type_graphql_1.Field)(type => [financial_statement_line_item_1.FinancialStatementLineItem], { nullable: true }),
79
+ tslib_1.__metadata("design:type", Array)
80
+ ], FinancialStatement.prototype, "lineItems", void 0);
73
81
  tslib_1.__decorate([
74
82
  (0, typeorm_1.CreateDateColumn)(),
75
- (0, type_graphql_1.Field)({ nullable: true }),
76
- tslib_1.__metadata("design:type", Date)
83
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the financial statement was created' }),
84
+ tslib_1.__metadata("design:type", Date // 재무제표가 생성된 날짜 및 시간
85
+ )
77
86
  ], FinancialStatement.prototype, "createdAt", void 0);
78
87
  tslib_1.__decorate([
79
88
  (0, typeorm_1.UpdateDateColumn)(),
80
- (0, type_graphql_1.Field)({ nullable: true }),
81
- tslib_1.__metadata("design:type", Date)
89
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the financial statement was last updated' }),
90
+ tslib_1.__metadata("design:type", Date // 재무제표가 마지막으로 업데이트된 날짜 및 시간
91
+ )
82
92
  ], FinancialStatement.prototype, "updatedAt", void 0);
83
93
  tslib_1.__decorate([
84
94
  (0, typeorm_1.DeleteDateColumn)(),
85
- (0, type_graphql_1.Field)({ nullable: true }),
86
- tslib_1.__metadata("design:type", Date)
95
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the financial statement was deleted' }),
96
+ tslib_1.__metadata("design:type", Date // 재무제표가 삭제된 날짜 및 시간
97
+ )
87
98
  ], FinancialStatement.prototype, "deletedAt", void 0);
88
99
  tslib_1.__decorate([
89
100
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
90
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
91
- tslib_1.__metadata("design:type", auth_base_1.User)
101
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the financial statement' }),
102
+ tslib_1.__metadata("design:type", auth_base_1.User // 재무제표를 생성한 사용자
103
+ )
92
104
  ], FinancialStatement.prototype, "creator", void 0);
93
105
  tslib_1.__decorate([
94
106
  (0, typeorm_1.RelationId)((financialStatement) => financialStatement.creator),
@@ -96,8 +108,9 @@ tslib_1.__decorate([
96
108
  ], FinancialStatement.prototype, "creatorId", void 0);
97
109
  tslib_1.__decorate([
98
110
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
99
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
100
- tslib_1.__metadata("design:type", auth_base_1.User)
111
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the financial statement' }),
112
+ tslib_1.__metadata("design:type", auth_base_1.User // 재무제표를 마지막으로 업데이트한 사용자
113
+ )
101
114
  ], FinancialStatement.prototype, "updater", void 0);
102
115
  tslib_1.__decorate([
103
116
  (0, typeorm_1.RelationId)((financialStatement) => financialStatement.updater),
@@ -105,7 +118,15 @@ tslib_1.__decorate([
105
118
  ], FinancialStatement.prototype, "updaterId", void 0);
106
119
  exports.FinancialStatement = FinancialStatement = tslib_1.__decorate([
107
120
  (0, typeorm_1.Entity)(),
108
- (0, typeorm_1.Index)('ix_financial_statement_0', (financialStatement) => [financialStatement.domain, financialStatement.deletedAt], { unique: true }),
109
- (0, type_graphql_1.ObjectType)({ description: 'Entity for FinancialStatement' })
121
+ (0, typeorm_1.Index)('ix_financial_statement_0', (financialStatement) => [
122
+ financialStatement.domain,
123
+ financialStatement.year,
124
+ financialStatement.quarter,
125
+ financialStatement.month
126
+ ], {
127
+ unique: true,
128
+ where: '"deleted_at" IS NULL' // 삭제되지 않은 경우에만 유니크
129
+ }),
130
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for FinancialStatement, representing the financial position of an entity' }) // 엔티티 설명 추가
110
131
  ], FinancialStatement);
111
132
  //# sourceMappingURL=financial-statement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"financial-statement.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,iDAAqB,CAAA;AACvB,CAAC,EAHW,wBAAwB,wCAAxB,wBAAwB,QAGnC;AAED,IAAA,+BAAgB,EAAC,wBAAwB,EAAE;IACzC,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,2CAA2C;CACzD,CAAC,CAAA;AASK,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAOL,YAAO,GAAY,CAAC,CAAA;IA0DtB,CAAC;CAAA,CAAA;AAjEY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;;oDACjE;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;;gDACzC;AAIb;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE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sCAC9B,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;6BAhEP,kBAAkB;IAP9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC,EACrG,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CAiE9B","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'\n\nexport enum FinancialStatementStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(FinancialStatementStatus, {\n name: 'FinancialStatementStatus',\n description: 'state enumeration of a financialStatement'\n})\n\n@Entity()\n@Index(\n 'ix_financial_statement_0',\n (financialStatement: FinancialStatement) => [financialStatement.domain, financialStatement.deletedAt],\n { unique: true }\n)\n@ObjectType({ description: 'Entity for FinancialStatement' })\nexport class FinancialStatement {\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((financialStatement: FinancialStatement) => financialStatement.domain)\n domainId?: 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 })\n month?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n asset?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n liability?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n equity?: number\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((financialStatement: FinancialStatement) => financialStatement.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((financialStatement: FinancialStatement) => financialStatement.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"financial-statement.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAAsE;AAEtE,iDAA8C;AAC9C,yDAAgD;AAEhD,mFAA4E;AAE5E,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,iDAAqB,CAAA;AACvB,CAAC,EAHW,wBAAwB,wCAAxB,wBAAwB,QAGnC;AAED,IAAA,+BAAgB,EAAC,wBAAwB,EAAE;IACzC,IAAI,EAAE,0BAA0B;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DateColumn,\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'\n\nimport { FinancialStatementLineItem } from './financial-statement-line-item'\n\nexport enum FinancialStatementStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(FinancialStatementStatus, {\n name: 'FinancialStatementStatus',\n description: 'State enumeration of a financial statement' // 재무제표 상태 열거형\n})\n\n// 재무제표 (Financial Statement)\n@Entity()\n@Index(\n 'ix_financial_statement_0',\n (financialStatement: FinancialStatement) => [\n financialStatement.domain,\n financialStatement.year,\n financialStatement.quarter,\n financialStatement.month\n ],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL' // 삭제되지 않은 경우에만 유니크\n }\n)\n@ObjectType({ description: 'Entity for FinancialStatement, representing the financial position of an entity' }) // 엔티티 설명 추가\nexport class FinancialStatement {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the financial statement' })\n readonly id: string // 고유 식별자 (UUID)\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 to which this financial statement belongs' })\n domain?: Domain // 이 재무제표가 속한 도메인\n\n @RelationId((financialStatement: FinancialStatement) => financialStatement.domain)\n domainId?: string // 도메인의 ID\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal year of the financial statement' })\n year?: number // 회계 연도\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal quarter of the financial statement' })\n quarter?: number // 회계 분기\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal month of the financial statement' })\n month?: number // 회계 월\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Total assets recorded in the financial statement' })\n asset?: number // 재무제표에 기록된 총자산\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Total liabilities recorded in the financial statement' })\n liability?: number // 재무제표에 기록된 총부채\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Total equity recorded in the financial statement' })\n equity?: number // 재무제표에 기록된 총자본\n\n @OneToMany(type => FinancialStatementLineItem, lineItem => lineItem.statement)\n @Field(type => [FinancialStatementLineItem], { nullable: true })\n lineItems?: FinancialStatementLineItem[] // 계정별 브레이크다운\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the financial statement was created' })\n createdAt?: Date // 재무제표가 생성된 날짜 및 시간\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the financial statement was last updated' })\n updatedAt?: Date // 재무제표가 마지막으로 업데이트된 날짜 및 시간\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'The date and time when the financial statement was deleted' })\n deletedAt?: Date // 재무제표가 삭제된 날짜 및 시간\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the financial statement' })\n creator?: User // 재무제표를 생성한 사용자\n\n @RelationId((financialStatement: FinancialStatement) => financialStatement.creator)\n creatorId?: string // 재무제표를 생성한 사용자의 ID\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the financial statement' })\n updater?: User // 재무제표를 마지막으로 업데이트한 사용자\n\n @RelationId((financialStatement: FinancialStatement) => financialStatement.updater)\n updaterId?: string // 재무제표를 업데이트한 사용자의 ID\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { FinancialStatement } from './financial-statement';
2
- import { FinancialStatementHistory } from './financial-statement-history';
2
+ import { FinancialStatementLineItem } from './financial-statement-line-item';
3
3
  import { FinancialStatementQuery } from './financial-statement-query';
4
4
  import { FinancialStatementMutation } from './financial-statement-mutation';
5
5
  import { FinancialStatementHistoryEntitySubscriber } from './event-subscriber';
6
- export declare const entities: (typeof FinancialStatement | typeof FinancialStatementHistory)[];
6
+ export declare const entities: (typeof FinancialStatementLineItem | typeof FinancialStatement)[];
7
7
  export declare const resolvers: (typeof FinancialStatementQuery | typeof FinancialStatementMutation)[];
8
8
  export declare const subscribers: (typeof FinancialStatementHistoryEntitySubscriber)[];
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.subscribers = exports.resolvers = exports.entities = void 0;
4
4
  const financial_statement_1 = require("./financial-statement");
5
+ const financial_statement_line_item_1 = require("./financial-statement-line-item");
5
6
  const financial_statement_history_1 = require("./financial-statement-history");
6
7
  const financial_statement_query_1 = require("./financial-statement-query");
7
8
  const financial_statement_mutation_1 = require("./financial-statement-mutation");
8
9
  const event_subscriber_1 = require("./event-subscriber");
9
- exports.entities = [financial_statement_1.FinancialStatement, financial_statement_history_1.FinancialStatementHistory];
10
+ exports.entities = [financial_statement_1.FinancialStatement, financial_statement_line_item_1.FinancialStatementLineItem, financial_statement_history_1.FinancialStatementHistory];
10
11
  exports.resolvers = [financial_statement_query_1.FinancialStatementQuery, financial_statement_mutation_1.FinancialStatementMutation];
11
12
  exports.subscribers = [event_subscriber_1.FinancialStatementHistoryEntitySubscriber];
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/financial-statement/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,+EAAyE;AACzE,2EAAqE;AACrE,iFAA2E;AAC3E,yDAA8E;AAEjE,QAAA,QAAQ,GAAG,CAAC,wCAAkB,EAAE,uDAAyB,CAAC,CAAA;AAC1D,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,CAAC,4DAAyC,CAAC,CAAA","sourcesContent":["import { FinancialStatement } from './financial-statement'\nimport { FinancialStatementHistory } from './financial-statement-history'\nimport { FinancialStatementQuery } from './financial-statement-query'\nimport { FinancialStatementMutation } from './financial-statement-mutation'\nimport { FinancialStatementHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [FinancialStatement, FinancialStatementHistory]\nexport const resolvers = [FinancialStatementQuery, FinancialStatementMutation]\nexport const subscribers = [FinancialStatementHistoryEntitySubscriber]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/financial-statement/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,mFAA4E;AAC5E,+EAAyE;AACzE,2EAAqE;AACrE,iFAA2E;AAC3E,yDAA8E;AAEjE,QAAA,QAAQ,GAAG,CAAC,wCAAkB,EAAE,0DAA0B,EAAE,uDAAyB,CAAC,CAAA;AACtF,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,CAAC,4DAAyC,CAAC,CAAA","sourcesContent":["import { FinancialStatement } from './financial-statement'\nimport { FinancialStatementLineItem } from './financial-statement-line-item'\nimport { FinancialStatementHistory } from './financial-statement-history'\nimport { FinancialStatementQuery } from './financial-statement-query'\nimport { FinancialStatementMutation } from './financial-statement-mutation'\nimport { FinancialStatementHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [FinancialStatement, FinancialStatementLineItem, FinancialStatementHistory]\nexport const resolvers = [FinancialStatementQuery, FinancialStatementMutation]\nexport const subscribers = [FinancialStatementHistoryEntitySubscriber]\n"]}
@@ -69,6 +69,7 @@ let FiscalMonthMutation = class FiscalMonthMutation {
69
69
  exports.FiscalMonthMutation = FiscalMonthMutation;
70
70
  tslib_1.__decorate([
71
71
  (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
72
73
  (0, type_graphql_1.Mutation)(returns => fiscal_month_1.FiscalMonth, { description: 'To create new FiscalMonth' }),
73
74
  tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalMonth')),
74
75
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -78,6 +79,7 @@ tslib_1.__decorate([
78
79
  ], FiscalMonthMutation.prototype, "createFiscalMonth", null);
79
80
  tslib_1.__decorate([
80
81
  (0, type_graphql_1.Directive)('@transaction'),
82
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
81
83
  (0, type_graphql_1.Mutation)(returns => fiscal_month_1.FiscalMonth, { description: 'To modify FiscalMonth information' }),
82
84
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
83
85
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -88,6 +90,7 @@ tslib_1.__decorate([
88
90
  ], FiscalMonthMutation.prototype, "updateFiscalMonth", null);
89
91
  tslib_1.__decorate([
90
92
  (0, type_graphql_1.Directive)('@transaction'),
93
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
91
94
  (0, type_graphql_1.Mutation)(returns => [fiscal_month_1.FiscalMonth], { description: "To modify multiple FiscalMonths' information" }),
92
95
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [fiscal_month_type_1.FiscalMonthPatch])),
93
96
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -97,6 +100,7 @@ tslib_1.__decorate([
97
100
  ], FiscalMonthMutation.prototype, "updateMultipleFiscalMonth", null);
98
101
  tslib_1.__decorate([
99
102
  (0, type_graphql_1.Directive)('@transaction'),
103
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
100
104
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete FiscalMonth' }),
101
105
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
102
106
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -106,6 +110,7 @@ tslib_1.__decorate([
106
110
  ], FiscalMonthMutation.prototype, "deleteFiscalMonth", null);
107
111
  tslib_1.__decorate([
108
112
  (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
109
114
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple FiscalMonths' }),
110
115
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
111
116
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -115,6 +120,7 @@ tslib_1.__decorate([
115
120
  ], FiscalMonthMutation.prototype, "deleteFiscalMonths", null);
116
121
  tslib_1.__decorate([
117
122
  (0, type_graphql_1.Directive)('@transaction'),
123
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
118
124
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple FiscalMonths' }),
119
125
  tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalMonths', type => [fiscal_month_type_1.FiscalMonthPatch])),
120
126
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"fiscal-month-mutation.js","sourceRoot":"","sources":["../../../server/service/fiscal-month/fiscal-month-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,iDAA4C;AAC5C,2DAAsE;AAG/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAwB;QACtG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,0BAAW,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;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAw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EAAC,0BAAW,CAAC;GACT,mBAAmB,CAgI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { FiscalMonth } from './fiscal-month'\nimport { NewFiscalMonth, FiscalMonthPatch } from './fiscal-month-type'\n\n@Resolver(FiscalMonth)\nexport class FiscalMonthMutation {\n @Directive('@transaction')\n @Mutation(returns => FiscalMonth, { description: 'To create new FiscalMonth' })\n async createFiscalMonth(@Arg('fiscalMonth') fiscalMonth: NewFiscalMonth, @Ctx() context: ResolverContext): Promise<FiscalMonth> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FiscalMonth, tx).save({\n ...fiscalMonth,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => FiscalMonth, { description: 'To modify FiscalMonth information' })\n async updateFiscalMonth(\n @Arg('id') id: string,\n @Arg('patch') patch: FiscalMonthPatch,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FiscalMonth, tx)\n const fiscalMonth = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...fiscalMonth,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [FiscalMonth], { description: \"To modify multiple FiscalMonths' information\" })\n async updateMultipleFiscalMonth(\n @Arg('patches', type => [FiscalMonthPatch]) patches: FiscalMonthPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth[]> {\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 fiscalMonthRepo = getRepository(FiscalMonth, 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 fiscalMonthRepo.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 fiscalMonth = await fiscalMonthRepo.findOneBy({ id: updateRecord.id })\n\n const result = await fiscalMonthRepo.save({\n ...fiscalMonth,\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 FiscalMonth' })\n async deleteFiscalMonth(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalMonth, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple FiscalMonths' })\n async deleteFiscalMonths(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalMonth, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple FiscalMonths' })\n async importFiscalMonths(\n @Arg('fiscalMonths', type => [FiscalMonthPatch]) fiscalMonths: FiscalMonthPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n fiscalMonths.map(async (fiscalMonth: FiscalMonthPatch) => {\n const createdFiscalMonth: FiscalMonth = await getRepository(FiscalMonth, tx).save({ domain, ...fiscalMonth })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"fiscal-month-mutation.js","sourceRoot":"","sources":["../../../server/service/fiscal-month/fiscal-month-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,iDAA4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pD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,2DAA2D,CAAC;IACtE,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;;;;6DAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,2DAA2D,CAAC;IACtE,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,oCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BAvIU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAwI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { FiscalMonth } from './fiscal-month'\nimport { NewFiscalMonth, FiscalMonthPatch } from './fiscal-month-type'\n\n@Resolver(FiscalMonth)\nexport class FiscalMonthMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => FiscalMonth, { description: 'To create new FiscalMonth' })\n async createFiscalMonth(\n @Arg('fiscalMonth') fiscalMonth: NewFiscalMonth,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FiscalMonth, tx).save({\n ...fiscalMonth,\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 => FiscalMonth, { description: 'To modify FiscalMonth information' })\n async updateFiscalMonth(\n @Arg('id') id: string,\n @Arg('patch') patch: FiscalMonthPatch,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FiscalMonth, tx)\n const fiscalMonth = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...fiscalMonth,\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 => [FiscalMonth], { description: \"To modify multiple FiscalMonths' information\" })\n async updateMultipleFiscalMonth(\n @Arg('patches', type => [FiscalMonthPatch]) patches: FiscalMonthPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth[]> {\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 fiscalMonthRepo = getRepository(FiscalMonth, 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 fiscalMonthRepo.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 fiscalMonth = await fiscalMonthRepo.findOneBy({ id: updateRecord.id })\n\n const result = await fiscalMonthRepo.save({\n ...fiscalMonth,\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 FiscalMonth' })\n async deleteFiscalMonth(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalMonth, 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 FiscalMonths' })\n async deleteFiscalMonths(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalMonth, 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 FiscalMonths' })\n async importFiscalMonths(\n @Arg('fiscalMonths', type => [FiscalMonthPatch]) fiscalMonths: FiscalMonthPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n fiscalMonths.map(async (fiscalMonth: FiscalMonthPatch) => {\n const createdFiscalMonth: FiscalMonth = await getRepository(FiscalMonth, tx).save({ domain, ...fiscalMonth })\n })\n )\n\n return true\n }\n}\n"]}
@@ -37,6 +37,7 @@ let FiscalMonthQuery = class FiscalMonthQuery {
37
37
  };
38
38
  exports.FiscalMonthQuery = FiscalMonthQuery;
39
39
  tslib_1.__decorate([
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
40
41
  (0, type_graphql_1.Query)(returns => fiscal_month_1.FiscalMonth, { nullable: true, description: 'To fetch a FiscalMonth by year, quarter, and month' }),
41
42
  tslib_1.__param(0, (0, type_graphql_1.Arg)('year')),
42
43
  tslib_1.__param(1, (0, type_graphql_1.Arg)('quarter')),
@@ -47,6 +48,7 @@ tslib_1.__decorate([
47
48
  tslib_1.__metadata("design:returntype", Promise)
48
49
  ], FiscalMonthQuery.prototype, "fiscalMonth", null);
49
50
  tslib_1.__decorate([
51
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
50
52
  (0, type_graphql_1.Query)(returns => fiscal_month_type_1.FiscalMonthList, { description: 'To fetch multiple FiscalMonths' }),
51
53
  tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
52
54
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"fiscal-month-query.js","sourceRoot":"","sources":["../../../server/service/fiscal-month/fiscal-month-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CACF,IAAY,EACT,OAAe,EACjB,KAAa,EACpB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;SAC3D,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CACS,MAAiB,EACnC,OAAwB;QAE/B,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,0BAAW,CAAC;YAC5C,WAAW,EAAE,EAAE;SAChB,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAE3D,O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,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;oDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;2BA/CU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CAgD5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FiscalMonth } from './fiscal-month'\nimport { FiscalMonthList } from './fiscal-month-type'\n\n@Resolver(FiscalMonth)\nexport class FiscalMonthQuery {\n @Query(returns => FiscalMonth!, { nullable: true, description: 'To fetch a FiscalMonth by year, quarter, and month' })\n async fiscalMonth(\n @Arg('year') year: number,\n @Arg('quarter') quarter: number,\n @Arg('month') month: number,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth | undefined> {\n const { domain } = context.state\n\n return await getRepository(FiscalMonth).findOne({\n where: { domain: { id: domain.id }, year, quarter, month }\n })\n }\n\n @Query(returns => FiscalMonthList, { description: 'To fetch multiple FiscalMonths' })\n async fiscalMonths(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonthList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FiscalMonth),\n searchables: []\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() fiscalMonth: FiscalMonth): Promise<Domain> {\n return fiscalMonth.domainId && (await getRepository(Domain).findOneBy({ id: fiscalMonth.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fiscalMonth: FiscalMonth): Promise<User> {\n return fiscalMonth.updaterId && (await getRepository(User).findOneBy({ id: fiscalMonth.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fiscalMonth: FiscalMonth): Promise<User> {\n return fiscalMonth.creatorId && (await getRepository(User).findOneBy({ id: fiscalMonth.creatorId }))\n }\n}\n"]}
1
+ {"version":3,"file":"fiscal-month-query.js","sourceRoot":"","sources":["../../../server/service/fiscal-month/fiscal-month-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,WAAW,CACF,IAAY,EACT,OAAe,EACjB,KAAa,EACpB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;SAC3D,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,YAAY,CACS,MAAiB,EACnC,OAAwB;QAE/B,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,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GAAE,CAAA;;;;mDAOP;AAIK;IAFL,IAAA,wBAAS,EAAC,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mCAAe,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAElF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;oDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;2BAjDU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CAkD5B","sourcesContent":["import { Directive, Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FiscalMonth } from './fiscal-month'\nimport { FiscalMonthList } from './fiscal-month-type'\n\n@Resolver(FiscalMonth)\nexport class FiscalMonthQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalMonth!, { nullable: true, description: 'To fetch a FiscalMonth by year, quarter, and month' })\n async fiscalMonth(\n @Arg('year') year: number,\n @Arg('quarter') quarter: number,\n @Arg('month') month: number,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonth | undefined> {\n const { domain } = context.state\n\n return await getRepository(FiscalMonth).findOne({\n where: { domain: { id: domain.id }, year, quarter, month }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalMonthList, { description: 'To fetch multiple FiscalMonths' })\n async fiscalMonths(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FiscalMonthList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FiscalMonth),\n searchables: []\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() fiscalMonth: FiscalMonth): Promise<Domain> {\n return fiscalMonth.domainId && (await getRepository(Domain).findOneBy({ id: fiscalMonth.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fiscalMonth: FiscalMonth): Promise<User> {\n return fiscalMonth.updaterId && (await getRepository(User).findOneBy({ id: fiscalMonth.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fiscalMonth: FiscalMonth): Promise<User> {\n return fiscalMonth.creatorId && (await getRepository(User).findOneBy({ id: fiscalMonth.creatorId }))\n }\n}\n"]}
@@ -50,7 +50,7 @@ tslib_1.__decorate([
50
50
  tslib_1.__metadata("design:type", String)
51
51
  ], FiscalMonth.prototype, "endDate", void 0);
52
52
  tslib_1.__decorate([
53
- (0, typeorm_1.Column)({ type: 'enum', enum: common_type_1.FiscalStatus, default: common_type_1.FiscalStatus.OPEN }),
53
+ (0, typeorm_1.Column)({ default: common_type_1.FiscalStatus.OPEN }),
54
54
  (0, type_graphql_1.Field)(type => common_type_1.FiscalStatus, { description: 'The status of the fiscal month (OPEN, CLOSED, FINALIZED)' }),
55
55
  tslib_1.__metadata("design:type", String)
56
56
  ], FiscalMonth.prototype, "status", void 0);