@things-factory/accounting 7.0.2 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/client/activities/activity-book-edit.ts +1 -1
  2. package/client/activities/activity-book-view.ts +1 -1
  3. package/client/activities/activity-expense-edit.ts +1 -1
  4. package/client/activities/activity-expense-view.ts +1 -1
  5. package/client/bootstrap.ts +10 -1
  6. package/client/components/accounting-category-selector.ts +136 -0
  7. package/client/components/accounting-category-view.ts +75 -0
  8. package/client/grist-editors/grist-editor-accounting-category-object.ts +83 -0
  9. package/client/grist-editors/grist-renderer-accounting-category-object.ts +13 -0
  10. package/client/pages/account/account-importer.ts +19 -8
  11. package/client/pages/account/account-list-page.ts +38 -8
  12. package/client/pages/accounting-category/accounting-category-importer.ts +19 -8
  13. package/client/pages/accounting-category/accounting-category-list-page.ts +36 -6
  14. package/client/pages/accounting-category/accounting-category-tree-page.ts +338 -0
  15. package/client/pages/accounting-document/accounting-document-importer.ts +90 -0
  16. package/client/pages/accounting-document/accounting-document-list-page.ts +398 -0
  17. package/client/pages/financial-statement/financial-statement-importer.ts +19 -8
  18. package/client/pages/financial-statement/financial-statement-list-page.ts +5 -6
  19. package/client/pages/fiscal-month/fiscal-month-importer.ts +90 -0
  20. package/client/pages/fiscal-month/fiscal-month-list-page.ts +398 -0
  21. package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +90 -0
  22. package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +398 -0
  23. package/client/pages/fiscal-year/fiscal-year-importer.ts +90 -0
  24. package/client/pages/fiscal-year/fiscal-year-list-page.ts +398 -0
  25. package/client/pages/income-statement/income-statement-importer.ts +19 -8
  26. package/client/pages/income-statement/income-statement-list-page.ts +5 -6
  27. package/client/pages/{ledger/ledger-importer.ts → payment/payment-importer.ts} +13 -9
  28. package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -58
  29. package/client/pages/transaction/transaction-importer.ts +19 -8
  30. package/client/pages/transaction/transaction-list-page.ts +5 -6
  31. package/client/route.ts +16 -8
  32. package/client/types/accounting-category.ts +23 -0
  33. package/client/types/index.ts +1 -0
  34. package/dist-client/activities/activity-book-edit.js +1 -1
  35. package/dist-client/activities/activity-book-edit.js.map +1 -1
  36. package/dist-client/activities/activity-book-view.js +1 -1
  37. package/dist-client/activities/activity-book-view.js.map +1 -1
  38. package/dist-client/activities/activity-expense-edit.js +1 -1
  39. package/dist-client/activities/activity-expense-edit.js.map +1 -1
  40. package/dist-client/activities/activity-expense-view.js +1 -1
  41. package/dist-client/activities/activity-expense-view.js.map +1 -1
  42. package/dist-client/bootstrap.js +7 -1
  43. package/dist-client/bootstrap.js.map +1 -1
  44. package/dist-client/components/accounting-category-selector.d.ts +16 -0
  45. package/dist-client/components/accounting-category-selector.js +134 -0
  46. package/dist-client/components/accounting-category-selector.js.map +1 -0
  47. package/dist-client/components/accounting-category-view.d.ts +14 -0
  48. package/dist-client/components/accounting-category-view.js +81 -0
  49. package/dist-client/components/accounting-category-view.js.map +1 -0
  50. package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
  51. package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
  52. package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
  53. package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
  54. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
  55. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
  56. package/dist-client/pages/account/account-importer.d.ts +0 -1
  57. package/dist-client/pages/account/account-importer.js +12 -5
  58. package/dist-client/pages/account/account-importer.js.map +1 -1
  59. package/dist-client/pages/account/account-list-page.js +38 -8
  60. package/dist-client/pages/account/account-list-page.js.map +1 -1
  61. package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +0 -1
  62. package/dist-client/pages/accounting-category/accounting-category-importer.js +12 -5
  63. package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -1
  64. package/dist-client/pages/accounting-category/accounting-category-list-page.js +36 -6
  65. package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
  66. package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
  67. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
  68. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
  69. package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
  70. package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
  71. package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
  72. package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
  73. package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
  74. package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
  75. package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -1
  76. package/dist-client/pages/financial-statement/financial-statement-importer.js +12 -5
  77. package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -1
  78. package/dist-client/pages/financial-statement/financial-statement-list-page.js +5 -6
  79. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -1
  80. package/dist-client/pages/fiscal-month/fiscal-month-importer.d.ts +23 -0
  81. package/dist-client/pages/fiscal-month/fiscal-month-importer.js +93 -0
  82. package/dist-client/pages/fiscal-month/fiscal-month-importer.js.map +1 -0
  83. package/dist-client/pages/fiscal-month/fiscal-month-list-page.d.ts +66 -0
  84. package/dist-client/pages/fiscal-month/fiscal-month-list-page.js +370 -0
  85. package/dist-client/pages/fiscal-month/fiscal-month-list-page.js.map +1 -0
  86. package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.d.ts +23 -0
  87. package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js +93 -0
  88. package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js.map +1 -0
  89. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.d.ts +66 -0
  90. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js +370 -0
  91. package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js.map +1 -0
  92. package/dist-client/pages/fiscal-year/fiscal-year-importer.d.ts +23 -0
  93. package/dist-client/pages/fiscal-year/fiscal-year-importer.js +93 -0
  94. package/dist-client/pages/fiscal-year/fiscal-year-importer.js.map +1 -0
  95. package/dist-client/pages/fiscal-year/fiscal-year-list-page.d.ts +66 -0
  96. package/dist-client/pages/fiscal-year/fiscal-year-list-page.js +370 -0
  97. package/dist-client/pages/fiscal-year/fiscal-year-list-page.js.map +1 -0
  98. package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -1
  99. package/dist-client/pages/income-statement/income-statement-importer.js +12 -5
  100. package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -1
  101. package/dist-client/pages/income-statement/income-statement-list-page.js +5 -6
  102. package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -1
  103. package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +2 -2
  104. package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +11 -11
  105. package/dist-client/pages/payment/payment-importer.js.map +1 -0
  106. package/dist-client/pages/{ledger/ledger-list-page.d.ts → payment/payment-list-page.d.ts} +12 -8
  107. package/dist-client/pages/{ledger/ledger-list-page.js → payment/payment-list-page.js} +114 -68
  108. package/dist-client/pages/payment/payment-list-page.js.map +1 -0
  109. package/dist-client/pages/transaction/transaction-importer.d.ts +0 -1
  110. package/dist-client/pages/transaction/transaction-importer.js +12 -5
  111. package/dist-client/pages/transaction/transaction-importer.js.map +1 -1
  112. package/dist-client/pages/transaction/transaction-list-page.js +5 -6
  113. package/dist-client/pages/transaction/transaction-list-page.js.map +1 -1
  114. package/dist-client/route.d.ts +1 -1
  115. package/dist-client/route.js +9 -3
  116. package/dist-client/route.js.map +1 -1
  117. package/dist-client/tsconfig.tsbuildinfo +1 -1
  118. package/dist-client/types/accounting-category.d.ts +16 -0
  119. package/dist-client/types/accounting-category.js +3 -0
  120. package/dist-client/types/accounting-category.js.map +1 -0
  121. package/dist-client/types/index.d.ts +1 -0
  122. package/dist-client/types/index.js +2 -0
  123. package/dist-client/types/index.js.map +1 -0
  124. package/dist-server/activities/activity-book.js +31 -19
  125. package/dist-server/activities/activity-book.js.map +1 -1
  126. package/dist-server/controllers/index.d.ts +1 -0
  127. package/dist-server/controllers/index.js +4 -0
  128. package/dist-server/controllers/index.js.map +1 -1
  129. package/dist-server/controllers/summary-statements.d.ts +4 -0
  130. package/dist-server/controllers/summary-statements.js +149 -0
  131. package/dist-server/controllers/summary-statements.js.map +1 -0
  132. package/dist-server/index.d.ts +2 -0
  133. package/dist-server/index.js +2 -0
  134. package/dist-server/index.js.map +1 -1
  135. package/dist-server/migrations/1725200507196-seed-fiscal-entities.d.ts +5 -0
  136. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +95 -0
  137. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -0
  138. package/dist-server/migrations/1725201467183-seed-accounts.d.ts +5 -0
  139. package/dist-server/migrations/1725201467183-seed-accounts.js +318 -0
  140. package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -0
  141. package/dist-server/service/account/account-history.d.ts +4 -1
  142. package/dist-server/service/account/account-history.js +17 -7
  143. package/dist-server/service/account/account-history.js.map +1 -1
  144. package/dist-server/service/account/account-mutation.js +13 -9
  145. package/dist-server/service/account/account-mutation.js.map +1 -1
  146. package/dist-server/service/account/account-query.js +3 -1
  147. package/dist-server/service/account/account-query.js.map +1 -1
  148. package/dist-server/service/account/account.d.ts +1 -1
  149. package/dist-server/service/account/account.js +16 -5
  150. package/dist-server/service/account/account.js.map +1 -1
  151. package/dist-server/service/account/index.d.ts +1 -2
  152. package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
  153. package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
  154. package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
  155. package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
  156. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  157. package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
  158. package/dist-server/service/accounting-category/accounting-category-query.js +24 -1
  159. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
  160. package/dist-server/service/accounting-category/accounting-category-type.d.ts +2 -0
  161. package/dist-server/service/accounting-category/accounting-category-type.js +8 -0
  162. package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -1
  163. package/dist-server/service/accounting-category/accounting-category.d.ts +2 -0
  164. package/dist-server/service/accounting-category/accounting-category.js +20 -3
  165. package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
  166. package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
  167. package/dist-server/service/accounting-category/event-subscriber.js +21 -0
  168. package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
  169. package/dist-server/service/accounting-category/index.d.ts +2 -1
  170. package/dist-server/service/accounting-category/index.js +4 -2
  171. package/dist-server/service/accounting-category/index.js.map +1 -1
  172. package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
  173. package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
  174. package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
  175. package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
  176. package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
  177. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
  178. package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
  179. package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
  180. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
  181. package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
  182. package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
  183. package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
  184. package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
  185. package/dist-server/service/accounting-document/accounting-document.js +104 -0
  186. package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
  187. package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
  188. package/dist-server/service/accounting-document/event-subscriber.js +21 -0
  189. package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
  190. package/dist-server/service/accounting-document/index.d.ts +7 -0
  191. package/dist-server/service/accounting-document/index.js +12 -0
  192. package/dist-server/service/accounting-document/index.js.map +1 -0
  193. package/dist-server/service/common-type.d.ts +5 -0
  194. package/dist-server/service/common-type.js +15 -0
  195. package/dist-server/service/common-type.js.map +1 -0
  196. package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
  197. package/dist-server/service/financial-statement/financial-statement-history.js +33 -23
  198. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  199. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
  200. package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
  201. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
  202. package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
  203. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  204. package/dist-server/service/financial-statement/financial-statement-query.js +3 -1
  205. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  206. package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
  207. package/dist-server/service/financial-statement/financial-statement.js +45 -24
  208. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  209. package/dist-server/service/financial-statement/index.d.ts +2 -2
  210. package/dist-server/service/financial-statement/index.js +2 -1
  211. package/dist-server/service/financial-statement/index.js.map +1 -1
  212. package/dist-server/service/fiscal-month/fiscal-month-mutation.d.ts +10 -0
  213. package/dist-server/service/fiscal-month/fiscal-month-mutation.js +134 -0
  214. package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -0
  215. package/dist-server/service/fiscal-month/fiscal-month-query.d.ts +11 -0
  216. package/dist-server/service/fiscal-month/fiscal-month-query.js +83 -0
  217. package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -0
  218. package/dist-server/service/fiscal-month/fiscal-month-type.d.ts +26 -0
  219. package/dist-server/service/fiscal-month/fiscal-month-type.js +98 -0
  220. package/dist-server/service/fiscal-month/fiscal-month-type.js.map +1 -0
  221. package/dist-server/service/fiscal-month/fiscal-month.d.ts +22 -0
  222. package/dist-server/service/fiscal-month/fiscal-month.js +99 -0
  223. package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -0
  224. package/dist-server/service/fiscal-month/index.d.ts +6 -0
  225. package/dist-server/service/fiscal-month/index.js +10 -0
  226. package/dist-server/service/fiscal-month/index.js.map +1 -0
  227. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.d.ts +10 -0
  228. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +134 -0
  229. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -0
  230. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.d.ts +11 -0
  231. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +85 -0
  232. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -0
  233. package/dist-server/service/fiscal-quarter/fiscal-quarter-type.d.ts +24 -0
  234. package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js +90 -0
  235. package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js.map +1 -0
  236. package/dist-server/service/fiscal-quarter/fiscal-quarter.d.ts +21 -0
  237. package/dist-server/service/fiscal-quarter/fiscal-quarter.js +94 -0
  238. package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -0
  239. package/dist-server/service/fiscal-quarter/index.d.ts +6 -0
  240. package/dist-server/service/fiscal-quarter/index.js +10 -0
  241. package/dist-server/service/fiscal-quarter/index.js.map +1 -0
  242. package/dist-server/service/fiscal-year/fiscal-year-mutation.d.ts +10 -0
  243. package/dist-server/service/fiscal-year/fiscal-year-mutation.js +134 -0
  244. package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -0
  245. package/dist-server/service/fiscal-year/fiscal-year-query.d.ts +11 -0
  246. package/dist-server/service/fiscal-year/fiscal-year-query.js +81 -0
  247. package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -0
  248. package/dist-server/service/fiscal-year/fiscal-year-type.d.ts +22 -0
  249. package/dist-server/service/fiscal-year/fiscal-year-type.js +82 -0
  250. package/dist-server/service/fiscal-year/fiscal-year-type.js.map +1 -0
  251. package/dist-server/service/fiscal-year/fiscal-year.d.ts +20 -0
  252. package/dist-server/service/fiscal-year/fiscal-year.js +89 -0
  253. package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -0
  254. package/dist-server/service/fiscal-year/index.d.ts +6 -0
  255. package/dist-server/service/fiscal-year/index.js +10 -0
  256. package/dist-server/service/fiscal-year/index.js.map +1 -0
  257. package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
  258. package/dist-server/service/income-statement/income-statement-history.js +38 -23
  259. package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
  260. package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
  261. package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
  262. package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
  263. package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
  264. package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
  265. package/dist-server/service/income-statement/income-statement-query.js +3 -1
  266. package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
  267. package/dist-server/service/income-statement/income-statement.d.ts +2 -0
  268. package/dist-server/service/income-statement/income-statement.js +46 -26
  269. package/dist-server/service/income-statement/income-statement.js.map +1 -1
  270. package/dist-server/service/income-statement/index.d.ts +2 -2
  271. package/dist-server/service/income-statement/index.js +2 -1
  272. package/dist-server/service/income-statement/index.js.map +1 -1
  273. package/dist-server/service/index.d.ts +7 -2
  274. package/dist-server/service/index.js +29 -3
  275. package/dist-server/service/index.js.map +1 -1
  276. package/dist-server/service/payment/event-subscriber.d.ts +7 -0
  277. package/dist-server/service/payment/event-subscriber.js +21 -0
  278. package/dist-server/service/payment/event-subscriber.js.map +1 -0
  279. package/dist-server/service/payment/index.d.ts +8 -0
  280. package/dist-server/service/payment/index.js +12 -0
  281. package/dist-server/service/payment/index.js.map +1 -0
  282. package/dist-server/service/payment/payment-history.d.ts +30 -0
  283. package/dist-server/service/payment/payment-history.js +143 -0
  284. package/dist-server/service/payment/payment-history.js.map +1 -0
  285. package/dist-server/service/payment/payment-mutation.d.ts +10 -0
  286. package/dist-server/service/payment/payment-mutation.js +134 -0
  287. package/dist-server/service/payment/payment-mutation.js.map +1 -0
  288. package/dist-server/service/payment/payment-query.d.ts +11 -0
  289. package/dist-server/service/payment/payment-query.js +81 -0
  290. package/dist-server/service/payment/payment-query.js.map +1 -0
  291. package/dist-server/service/payment/payment-type.d.ts +24 -0
  292. package/dist-server/service/payment/payment-type.js +90 -0
  293. package/dist-server/service/payment/payment-type.js.map +1 -0
  294. package/dist-server/service/payment/payment.d.ts +30 -0
  295. package/dist-server/service/payment/payment.js +146 -0
  296. package/dist-server/service/payment/payment.js.map +1 -0
  297. package/dist-server/service/transaction/transaction-history.d.ts +15 -3
  298. package/dist-server/service/transaction/transaction-history.js +64 -8
  299. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  300. package/dist-server/service/transaction/transaction-mutation.js +13 -9
  301. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  302. package/dist-server/service/transaction/transaction-query.js +3 -1
  303. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  304. package/dist-server/service/transaction/transaction.d.ts +31 -6
  305. package/dist-server/service/transaction/transaction.js +138 -27
  306. package/dist-server/service/transaction/transaction.js.map +1 -1
  307. package/dist-server/tsconfig.tsbuildinfo +1 -1
  308. package/helps/accounting/accounting-document.md +160 -0
  309. package/helps/accounting/contract.md +160 -0
  310. package/helps/accounting/fiscal-month.md +160 -0
  311. package/helps/accounting/fiscal-quarter.md +160 -0
  312. package/helps/accounting/fiscal-year.md +160 -0
  313. package/helps/accounting/payment.md +160 -0
  314. package/package.json +9 -8
  315. package/server/activities/activity-book.ts +31 -19
  316. package/server/controllers/index.ts +1 -0
  317. package/server/controllers/summary-statements.ts +166 -0
  318. package/server/index.ts +2 -0
  319. package/server/migrations/1725200507196-seed-fiscal-entities.ts +106 -0
  320. package/server/migrations/1725201467183-seed-accounts.ts +339 -0
  321. package/server/service/account/account-history.ts +15 -7
  322. package/server/service/account/account-mutation.ts +13 -10
  323. package/server/service/account/account-query.ts +3 -1
  324. package/server/service/account/account.ts +16 -5
  325. package/server/service/accounting-category/accounting-category-history.ts +123 -0
  326. package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
  327. package/server/service/accounting-category/accounting-category-query.ts +24 -1
  328. package/server/service/accounting-category/accounting-category-type.ts +6 -0
  329. package/server/service/accounting-category/accounting-category.ts +23 -3
  330. package/server/service/accounting-category/event-subscriber.ts +20 -0
  331. package/server/service/accounting-category/index.ts +4 -2
  332. package/server/service/accounting-document/accounting-document-history.ts +117 -0
  333. package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
  334. package/server/service/accounting-document/accounting-document-query.ts +48 -0
  335. package/server/service/accounting-document/accounting-document-type.ts +52 -0
  336. package/server/service/accounting-document/accounting-document.ts +93 -0
  337. package/server/service/accounting-document/event-subscriber.ts +17 -0
  338. package/server/service/accounting-document/index.ts +9 -0
  339. package/server/service/common-type.ts +12 -0
  340. package/server/service/financial-statement/financial-statement-history.ts +28 -19
  341. package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
  342. package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
  343. package/server/service/financial-statement/financial-statement-query.ts +3 -1
  344. package/server/service/financial-statement/financial-statement.ts +52 -36
  345. package/server/service/financial-statement/index.ts +2 -1
  346. package/server/service/fiscal-month/fiscal-month-mutation.ts +145 -0
  347. package/server/service/fiscal-month/fiscal-month-query.ts +58 -0
  348. package/server/service/fiscal-month/fiscal-month-type.ts +66 -0
  349. package/server/service/fiscal-month/fiscal-month.ts +84 -0
  350. package/server/service/fiscal-month/index.ts +7 -0
  351. package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +148 -0
  352. package/server/service/fiscal-quarter/fiscal-quarter-query.ts +60 -0
  353. package/server/service/fiscal-quarter/fiscal-quarter-type.ts +60 -0
  354. package/server/service/fiscal-quarter/fiscal-quarter.ts +80 -0
  355. package/server/service/fiscal-quarter/index.ts +7 -0
  356. package/server/service/fiscal-year/fiscal-year-mutation.ts +145 -0
  357. package/server/service/fiscal-year/fiscal-year-query.ts +53 -0
  358. package/server/service/fiscal-year/fiscal-year-type.ts +54 -0
  359. package/server/service/fiscal-year/fiscal-year.ts +76 -0
  360. package/server/service/fiscal-year/index.ts +7 -0
  361. package/server/service/income-statement/income-statement-history.ts +31 -18
  362. package/server/service/income-statement/income-statement-line-item.ts +84 -0
  363. package/server/service/income-statement/income-statement-mutation.ts +12 -10
  364. package/server/service/income-statement/income-statement-query.ts +3 -4
  365. package/server/service/income-statement/income-statement.ts +54 -39
  366. package/server/service/income-statement/index.ts +2 -1
  367. package/server/service/index.ts +49 -3
  368. package/server/service/payment/event-subscriber.ts +17 -0
  369. package/server/service/payment/index.ts +9 -0
  370. package/server/service/payment/payment-history.ts +126 -0
  371. package/server/service/payment/payment-mutation.ts +139 -0
  372. package/server/service/payment/payment-query.ts +50 -0
  373. package/server/service/payment/payment-type.ts +64 -0
  374. package/server/service/payment/payment.ts +123 -0
  375. package/server/service/transaction/transaction-history.ts +54 -10
  376. package/server/service/transaction/transaction-mutation.ts +13 -10
  377. package/server/service/transaction/transaction-query.ts +3 -4
  378. package/server/service/transaction/transaction.ts +144 -29
  379. package/things-factory.config.js +3 -2
  380. package/translations/en.json +9 -1
  381. package/translations/ja.json +9 -1
  382. package/translations/ko.json +9 -1
  383. package/translations/ms.json +9 -1
  384. package/translations/zh.json +9 -1
  385. package/client/pages/main.ts +0 -24
  386. package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
  387. package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
  388. package/dist-client/pages/main.d.ts +0 -1
  389. package/dist-client/pages/main.js +0 -27
  390. package/dist-client/pages/main.js.map +0 -1
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalQuarterQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const fiscal_quarter_1 = require("./fiscal-quarter");
9
+ const fiscal_quarter_type_1 = require("./fiscal-quarter-type");
10
+ let FiscalQuarterQuery = class FiscalQuarterQuery {
11
+ async fiscalQuarter(year, quarter, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(fiscal_quarter_1.FiscalQuarter).findOne({
14
+ where: { domain: { id: domain.id }, year, quarter }
15
+ });
16
+ }
17
+ async fiscalQuarters(params, context) {
18
+ const { domain } = context.state;
19
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
20
+ domain,
21
+ params,
22
+ repository: await (0, shell_1.getRepository)(fiscal_quarter_1.FiscalQuarter),
23
+ searchables: []
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(fiscalQuarter) {
29
+ return fiscalQuarter.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: fiscalQuarter.domainId }));
30
+ }
31
+ async updater(fiscalQuarter) {
32
+ return fiscalQuarter.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fiscalQuarter.updaterId }));
33
+ }
34
+ async creator(fiscalQuarter) {
35
+ return fiscalQuarter.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fiscalQuarter.creatorId }));
36
+ }
37
+ };
38
+ exports.FiscalQuarterQuery = FiscalQuarterQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
41
+ (0, type_graphql_1.Query)(returns => fiscal_quarter_1.FiscalQuarter, {
42
+ nullable: true,
43
+ description: 'To fetch a FiscalQuarter by year and quarter number'
44
+ }),
45
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('year')),
46
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('quarter')),
47
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
48
+ tslib_1.__metadata("design:type", Function),
49
+ tslib_1.__metadata("design:paramtypes", [Number, Number, Object]),
50
+ tslib_1.__metadata("design:returntype", Promise)
51
+ ], FiscalQuarterQuery.prototype, "fiscalQuarter", null);
52
+ tslib_1.__decorate([
53
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
54
+ (0, type_graphql_1.Query)(returns => fiscal_quarter_type_1.FiscalQuarterList, { description: 'To fetch multiple FiscalQuarters' }),
55
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
56
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
57
+ tslib_1.__metadata("design:type", Function),
58
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
59
+ tslib_1.__metadata("design:returntype", Promise)
60
+ ], FiscalQuarterQuery.prototype, "fiscalQuarters", null);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
63
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
64
+ tslib_1.__metadata("design:type", Function),
65
+ tslib_1.__metadata("design:paramtypes", [fiscal_quarter_1.FiscalQuarter]),
66
+ tslib_1.__metadata("design:returntype", Promise)
67
+ ], FiscalQuarterQuery.prototype, "domain", null);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
70
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [fiscal_quarter_1.FiscalQuarter]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], FiscalQuarterQuery.prototype, "updater", null);
75
+ tslib_1.__decorate([
76
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
77
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
78
+ tslib_1.__metadata("design:type", Function),
79
+ tslib_1.__metadata("design:paramtypes", [fiscal_quarter_1.FiscalQuarter]),
80
+ tslib_1.__metadata("design:returntype", Promise)
81
+ ], FiscalQuarterQuery.prototype, "creator", null);
82
+ exports.FiscalQuarterQuery = FiscalQuarterQuery = tslib_1.__decorate([
83
+ (0, type_graphql_1.Resolver)(fiscal_quarter_1.FiscalQuarter)
84
+ ], FiscalQuarterQuery);
85
+ //# sourceMappingURL=fiscal-quarter-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiscal-quarter-query.js","sourceRoot":"","sources":["../../../server/service/fiscal-quarter/fiscal-quarter-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,qDAAgD;AAChD,+DAAyD;AAGlD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAMvB,AAAN,KAAK,CAAC,aAAa,CACJ,IAAY,EACT,OAAe,EACxB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,8BAAa,CAAC,CAAC,OAAO,CAAC;YAChD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACpD,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,cAAc,CACO,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,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CAAA;IACd,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAOP;AAIK;IAFL,IAAA,wBAAS,EAAC,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,uCAAiB,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAEtF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;wDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,8BAAa;;gDAEhD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,8BAAa;;iDAEjD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAgB,8BAAa;;iDAEjD;6BAnDU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAoD9B","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 { FiscalQuarter } from './fiscal-quarter'\nimport { FiscalQuarterList } from './fiscal-quarter-type'\n\n@Resolver(FiscalQuarter)\nexport class FiscalQuarterQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalQuarter!, {\n nullable: true,\n description: 'To fetch a FiscalQuarter by year and quarter number'\n })\n async fiscalQuarter(\n @Arg('year') year: number,\n @Arg('quarter') quarter: number,\n @Ctx() context: ResolverContext\n ): Promise<FiscalQuarter | undefined> {\n const { domain } = context.state\n\n return await getRepository(FiscalQuarter).findOne({\n where: { domain: { id: domain.id }, year, quarter }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalQuarterList, { description: 'To fetch multiple FiscalQuarters' })\n async fiscalQuarters(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FiscalQuarterList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FiscalQuarter),\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() fiscalQuarter: FiscalQuarter): Promise<Domain> {\n return fiscalQuarter.domainId && (await getRepository(Domain).findOneBy({ id: fiscalQuarter.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fiscalQuarter: FiscalQuarter): Promise<User> {\n return fiscalQuarter.updaterId && (await getRepository(User).findOneBy({ id: fiscalQuarter.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fiscalQuarter: FiscalQuarter): Promise<User> {\n return fiscalQuarter.creatorId && (await getRepository(User).findOneBy({ id: fiscalQuarter.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { FiscalStatus } from '../common-type';
2
+ import { FiscalQuarter } from './fiscal-quarter';
3
+ export declare class NewFiscalQuarter {
4
+ year: number;
5
+ quarter: number;
6
+ startDate: string;
7
+ endDate: string;
8
+ status?: FiscalStatus;
9
+ notes?: string;
10
+ }
11
+ export declare class FiscalQuarterPatch {
12
+ id?: string;
13
+ year?: number;
14
+ quarter?: number;
15
+ startDate: string;
16
+ endDate: string;
17
+ status?: FiscalStatus;
18
+ notes?: string;
19
+ cuFlag?: string;
20
+ }
21
+ export declare class FiscalQuarterList {
22
+ items: FiscalQuarter[];
23
+ total: number;
24
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalQuarterList = exports.FiscalQuarterPatch = exports.NewFiscalQuarter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const common_type_1 = require("../common-type");
7
+ const fiscal_quarter_1 = require("./fiscal-quarter");
8
+ let NewFiscalQuarter = class NewFiscalQuarter {
9
+ };
10
+ exports.NewFiscalQuarter = NewFiscalQuarter;
11
+ tslib_1.__decorate([
12
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
13
+ tslib_1.__metadata("design:type", Number)
14
+ ], NewFiscalQuarter.prototype, "year", void 0);
15
+ tslib_1.__decorate([
16
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
17
+ tslib_1.__metadata("design:type", Number)
18
+ ], NewFiscalQuarter.prototype, "quarter", void 0);
19
+ tslib_1.__decorate([
20
+ (0, type_graphql_1.Field)(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' }),
21
+ tslib_1.__metadata("design:type", String)
22
+ ], NewFiscalQuarter.prototype, "startDate", void 0);
23
+ tslib_1.__decorate([
24
+ (0, type_graphql_1.Field)(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' }),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], NewFiscalQuarter.prototype, "endDate", void 0);
27
+ tslib_1.__decorate([
28
+ (0, type_graphql_1.Field)(type => common_type_1.FiscalStatus, { nullable: true }),
29
+ tslib_1.__metadata("design:type", String)
30
+ ], NewFiscalQuarter.prototype, "status", void 0);
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.Field)({ nullable: true }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], NewFiscalQuarter.prototype, "notes", void 0);
35
+ exports.NewFiscalQuarter = NewFiscalQuarter = tslib_1.__decorate([
36
+ (0, type_graphql_1.InputType)()
37
+ ], NewFiscalQuarter);
38
+ let FiscalQuarterPatch = class FiscalQuarterPatch {
39
+ };
40
+ exports.FiscalQuarterPatch = FiscalQuarterPatch;
41
+ tslib_1.__decorate([
42
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], FiscalQuarterPatch.prototype, "id", void 0);
45
+ tslib_1.__decorate([
46
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
47
+ tslib_1.__metadata("design:type", Number)
48
+ ], FiscalQuarterPatch.prototype, "year", void 0);
49
+ tslib_1.__decorate([
50
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
51
+ tslib_1.__metadata("design:type", Number)
52
+ ], FiscalQuarterPatch.prototype, "quarter", void 0);
53
+ tslib_1.__decorate([
54
+ (0, type_graphql_1.Field)(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' }),
55
+ tslib_1.__metadata("design:type", String)
56
+ ], FiscalQuarterPatch.prototype, "startDate", void 0);
57
+ tslib_1.__decorate([
58
+ (0, type_graphql_1.Field)(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' }),
59
+ tslib_1.__metadata("design:type", String)
60
+ ], FiscalQuarterPatch.prototype, "endDate", void 0);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.Field)(type => common_type_1.FiscalStatus, { nullable: true }),
63
+ tslib_1.__metadata("design:type", String)
64
+ ], FiscalQuarterPatch.prototype, "status", void 0);
65
+ tslib_1.__decorate([
66
+ (0, type_graphql_1.Field)({ nullable: true }),
67
+ tslib_1.__metadata("design:type", String)
68
+ ], FiscalQuarterPatch.prototype, "notes", void 0);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.Field)({ nullable: true }),
71
+ tslib_1.__metadata("design:type", String)
72
+ ], FiscalQuarterPatch.prototype, "cuFlag", void 0);
73
+ exports.FiscalQuarterPatch = FiscalQuarterPatch = tslib_1.__decorate([
74
+ (0, type_graphql_1.InputType)()
75
+ ], FiscalQuarterPatch);
76
+ let FiscalQuarterList = class FiscalQuarterList {
77
+ };
78
+ exports.FiscalQuarterList = FiscalQuarterList;
79
+ tslib_1.__decorate([
80
+ (0, type_graphql_1.Field)(type => [fiscal_quarter_1.FiscalQuarter]),
81
+ tslib_1.__metadata("design:type", Array)
82
+ ], FiscalQuarterList.prototype, "items", void 0);
83
+ tslib_1.__decorate([
84
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
85
+ tslib_1.__metadata("design:type", Number)
86
+ ], FiscalQuarterList.prototype, "total", void 0);
87
+ exports.FiscalQuarterList = FiscalQuarterList = tslib_1.__decorate([
88
+ (0, type_graphql_1.ObjectType)()
89
+ ], FiscalQuarterList);
90
+ //# sourceMappingURL=fiscal-quarter-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiscal-quarter-type.js","sourceRoot":"","sources":["../../../server/service/fiscal-quarter/fiscal-quarter-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,gDAA6C;AAC7C,qDAAgD;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAkB5B,CAAA;AAlBY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACP;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;iDACJ;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;;mDACjF;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;;iDACjF;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC3B;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+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C,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;gDACN;4BALF,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAM7B","sourcesContent":["import { InputType, Field, Int, ID, ObjectType } from 'type-graphql'\nimport { FiscalStatus } from '../common-type'\nimport { FiscalQuarter } from './fiscal-quarter'\n\n@InputType()\nexport class NewFiscalQuarter {\n @Field(type => Int)\n year: number // 회계연도 (예: 2023)\n\n @Field(type => Int)\n quarter: number // 1, 2, 3, 4 분기\n\n @Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })\n startDate: string // 월의 시작일\n\n @Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })\n endDate: string // 월의 종료일\n\n @Field(type => FiscalStatus, { nullable: true })\n status?: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)\n\n @Field({ nullable: true })\n notes?: string // 분기에 대한 설명이나 주석\n}\n\n@InputType()\nexport class FiscalQuarterPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field(type => Int, { nullable: true })\n year?: number // 회계연도 (예: 2023)\n\n @Field(type => Int, { nullable: true })\n quarter?: number // 1, 2, 3, 4 분기\n\n @Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })\n startDate: string // 월의 시작일\n\n @Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })\n endDate: string // 월의 종료일\n\n @Field(type => FiscalStatus, { nullable: true })\n status?: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)\n\n @Field({ nullable: true })\n notes?: string // 분기에 대한 설명이나 주석\n\n @Field({ nullable: true })\n cuFlag?: string // Create/Update Flag\n}\n\n@ObjectType()\nexport class FiscalQuarterList {\n @Field(type => [FiscalQuarter])\n items: FiscalQuarter[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { FiscalStatus } from '../common-type';
4
+ export declare class FiscalQuarter {
5
+ readonly id: string;
6
+ domain?: Domain;
7
+ domainId?: string;
8
+ year: number;
9
+ quarter: number;
10
+ startDate: string;
11
+ endDate: string;
12
+ status: FiscalStatus;
13
+ notes?: string;
14
+ createdAt?: Date;
15
+ updatedAt?: Date;
16
+ deletedAt?: Date;
17
+ creator?: User;
18
+ creatorId?: string;
19
+ updater?: User;
20
+ updaterId?: string;
21
+ }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalQuarter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ const common_type_1 = require("../common-type");
10
+ let FiscalQuarter = class FiscalQuarter {
11
+ };
12
+ exports.FiscalQuarter = FiscalQuarter;
13
+ tslib_1.__decorate([
14
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
15
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], FiscalQuarter.prototype, "id", void 0);
18
+ tslib_1.__decorate([
19
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
20
+ (0, type_graphql_1.Field)({ nullable: true }),
21
+ tslib_1.__metadata("design:type", shell_1.Domain)
22
+ ], FiscalQuarter.prototype, "domain", void 0);
23
+ tslib_1.__decorate([
24
+ (0, typeorm_1.RelationId)((fiscalQuarter) => fiscalQuarter.domain),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], FiscalQuarter.prototype, "domainId", void 0);
27
+ tslib_1.__decorate([
28
+ (0, typeorm_1.Column)(),
29
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The fiscal year (e.g., 2023)' }),
30
+ tslib_1.__metadata("design:type", Number)
31
+ ], FiscalQuarter.prototype, "year", void 0);
32
+ tslib_1.__decorate([
33
+ (0, typeorm_1.Column)(),
34
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The quarter number (1, 2, 3, or 4)' }),
35
+ tslib_1.__metadata("design:type", Number)
36
+ ], FiscalQuarter.prototype, "quarter", void 0);
37
+ tslib_1.__decorate([
38
+ (0, typeorm_1.Column)(),
39
+ (0, type_graphql_1.Field)(type => String, { description: 'The start date of the fiscal quarter in YYYY-MM-DD format' }),
40
+ tslib_1.__metadata("design:type", String)
41
+ ], FiscalQuarter.prototype, "startDate", void 0);
42
+ tslib_1.__decorate([
43
+ (0, typeorm_1.Column)(),
44
+ (0, type_graphql_1.Field)(type => String, { description: 'The end date of the fiscal quarter in YYYY-MM-DD format' }),
45
+ tslib_1.__metadata("design:type", String)
46
+ ], FiscalQuarter.prototype, "endDate", void 0);
47
+ tslib_1.__decorate([
48
+ (0, typeorm_1.Column)({ default: common_type_1.FiscalStatus.OPEN }),
49
+ (0, type_graphql_1.Field)(type => common_type_1.FiscalStatus, { description: 'The status of the fiscal quarter (OPEN, CLOSED, FINALIZED)' }),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], FiscalQuarter.prototype, "status", void 0);
52
+ tslib_1.__decorate([
53
+ (0, typeorm_1.Column)({ nullable: true }),
54
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes or comments about the fiscal quarter' }),
55
+ tslib_1.__metadata("design:type", String)
56
+ ], FiscalQuarter.prototype, "notes", void 0);
57
+ tslib_1.__decorate([
58
+ (0, typeorm_1.CreateDateColumn)(),
59
+ (0, type_graphql_1.Field)({ nullable: true }),
60
+ tslib_1.__metadata("design:type", Date)
61
+ ], FiscalQuarter.prototype, "createdAt", void 0);
62
+ tslib_1.__decorate([
63
+ (0, typeorm_1.UpdateDateColumn)(),
64
+ (0, type_graphql_1.Field)({ nullable: true }),
65
+ tslib_1.__metadata("design:type", Date)
66
+ ], FiscalQuarter.prototype, "updatedAt", void 0);
67
+ tslib_1.__decorate([
68
+ (0, typeorm_1.DeleteDateColumn)(),
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ tslib_1.__metadata("design:type", Date)
71
+ ], FiscalQuarter.prototype, "deletedAt", void 0);
72
+ tslib_1.__decorate([
73
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
74
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
75
+ tslib_1.__metadata("design:type", auth_base_1.User)
76
+ ], FiscalQuarter.prototype, "creator", void 0);
77
+ tslib_1.__decorate([
78
+ (0, typeorm_1.RelationId)((fiscalQuarter) => fiscalQuarter.creator),
79
+ tslib_1.__metadata("design:type", String)
80
+ ], FiscalQuarter.prototype, "creatorId", void 0);
81
+ tslib_1.__decorate([
82
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
83
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
84
+ tslib_1.__metadata("design:type", auth_base_1.User)
85
+ ], FiscalQuarter.prototype, "updater", void 0);
86
+ tslib_1.__decorate([
87
+ (0, typeorm_1.RelationId)((fiscalQuarter) => fiscalQuarter.updater),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], FiscalQuarter.prototype, "updaterId", void 0);
90
+ exports.FiscalQuarter = FiscalQuarter = tslib_1.__decorate([
91
+ (0, type_graphql_1.ObjectType)({ description: 'Entity representing a fiscal quarter' }),
92
+ (0, typeorm_1.Entity)()
93
+ ], FiscalQuarter);
94
+ //# sourceMappingURL=fiscal-quarter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiscal-quarter.js","sourceRoot":"","sources":["../../../server/service/fiscal-quarter/fiscal-quarter.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAyD;AACzD,iDAA8C;AAC9C,yDAAgD;AAChD,gDAA6C;AAItC,IAAM,aAAa,GAAnB,MAAM,aAAa;CA6DzB,CAAA;AA7DY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B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typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FiscalStatus } from '../common-type'\n\n@ObjectType({ description: 'Entity representing a fiscal quarter' })\n@Entity()\nexport class FiscalQuarter {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((fiscalQuarter: FiscalQuarter) => fiscalQuarter.domain)\n domainId?: string\n\n @Column()\n @Field(type => Int, { description: 'The fiscal year (e.g., 2023)' })\n year: number // 회계연도 (예: 2023)\n\n @Column()\n @Field(type => Int, { description: 'The quarter number (1, 2, 3, or 4)' })\n quarter: number // 1, 2, 3, 4 분기\n\n @Column()\n @Field(type => String, { description: 'The start date of the fiscal quarter in YYYY-MM-DD format' })\n startDate: string // 분기 시작일\n\n @Column()\n @Field(type => String, { description: 'The end date of the fiscal quarter in YYYY-MM-DD format' })\n endDate: string // 분기 종료일\n\n @Column({ default: FiscalStatus.OPEN })\n @Field(type => FiscalStatus, { description: 'The status of the fiscal quarter (OPEN, CLOSED, FINALIZED)' })\n status: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Notes or comments about the fiscal quarter' })\n notes?: string // 분기에 대한 설명이나 주석\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((fiscalQuarter: FiscalQuarter) => fiscalQuarter.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((fiscalQuarter: FiscalQuarter) => fiscalQuarter.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { FiscalQuarter } from './fiscal-quarter';
2
+ import { FiscalQuarterQuery } from './fiscal-quarter-query';
3
+ import { FiscalQuarterMutation } from './fiscal-quarter-mutation';
4
+ export declare const entities: (typeof FiscalQuarter)[];
5
+ export declare const resolvers: (typeof FiscalQuarterQuery | typeof FiscalQuarterMutation)[];
6
+ export declare const subscribers: any[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribers = exports.resolvers = exports.entities = void 0;
4
+ const fiscal_quarter_1 = require("./fiscal-quarter");
5
+ const fiscal_quarter_query_1 = require("./fiscal-quarter-query");
6
+ const fiscal_quarter_mutation_1 = require("./fiscal-quarter-mutation");
7
+ exports.entities = [fiscal_quarter_1.FiscalQuarter];
8
+ exports.resolvers = [fiscal_quarter_query_1.FiscalQuarterQuery, fiscal_quarter_mutation_1.FiscalQuarterMutation];
9
+ exports.subscribers = [];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/fiscal-quarter/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,iEAA2D;AAC3D,uEAAiE;AAEpD,QAAA,QAAQ,GAAG,CAAC,8BAAa,CAAC,CAAA;AAC1B,QAAA,SAAS,GAAG,CAAC,yCAAkB,EAAE,+CAAqB,CAAC,CAAA;AACvD,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { FiscalQuarter } from './fiscal-quarter'\nimport { FiscalQuarterQuery } from './fiscal-quarter-query'\nimport { FiscalQuarterMutation } from './fiscal-quarter-mutation'\n\nexport const entities = [FiscalQuarter]\nexport const resolvers = [FiscalQuarterQuery, FiscalQuarterMutation]\nexport const subscribers = []\n"]}
@@ -0,0 +1,10 @@
1
+ import { FiscalYear } from './fiscal-year';
2
+ import { NewFiscalYear, FiscalYearPatch } from './fiscal-year-type';
3
+ export declare class FiscalYearMutation {
4
+ createFiscalYear(fiscalYear: NewFiscalYear, context: ResolverContext): Promise<FiscalYear>;
5
+ updateFiscalYear(id: string, patch: FiscalYearPatch, context: ResolverContext): Promise<FiscalYear>;
6
+ updateMultipleFiscalYear(patches: FiscalYearPatch[], context: ResolverContext): Promise<FiscalYear[]>;
7
+ deleteFiscalYear(id: string, context: ResolverContext): Promise<boolean>;
8
+ deleteFiscalYears(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ importFiscalYears(fiscalYears: FiscalYearPatch[], context: ResolverContext): Promise<boolean>;
10
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalYearMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const fiscal_year_1 = require("./fiscal-year");
9
+ const fiscal_year_type_1 = require("./fiscal-year-type");
10
+ let FiscalYearMutation = class FiscalYearMutation {
11
+ async createFiscalYear(fiscalYear, context) {
12
+ const { domain, user, tx } = context.state;
13
+ const result = await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx).save(Object.assign(Object.assign({}, fiscalYear), { domain, creator: user, updater: user }));
14
+ return result;
15
+ }
16
+ async updateFiscalYear(id, patch, context) {
17
+ const { domain, user, tx } = context.state;
18
+ const repository = (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx);
19
+ const fiscalYear = await repository.findOne({
20
+ where: { domain: { id: domain.id }, id }
21
+ });
22
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, fiscalYear), patch), { updater: user }));
23
+ return result;
24
+ }
25
+ async updateMultipleFiscalYear(patches, context) {
26
+ const { domain, user, tx } = context.state;
27
+ let results = [];
28
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
29
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
30
+ const fiscalYearRepo = (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx);
31
+ if (_createRecords.length > 0) {
32
+ for (let i = 0; i < _createRecords.length; i++) {
33
+ const newRecord = _createRecords[i];
34
+ const result = await fiscalYearRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
35
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
36
+ }
37
+ }
38
+ if (_updateRecords.length > 0) {
39
+ for (let i = 0; i < _updateRecords.length; i++) {
40
+ const updateRecord = _updateRecords[i];
41
+ const fiscalYear = await fiscalYearRepo.findOneBy({ id: updateRecord.id });
42
+ const result = await fiscalYearRepo.save(Object.assign(Object.assign(Object.assign({}, fiscalYear), updateRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteFiscalYear(id, context) {
49
+ const { domain, tx } = context.state;
50
+ await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx).delete({ domain: { id: domain.id }, id });
51
+ return true;
52
+ }
53
+ async deleteFiscalYears(ids, context) {
54
+ const { domain, tx } = context.state;
55
+ await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx).delete({
56
+ domain: { id: domain.id },
57
+ id: (0, typeorm_1.In)(ids)
58
+ });
59
+ return true;
60
+ }
61
+ async importFiscalYears(fiscalYears, context) {
62
+ const { domain, tx } = context.state;
63
+ await Promise.all(fiscalYears.map(async (fiscalYear) => {
64
+ const createdFiscalYear = await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear, tx).save(Object.assign({ domain }, fiscalYear));
65
+ }));
66
+ return true;
67
+ }
68
+ };
69
+ exports.FiscalYearMutation = FiscalYearMutation;
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
73
+ (0, type_graphql_1.Mutation)(returns => fiscal_year_1.FiscalYear, { description: 'To create new FiscalYear' }),
74
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalYear')),
75
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
76
+ tslib_1.__metadata("design:type", Function),
77
+ tslib_1.__metadata("design:paramtypes", [fiscal_year_type_1.NewFiscalYear, Object]),
78
+ tslib_1.__metadata("design:returntype", Promise)
79
+ ], FiscalYearMutation.prototype, "createFiscalYear", null);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.Directive)('@transaction'),
82
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
83
+ (0, type_graphql_1.Mutation)(returns => fiscal_year_1.FiscalYear, { description: 'To modify FiscalYear information' }),
84
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
85
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
86
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
87
+ tslib_1.__metadata("design:type", Function),
88
+ tslib_1.__metadata("design:paramtypes", [String, fiscal_year_type_1.FiscalYearPatch, Object]),
89
+ tslib_1.__metadata("design:returntype", Promise)
90
+ ], FiscalYearMutation.prototype, "updateFiscalYear", null);
91
+ tslib_1.__decorate([
92
+ (0, type_graphql_1.Directive)('@transaction'),
93
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
94
+ (0, type_graphql_1.Mutation)(returns => [fiscal_year_1.FiscalYear], { description: "To modify multiple FiscalYears' information" }),
95
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [fiscal_year_type_1.FiscalYearPatch])),
96
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
97
+ tslib_1.__metadata("design:type", Function),
98
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
99
+ tslib_1.__metadata("design:returntype", Promise)
100
+ ], FiscalYearMutation.prototype, "updateMultipleFiscalYear", null);
101
+ tslib_1.__decorate([
102
+ (0, type_graphql_1.Directive)('@transaction'),
103
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
104
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete FiscalYear' }),
105
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
106
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
107
+ tslib_1.__metadata("design:type", Function),
108
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
109
+ tslib_1.__metadata("design:returntype", Promise)
110
+ ], FiscalYearMutation.prototype, "deleteFiscalYear", null);
111
+ tslib_1.__decorate([
112
+ (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
114
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple FiscalYears' }),
115
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
116
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
117
+ tslib_1.__metadata("design:type", Function),
118
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
119
+ tslib_1.__metadata("design:returntype", Promise)
120
+ ], FiscalYearMutation.prototype, "deleteFiscalYears", null);
121
+ tslib_1.__decorate([
122
+ (0, type_graphql_1.Directive)('@transaction'),
123
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
124
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple FiscalYears' }),
125
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalYears', type => [fiscal_year_type_1.FiscalYearPatch])),
126
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
127
+ tslib_1.__metadata("design:type", Function),
128
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
129
+ tslib_1.__metadata("design:returntype", Promise)
130
+ ], FiscalYearMutation.prototype, "importFiscalYears", null);
131
+ exports.FiscalYearMutation = FiscalYearMutation = tslib_1.__decorate([
132
+ (0, type_graphql_1.Resolver)(fiscal_year_1.FiscalYear)
133
+ ], FiscalYearMutation);
134
+ //# sourceMappingURL=fiscal-year-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiscal-year-mutation.js","sourceRoot":"","sources":["../../../server/service/fiscal-year/fiscal-year-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,+CAA0C;AAC1C,yDAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAIvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wBAAU,EAAE,EAAE,CAAC,CAAC,IAAI,iCAClD,UAAU,KACb,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,gBAAgB,CACT,EAAU,EACP,KAAsB,EAC7B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,wBAAU,EAAE,EAAE,CAAC,CAAA;QAChD,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,+CAC/B,UAAU,GACV,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACe,OAA0B,EAC9D,OAAwB;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DAA2D,CAAC;IACtE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0DAMnD;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,gCAAgC,EAAE,CAAC;IAE7E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAUP;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,gCAAgC,EAAE,CAAC;IAE7E,mBAAA,IAAA,kBAAG,EAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAe,CAAC,CAAC,CAAA;IAC7C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAWP;6BAvIU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CAwI9B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { FiscalYear } from './fiscal-year'\nimport { NewFiscalYear, FiscalYearPatch } from './fiscal-year-type'\n\n@Resolver(FiscalYear)\nexport class FiscalYearMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => FiscalYear, { description: 'To create new FiscalYear' })\n async createFiscalYear(\n @Arg('fiscalYear') fiscalYear: NewFiscalYear,\n @Ctx() context: ResolverContext\n ): Promise<FiscalYear> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FiscalYear, tx).save({\n ...fiscalYear,\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 => FiscalYear, { description: 'To modify FiscalYear information' })\n async updateFiscalYear(\n @Arg('id') id: string,\n @Arg('patch') patch: FiscalYearPatch,\n @Ctx() context: ResolverContext\n ): Promise<FiscalYear> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FiscalYear, tx)\n const fiscalYear = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...fiscalYear,\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 => [FiscalYear], { description: \"To modify multiple FiscalYears' information\" })\n async updateMultipleFiscalYear(\n @Arg('patches', type => [FiscalYearPatch]) patches: FiscalYearPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FiscalYear[]> {\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 fiscalYearRepo = getRepository(FiscalYear, 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 fiscalYearRepo.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 fiscalYear = await fiscalYearRepo.findOneBy({ id: updateRecord.id })\n\n const result = await fiscalYearRepo.save({\n ...fiscalYear,\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 FiscalYear' })\n async deleteFiscalYear(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalYear, 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 FiscalYears' })\n async deleteFiscalYears(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FiscalYear, 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 FiscalYears' })\n async importFiscalYears(\n @Arg('fiscalYears', type => [FiscalYearPatch]) fiscalYears: FiscalYearPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n fiscalYears.map(async (fiscalYear: FiscalYearPatch) => {\n const createdFiscalYear: FiscalYear = await getRepository(FiscalYear, tx).save({ domain, ...fiscalYear })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { FiscalYear } from './fiscal-year';
4
+ import { FiscalYearList } from './fiscal-year-type';
5
+ export declare class FiscalYearQuery {
6
+ fiscalYear(year: number, context: ResolverContext): Promise<FiscalYear | undefined>;
7
+ fiscalYears(params: ListParam, context: ResolverContext): Promise<FiscalYearList>;
8
+ domain(fiscalYear: FiscalYear): Promise<Domain>;
9
+ updater(fiscalYear: FiscalYear): Promise<User>;
10
+ creator(fiscalYear: FiscalYear): Promise<User>;
11
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalYearQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const fiscal_year_1 = require("./fiscal-year");
9
+ const fiscal_year_type_1 = require("./fiscal-year-type");
10
+ let FiscalYearQuery = class FiscalYearQuery {
11
+ async fiscalYear(year, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear).findOne({
14
+ where: { domain: { id: domain.id }, year }
15
+ });
16
+ }
17
+ async fiscalYears(params, context) {
18
+ const { domain } = context.state;
19
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
20
+ domain,
21
+ params,
22
+ repository: await (0, shell_1.getRepository)(fiscal_year_1.FiscalYear),
23
+ searchables: []
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(fiscalYear) {
29
+ return fiscalYear.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: fiscalYear.domainId }));
30
+ }
31
+ async updater(fiscalYear) {
32
+ return fiscalYear.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fiscalYear.updaterId }));
33
+ }
34
+ async creator(fiscalYear) {
35
+ return fiscalYear.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fiscalYear.creatorId }));
36
+ }
37
+ };
38
+ exports.FiscalYearQuery = FiscalYearQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
41
+ (0, type_graphql_1.Query)(returns => fiscal_year_1.FiscalYear, { nullable: true, description: 'To fetch a FiscalYear by year' }),
42
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('year')),
43
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
44
+ tslib_1.__metadata("design:type", Function),
45
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
46
+ tslib_1.__metadata("design:returntype", Promise)
47
+ ], FiscalYearQuery.prototype, "fiscalYear", null);
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
50
+ (0, type_graphql_1.Query)(returns => fiscal_year_type_1.FiscalYearList, { description: 'To fetch multiple FiscalYears' }),
51
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
52
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
53
+ tslib_1.__metadata("design:type", Function),
54
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
55
+ tslib_1.__metadata("design:returntype", Promise)
56
+ ], FiscalYearQuery.prototype, "fiscalYears", null);
57
+ tslib_1.__decorate([
58
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
59
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
60
+ tslib_1.__metadata("design:type", Function),
61
+ tslib_1.__metadata("design:paramtypes", [fiscal_year_1.FiscalYear]),
62
+ tslib_1.__metadata("design:returntype", Promise)
63
+ ], FiscalYearQuery.prototype, "domain", null);
64
+ tslib_1.__decorate([
65
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
66
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
67
+ tslib_1.__metadata("design:type", Function),
68
+ tslib_1.__metadata("design:paramtypes", [fiscal_year_1.FiscalYear]),
69
+ tslib_1.__metadata("design:returntype", Promise)
70
+ ], FiscalYearQuery.prototype, "updater", null);
71
+ tslib_1.__decorate([
72
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
73
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
74
+ tslib_1.__metadata("design:type", Function),
75
+ tslib_1.__metadata("design:paramtypes", [fiscal_year_1.FiscalYear]),
76
+ tslib_1.__metadata("design:returntype", Promise)
77
+ ], FiscalYearQuery.prototype, "creator", null);
78
+ exports.FiscalYearQuery = FiscalYearQuery = tslib_1.__decorate([
79
+ (0, type_graphql_1.Resolver)(fiscal_year_1.FiscalYear)
80
+ ], FiscalYearQuery);
81
+ //# sourceMappingURL=fiscal-year-query.js.map