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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) 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/{ledger/ledger-importer.ts → payment/payment-importer.ts} +10 -17
  12. package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -57
  13. package/client/route.ts +0 -4
  14. package/client/types/accounting-category.ts +23 -0
  15. package/client/types/index.ts +1 -0
  16. package/dist-client/bootstrap.js +7 -1
  17. package/dist-client/bootstrap.js.map +1 -1
  18. package/dist-client/components/accounting-category-selector.d.ts +16 -0
  19. package/dist-client/components/accounting-category-selector.js +134 -0
  20. package/dist-client/components/accounting-category-selector.js.map +1 -0
  21. package/dist-client/components/accounting-category-view.d.ts +14 -0
  22. package/dist-client/components/accounting-category-view.js +81 -0
  23. package/dist-client/components/accounting-category-view.js.map +1 -0
  24. package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
  25. package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
  26. package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
  27. package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
  28. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
  29. package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
  30. package/dist-client/pages/account/account-list-page.js +33 -2
  31. package/dist-client/pages/account/account-list-page.js.map +1 -1
  32. package/dist-client/pages/accounting-category/accounting-category-list-page.js +31 -1
  33. package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
  34. package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
  35. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
  36. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
  37. package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
  38. package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
  39. package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
  40. package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
  41. package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
  42. package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
  43. package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +3 -2
  44. package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +14 -21
  45. package/dist-client/pages/payment/payment-importer.js.map +1 -0
  46. package/dist-client/pages/{ledger/ledger-list-page.d.ts → payment/payment-list-page.d.ts} +12 -8
  47. package/dist-client/pages/{ledger/ledger-list-page.js → payment/payment-list-page.js} +114 -67
  48. package/dist-client/pages/payment/payment-list-page.js.map +1 -0
  49. package/dist-client/route.d.ts +1 -1
  50. package/dist-client/route.js +0 -3
  51. package/dist-client/route.js.map +1 -1
  52. package/dist-client/tsconfig.tsbuildinfo +1 -1
  53. package/dist-client/types/accounting-category.d.ts +16 -0
  54. package/dist-client/types/accounting-category.js +3 -0
  55. package/dist-client/types/accounting-category.js.map +1 -0
  56. package/dist-client/types/index.d.ts +1 -0
  57. package/dist-client/types/index.js +2 -0
  58. package/dist-client/types/index.js.map +1 -0
  59. package/dist-server/activities/activity-book.js +31 -19
  60. package/dist-server/activities/activity-book.js.map +1 -1
  61. package/dist-server/controllers/summary-statements.js +13 -7
  62. package/dist-server/controllers/summary-statements.js.map +1 -1
  63. package/dist-server/index.d.ts +1 -0
  64. package/dist-server/index.js +1 -0
  65. package/dist-server/index.js.map +1 -1
  66. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +3 -3
  67. package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -1
  68. package/dist-server/migrations/1725201467183-seed-accounts.js +31 -31
  69. package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -1
  70. package/dist-server/routes.d.ts +0 -1
  71. package/dist-server/routes.js +0 -1
  72. package/dist-server/routes.js.map +1 -1
  73. package/dist-server/service/account/account-history.d.ts +4 -1
  74. package/dist-server/service/account/account-history.js +14 -4
  75. package/dist-server/service/account/account-history.js.map +1 -1
  76. package/dist-server/service/account/account-mutation.js +13 -9
  77. package/dist-server/service/account/account-mutation.js.map +1 -1
  78. package/dist-server/service/account/account-query.js +2 -0
  79. package/dist-server/service/account/account-query.js.map +1 -1
  80. package/dist-server/service/account/account.d.ts +1 -1
  81. package/dist-server/service/account/account.js +15 -4
  82. package/dist-server/service/account/account.js.map +1 -1
  83. package/dist-server/service/account/index.d.ts +1 -2
  84. package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
  85. package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
  86. package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
  87. package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
  88. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  89. package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
  90. package/dist-server/service/accounting-category/accounting-category-query.js +23 -0
  91. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
  92. package/dist-server/service/accounting-category/accounting-category.d.ts +1 -0
  93. package/dist-server/service/accounting-category/accounting-category.js +14 -3
  94. package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
  95. package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
  96. package/dist-server/service/accounting-category/event-subscriber.js +21 -0
  97. package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
  98. package/dist-server/service/accounting-category/index.d.ts +2 -1
  99. package/dist-server/service/accounting-category/index.js +4 -2
  100. package/dist-server/service/accounting-category/index.js.map +1 -1
  101. package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
  102. package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
  103. package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
  104. package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
  105. package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
  106. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
  107. package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
  108. package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
  109. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
  110. package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
  111. package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
  112. package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
  113. package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
  114. package/dist-server/service/accounting-document/accounting-document.js +104 -0
  115. package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
  116. package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
  117. package/dist-server/service/accounting-document/event-subscriber.js +21 -0
  118. package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
  119. package/dist-server/service/accounting-document/index.d.ts +7 -0
  120. package/dist-server/service/accounting-document/index.js +12 -0
  121. package/dist-server/service/accounting-document/index.js.map +1 -0
  122. package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
  123. package/dist-server/service/financial-statement/financial-statement-history.js +30 -20
  124. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  125. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
  126. package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
  127. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
  128. package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
  129. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  130. package/dist-server/service/financial-statement/financial-statement-query.js +2 -0
  131. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  132. package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
  133. package/dist-server/service/financial-statement/financial-statement.js +45 -24
  134. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  135. package/dist-server/service/financial-statement/index.d.ts +2 -2
  136. package/dist-server/service/financial-statement/index.js +2 -1
  137. package/dist-server/service/financial-statement/index.js.map +1 -1
  138. package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -0
  139. package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
  140. package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -0
  141. package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
  142. package/dist-server/service/fiscal-month/fiscal-month.js +1 -1
  143. package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -1
  144. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -0
  145. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
  146. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -0
  147. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
  148. package/dist-server/service/fiscal-quarter/fiscal-quarter.js +1 -1
  149. package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -1
  150. package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -0
  151. package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
  152. package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -0
  153. package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
  154. package/dist-server/service/fiscal-year/fiscal-year.js +1 -1
  155. package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -1
  156. package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
  157. package/dist-server/service/income-statement/income-statement-history.js +35 -20
  158. package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
  159. package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
  160. package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
  161. package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
  162. package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
  163. package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
  164. package/dist-server/service/income-statement/income-statement-query.js +2 -0
  165. package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
  166. package/dist-server/service/income-statement/income-statement.d.ts +2 -0
  167. package/dist-server/service/income-statement/income-statement.js +46 -26
  168. package/dist-server/service/income-statement/income-statement.js.map +1 -1
  169. package/dist-server/service/income-statement/index.d.ts +2 -2
  170. package/dist-server/service/income-statement/index.js +2 -1
  171. package/dist-server/service/income-statement/index.js.map +1 -1
  172. package/dist-server/service/index.d.ts +4 -2
  173. package/dist-server/service/index.js +10 -0
  174. package/dist-server/service/index.js.map +1 -1
  175. package/dist-server/service/payment/event-subscriber.d.ts +7 -0
  176. package/dist-server/service/payment/event-subscriber.js +21 -0
  177. package/dist-server/service/payment/event-subscriber.js.map +1 -0
  178. package/dist-server/service/payment/index.d.ts +8 -0
  179. package/dist-server/service/payment/index.js +12 -0
  180. package/dist-server/service/payment/index.js.map +1 -0
  181. package/dist-server/service/payment/payment-history.d.ts +30 -0
  182. package/dist-server/service/payment/payment-history.js +143 -0
  183. package/dist-server/service/payment/payment-history.js.map +1 -0
  184. package/dist-server/service/payment/payment-mutation.d.ts +10 -0
  185. package/dist-server/service/payment/payment-mutation.js +134 -0
  186. package/dist-server/service/payment/payment-mutation.js.map +1 -0
  187. package/dist-server/service/payment/payment-query.d.ts +11 -0
  188. package/dist-server/service/payment/payment-query.js +81 -0
  189. package/dist-server/service/payment/payment-query.js.map +1 -0
  190. package/dist-server/service/payment/payment-type.d.ts +24 -0
  191. package/dist-server/service/payment/payment-type.js +90 -0
  192. package/dist-server/service/payment/payment-type.js.map +1 -0
  193. package/dist-server/service/payment/payment.d.ts +30 -0
  194. package/dist-server/service/payment/payment.js +146 -0
  195. package/dist-server/service/payment/payment.js.map +1 -0
  196. package/dist-server/service/transaction/index.d.ts +2 -1
  197. package/dist-server/service/transaction/transaction-history.d.ts +6 -2
  198. package/dist-server/service/transaction/transaction-history.js +28 -9
  199. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  200. package/dist-server/service/transaction/transaction-mutation.js +13 -9
  201. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  202. package/dist-server/service/transaction/transaction-query.js +2 -0
  203. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  204. package/dist-server/service/transaction/transaction.d.ts +28 -6
  205. package/dist-server/service/transaction/transaction.js +119 -31
  206. package/dist-server/service/transaction/transaction.js.map +1 -1
  207. package/dist-server/tsconfig.tsbuildinfo +1 -1
  208. package/helps/accounting/accounting-document.md +160 -0
  209. package/helps/accounting/contract.md +160 -0
  210. package/helps/accounting/payment.md +160 -0
  211. package/package.json +5 -5
  212. package/server/activities/activity-book.ts +31 -19
  213. package/server/controllers/summary-statements.ts +13 -7
  214. package/server/index.ts +1 -0
  215. package/server/migrations/1725200507196-seed-fiscal-entities.ts +3 -3
  216. package/server/migrations/1725201467183-seed-accounts.ts +31 -31
  217. package/server/routes.ts +0 -2
  218. package/server/service/account/account-history.ts +14 -6
  219. package/server/service/account/account-mutation.ts +13 -10
  220. package/server/service/account/account-query.ts +2 -0
  221. package/server/service/account/account.ts +15 -4
  222. package/server/service/accounting-category/accounting-category-history.ts +123 -0
  223. package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
  224. package/server/service/accounting-category/accounting-category-query.ts +23 -0
  225. package/server/service/accounting-category/accounting-category.ts +14 -3
  226. package/server/service/accounting-category/event-subscriber.ts +20 -0
  227. package/server/service/accounting-category/index.ts +4 -2
  228. package/server/service/accounting-document/accounting-document-history.ts +117 -0
  229. package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
  230. package/server/service/accounting-document/accounting-document-query.ts +48 -0
  231. package/server/service/accounting-document/accounting-document-type.ts +52 -0
  232. package/server/service/accounting-document/accounting-document.ts +93 -0
  233. package/server/service/accounting-document/event-subscriber.ts +17 -0
  234. package/server/service/accounting-document/index.ts +9 -0
  235. package/server/service/financial-statement/financial-statement-history.ts +27 -18
  236. package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
  237. package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
  238. package/server/service/financial-statement/financial-statement-query.ts +2 -0
  239. package/server/service/financial-statement/financial-statement.ts +52 -36
  240. package/server/service/financial-statement/index.ts +2 -1
  241. package/server/service/fiscal-month/fiscal-month-mutation.ts +10 -2
  242. package/server/service/fiscal-month/fiscal-month-query.ts +3 -1
  243. package/server/service/fiscal-month/fiscal-month.ts +1 -1
  244. package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +14 -3
  245. package/server/service/fiscal-quarter/fiscal-quarter-query.ts +2 -0
  246. package/server/service/fiscal-quarter/fiscal-quarter.ts +1 -1
  247. package/server/service/fiscal-year/fiscal-year-mutation.ts +10 -2
  248. package/server/service/fiscal-year/fiscal-year-query.ts +2 -0
  249. package/server/service/fiscal-year/fiscal-year.ts +1 -1
  250. package/server/service/income-statement/income-statement-history.ts +30 -17
  251. package/server/service/income-statement/income-statement-line-item.ts +84 -0
  252. package/server/service/income-statement/income-statement-mutation.ts +12 -10
  253. package/server/service/income-statement/income-statement-query.ts +2 -0
  254. package/server/service/income-statement/income-statement.ts +54 -39
  255. package/server/service/income-statement/index.ts +2 -1
  256. package/server/service/index.ts +18 -0
  257. package/server/service/payment/event-subscriber.ts +17 -0
  258. package/server/service/payment/index.ts +9 -0
  259. package/server/service/payment/payment-history.ts +126 -0
  260. package/server/service/payment/payment-mutation.ts +139 -0
  261. package/server/service/payment/payment-query.ts +50 -0
  262. package/server/service/payment/payment-type.ts +64 -0
  263. package/server/service/payment/payment.ts +123 -0
  264. package/server/service/transaction/transaction-history.ts +24 -8
  265. package/server/service/transaction/transaction-mutation.ts +13 -10
  266. package/server/service/transaction/transaction-query.ts +2 -0
  267. package/server/service/transaction/transaction.ts +130 -34
  268. package/things-factory.config.js +0 -1
  269. package/translations/en.json +9 -1
  270. package/translations/ja.json +9 -1
  271. package/translations/ko.json +9 -1
  272. package/translations/ms.json +9 -1
  273. package/translations/zh.json +9 -1
  274. package/client/pages/main.ts +0 -24
  275. package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
  276. package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
  277. package/dist-client/pages/main.d.ts +0 -1
  278. package/dist-client/pages/main.js +0 -27
  279. package/dist-client/pages/main.js.map +0 -1
@@ -69,6 +69,7 @@ let FiscalYearMutation = class FiscalYearMutation {
69
69
  exports.FiscalYearMutation = FiscalYearMutation;
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_year_1.FiscalYear, { description: 'To create new FiscalYear' }),
73
74
  tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalYear')),
74
75
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -78,6 +79,7 @@ tslib_1.__decorate([
78
79
  ], FiscalYearMutation.prototype, "createFiscalYear", 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_year_1.FiscalYear, { description: 'To modify FiscalYear 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
  ], FiscalYearMutation.prototype, "updateFiscalYear", 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_year_1.FiscalYear], { description: "To modify multiple FiscalYears' information" }),
92
95
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [fiscal_year_type_1.FiscalYearPatch])),
93
96
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -97,6 +100,7 @@ tslib_1.__decorate([
97
100
  ], FiscalYearMutation.prototype, "updateMultipleFiscalYear", 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 FiscalYear' }),
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
  ], FiscalYearMutation.prototype, "deleteFiscalYear", 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 FiscalYears' }),
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
  ], FiscalYearMutation.prototype, "deleteFiscalYears", 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 FiscalYears' }),
119
125
  tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalYears', type => [fiscal_year_type_1.FiscalYearPatch])),
120
126
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +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;IAGvB,AAAN,KAAK,CAAC,gBAAgB,CAAoB,UAAyB,EAAS,OAAwB;QAClG,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;IAIK,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;IAIK,AAAN,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C;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0DAMnD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,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;;;;2DAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,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;6BA/HU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CAgI9B","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 @Mutation(returns => FiscalYear, { description: 'To create new FiscalYear' })\n async createFiscalYear(@Arg('fiscalYear') fiscalYear: NewFiscalYear, @Ctx() context: ResolverContext): 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 @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 @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 @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 @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\n return true\n }\n\n @Directive('@transaction')\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"]}
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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I,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"]}
@@ -37,6 +37,7 @@ let FiscalYearQuery = class FiscalYearQuery {
37
37
  };
38
38
  exports.FiscalYearQuery = FiscalYearQuery;
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_year_1.FiscalYear, { nullable: true, description: 'To fetch a FiscalYear by year' }),
41
42
  tslib_1.__param(0, (0, type_graphql_1.Arg)('year')),
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
  ], FiscalYearQuery.prototype, "fiscalYear", 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 => fiscal_year_type_1.FiscalYearList, { description: 'To fetch multiple FiscalYears' }),
49
51
  tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
50
52
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"fiscal-year-query.js","sourceRoot":"","sources":["../../../server/service/fiscal-year/fiscal-year-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA0C;AAC1C,yDAAmD;AAG5C,IAAM,eAAe,GAArB,MAAM,eAAe;IAEpB,AAAN,KAAK,CAAC,UAAU,CAAc,IAAY,EAAS,OAAwB;QACzE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAA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3CY,0CAAe;AAEpB;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,wBAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC9E,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iDAMjD;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iCAAc,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAEhF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;kDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;6CAE1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;0BA1CU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,eAAe,CA2C3B","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 { FiscalYear } from './fiscal-year'\nimport { FiscalYearList } from './fiscal-year-type'\n\n@Resolver(FiscalYear)\nexport class FiscalYearQuery {\n @Query(returns => FiscalYear!, { nullable: true, description: 'To fetch a FiscalYear by year' })\n async fiscalYear(@Arg('year') year: number, @Ctx() context: ResolverContext): Promise<FiscalYear | undefined> {\n const { domain } = context.state\n\n return await getRepository(FiscalYear).findOne({\n where: { domain: { id: domain.id }, year }\n })\n }\n\n @Query(returns => FiscalYearList, { description: 'To fetch multiple FiscalYears' })\n async fiscalYears(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FiscalYearList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FiscalYear),\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() fiscalYear: FiscalYear): Promise<Domain> {\n return fiscalYear.domainId && (await getRepository(Domain).findOneBy({ id: fiscalYear.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fiscalYear: FiscalYear): Promise<User> {\n return fiscalYear.updaterId && (await getRepository(User).findOneBy({ id: fiscalYear.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fiscalYear: FiscalYear): Promise<User> {\n return fiscalYear.creatorId && (await getRepository(User).findOneBy({ id: fiscalYear.creatorId }))\n }\n}\n"]}
1
+ {"version":3,"file":"fiscal-year-query.js","sourceRoot":"","sources":["../../../server/service/fiscal-year/fiscal-year-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA0C;AAC1C,yDAAmD;AAG5C,IAAM,eAAe,GAArB,MAAM,eAAe;IAGpB,AAAN,KAAK,CAAC,UAAU,CAAc,IAAY,EAAS,OAAwB;QACzE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,wBAAU,CAAC,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAA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AAO,CAAC,EAAE,CAAC,wBAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC9E,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iDAMjD;AAIK;IAFL,IAAA,wBAAS,EAAC,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iCAAc,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAEhF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;kDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;6CAE1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;0BA5CU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,eAAe,CA6C3B","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 { FiscalYear } from './fiscal-year'\nimport { FiscalYearList } from './fiscal-year-type'\n\n@Resolver(FiscalYear)\nexport class FiscalYearQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalYear!, { nullable: true, description: 'To fetch a FiscalYear by year' })\n async fiscalYear(@Arg('year') year: number, @Ctx() context: ResolverContext): Promise<FiscalYear | undefined> {\n const { domain } = context.state\n\n return await getRepository(FiscalYear).findOne({\n where: { domain: { id: domain.id }, year }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => FiscalYearList, { description: 'To fetch multiple FiscalYears' })\n async fiscalYears(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FiscalYearList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FiscalYear),\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() fiscalYear: FiscalYear): Promise<Domain> {\n return fiscalYear.domainId && (await getRepository(Domain).findOneBy({ id: fiscalYear.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fiscalYear: FiscalYear): Promise<User> {\n return fiscalYear.updaterId && (await getRepository(User).findOneBy({ id: fiscalYear.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fiscalYear: FiscalYear): Promise<User> {\n return fiscalYear.creatorId && (await getRepository(User).findOneBy({ id: fiscalYear.creatorId }))\n }\n}\n"]}
@@ -40,7 +40,7 @@ tslib_1.__decorate([
40
40
  tslib_1.__metadata("design:type", String)
41
41
  ], FiscalYear.prototype, "endDate", void 0);
42
42
  tslib_1.__decorate([
43
- (0, typeorm_1.Column)({ type: 'enum', enum: common_type_1.FiscalStatus, default: common_type_1.FiscalStatus.OPEN }),
43
+ (0, typeorm_1.Column)({ default: common_type_1.FiscalStatus.OPEN }),
44
44
  (0, type_graphql_1.Field)(type => common_type_1.FiscalStatus, { description: 'The status of the fiscal year (OPEN, CLOSED, FINALIZED)' }),
45
45
  tslib_1.__metadata("design:type", String)
46
46
  ], FiscalYear.prototype, "status", void 0);
@@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EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IAChE,IAAA,gBAAM,GAAE;GACI,UAAU,CAyDtB","sourcesContent":["import {\n CreateDateColumn,\n DeleteDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n ManyToOne,\n RelationId,\n PrimaryGeneratedColumn\n} from '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 year' })\n@Entity()\nexport class FiscalYear {\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((fiscalYear: FiscalYear) => fiscalYear.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 => String, { description: 'The start date of the fiscal year in YYYY-MM-DD format' })\n startDate: string // 회계연도 시작일\n\n @Column()\n @Field(type => String, { description: 'The end date of the fiscal year in YYYY-MM-DD format' })\n endDate: string // 회계연도 종료일\n\n @Column({ type: 'enum', enum: FiscalStatus, default: FiscalStatus.OPEN })\n @Field(type => FiscalStatus, { description: 'The status of the fiscal year (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 year' })\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((fiscalYear: FiscalYear) => fiscalYear.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((fiscalYear: FiscalYear) => fiscalYear.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"fiscal-year.js","sourceRoot":"","sources":["../../../server/service/fiscal-year/fiscal-year.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAyD;AACzD,iDAA8C;AAC9C,yDAAgD;AAChD,gDAA6C;AAItC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAyDtB,CAAA;AAzDY,gCAAU;AAGZ;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;sCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;0CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;;4CACzC;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;;wCACxD;AAIZ;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;;6CAChF;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC;;2CAChF;AAIf;IAFC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,0BAAY,CAAC,IAAI,EAAE,CAAC;IACtC,IAAA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U,CAAC,OAAO,CAAC;;6CACzC;qBAxDP,UAAU;IAFtB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IAChE,IAAA,gBAAM,GAAE;GACI,UAAU,CAyDtB","sourcesContent":["import {\n CreateDateColumn,\n DeleteDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n ManyToOne,\n RelationId,\n PrimaryGeneratedColumn\n} from '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 year' })\n@Entity()\nexport class FiscalYear {\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((fiscalYear: FiscalYear) => fiscalYear.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 => String, { description: 'The start date of the fiscal year in YYYY-MM-DD format' })\n startDate: string // 회계연도 시작일\n\n @Column()\n @Field(type => String, { description: 'The end date of the fiscal year in YYYY-MM-DD format' })\n endDate: string // 회계연도 종료일\n\n @Column({ default: FiscalStatus.OPEN })\n @Field(type => FiscalStatus, { description: 'The status of the fiscal year (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 year' })\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((fiscalYear: FiscalYear) => fiscalYear.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((fiscalYear: FiscalYear) => fiscalYear.updater)\n updaterId?: string\n}\n"]}
@@ -1,17 +1,21 @@
1
1
  import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
2
2
  import { User } from '@things-factory/auth-base';
3
3
  import { Domain } from '@things-factory/shell';
4
- import { IncomeStatement, IncomeStatementStatus } from './income-statement';
4
+ import { IncomeStatement } from './income-statement';
5
+ import { IncomeStatementLineItem } from './income-statement-line-item';
5
6
  export declare class IncomeStatementHistory implements HistoryEntityInterface<IncomeStatement> {
6
7
  readonly id: string;
7
8
  version?: number;
8
9
  domain?: Domain;
9
10
  domainId?: string;
10
- name: string;
11
- description?: string;
11
+ year?: number;
12
+ quarter?: number;
13
+ month?: number;
14
+ revenue?: number;
15
+ expense?: number;
16
+ netIncome?: number;
12
17
  active?: boolean;
13
- state?: IncomeStatementStatus;
14
- params?: string;
18
+ lineItems?: IncomeStatementLineItem[];
15
19
  createdAt?: Date;
16
20
  updatedAt?: Date;
17
21
  deletedAt?: Date;
@@ -8,7 +8,7 @@ const typeorm_history_1 = require("@operato/typeorm-history");
8
8
  const auth_base_1 = require("@things-factory/auth-base");
9
9
  const env_1 = require("@things-factory/env");
10
10
  const shell_1 = require("@things-factory/shell");
11
- const income_statement_1 = require("./income-statement");
11
+ const income_statement_line_item_1 = require("./income-statement-line-item");
12
12
  const ORMCONFIG = env_1.config.get('ormconfig', {});
13
13
  const DATABASE_TYPE = ORMCONFIG.type;
14
14
  let IncomeStatementHistory = class IncomeStatementHistory {
@@ -33,34 +33,49 @@ tslib_1.__decorate([
33
33
  tslib_1.__metadata("design:type", shell_1.Domain)
34
34
  ], IncomeStatementHistory.prototype, "domain", void 0);
35
35
  tslib_1.__decorate([
36
- (0, typeorm_1.RelationId)((incomeStatement) => incomeStatement.domain),
36
+ (0, typeorm_1.RelationId)((incomeStatementHistory) => incomeStatementHistory.domain),
37
37
  tslib_1.__metadata("design:type", String)
38
38
  ], IncomeStatementHistory.prototype, "domainId", void 0);
39
39
  tslib_1.__decorate([
40
- (0, typeorm_1.Column)(),
41
- (0, type_graphql_1.Field)(),
42
- tslib_1.__metadata("design:type", String)
43
- ], IncomeStatementHistory.prototype, "name", void 0);
40
+ (0, typeorm_1.Column)({ nullable: true }),
41
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year of the income statement' }),
42
+ tslib_1.__metadata("design:type", Number)
43
+ ], IncomeStatementHistory.prototype, "year", void 0);
44
44
  tslib_1.__decorate([
45
45
  (0, typeorm_1.Column)({ nullable: true }),
46
- (0, type_graphql_1.Field)({ nullable: true }),
47
- tslib_1.__metadata("design:type", String)
48
- ], IncomeStatementHistory.prototype, "description", void 0);
46
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter of the income statement' }),
47
+ tslib_1.__metadata("design:type", Number)
48
+ ], IncomeStatementHistory.prototype, "quarter", void 0);
49
49
  tslib_1.__decorate([
50
50
  (0, typeorm_1.Column)({ nullable: true }),
51
- (0, type_graphql_1.Field)({ nullable: true }),
52
- tslib_1.__metadata("design:type", Boolean)
53
- ], IncomeStatementHistory.prototype, "active", void 0);
51
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month of the income statement' }),
52
+ tslib_1.__metadata("design:type", Number)
53
+ ], IncomeStatementHistory.prototype, "month", void 0);
54
54
  tslib_1.__decorate([
55
55
  (0, typeorm_1.Column)({ nullable: true }),
56
- (0, type_graphql_1.Field)({ nullable: true }),
57
- tslib_1.__metadata("design:type", String)
58
- ], IncomeStatementHistory.prototype, "state", void 0);
56
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Total revenue recorded in the income statement' }),
57
+ tslib_1.__metadata("design:type", Number)
58
+ ], IncomeStatementHistory.prototype, "revenue", void 0);
59
59
  tslib_1.__decorate([
60
60
  (0, typeorm_1.Column)({ nullable: true }),
61
- (0, type_graphql_1.Field)({ nullable: true }),
62
- tslib_1.__metadata("design:type", String)
63
- ], IncomeStatementHistory.prototype, "params", void 0);
61
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Total expenses recorded in the income statement' }),
62
+ tslib_1.__metadata("design:type", Number)
63
+ ], IncomeStatementHistory.prototype, "expense", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.Column)({ nullable: true }),
66
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Net income calculated as revenue minus expenses' }),
67
+ tslib_1.__metadata("design:type", Number)
68
+ ], IncomeStatementHistory.prototype, "netIncome", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.Column)({ nullable: true }),
71
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether this income statement is active' }),
72
+ tslib_1.__metadata("design:type", Boolean)
73
+ ], IncomeStatementHistory.prototype, "active", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.OneToMany)(type => income_statement_line_item_1.IncomeStatementLineItem, lineItem => lineItem.statement),
76
+ (0, type_graphql_1.Field)(type => [income_statement_line_item_1.IncomeStatementLineItem], { nullable: true }),
77
+ tslib_1.__metadata("design:type", Array)
78
+ ], IncomeStatementHistory.prototype, "lineItems", void 0);
64
79
  tslib_1.__decorate([
65
80
  (0, typeorm_1.Column)({ nullable: true }),
66
81
  (0, type_graphql_1.Field)({ nullable: true }),
@@ -82,7 +97,7 @@ tslib_1.__decorate([
82
97
  tslib_1.__metadata("design:type", auth_base_1.User)
83
98
  ], IncomeStatementHistory.prototype, "creator", void 0);
84
99
  tslib_1.__decorate([
85
- (0, typeorm_1.RelationId)((incomeStatement) => incomeStatement.creator),
100
+ (0, typeorm_1.RelationId)((incomeStatementHistory) => incomeStatementHistory.creator),
86
101
  tslib_1.__metadata("design:type", String)
87
102
  ], IncomeStatementHistory.prototype, "creatorId", void 0);
88
103
  tslib_1.__decorate([
@@ -91,7 +106,7 @@ tslib_1.__decorate([
91
106
  tslib_1.__metadata("design:type", auth_base_1.User)
92
107
  ], IncomeStatementHistory.prototype, "updater", void 0);
93
108
  tslib_1.__decorate([
94
- (0, typeorm_1.RelationId)((incomeStatement) => incomeStatement.updater),
109
+ (0, typeorm_1.RelationId)((incomeStatementHistory) => incomeStatementHistory.updater),
95
110
  tslib_1.__metadata("design:type", String)
96
111
  ], IncomeStatementHistory.prototype, "updaterId", void 0);
97
112
  tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"income-statement-history.js","sourceRoot":"","sources":["../../../server/service/income-statement/income-statement-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,yDAA2E;AAE3E,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAqB7B,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QAOL,YAAO,GAAY,CAAC,CAAA;IAqEtB,CAAC;CAAA,CAAA;AA5EY,wDAAsB;AAGxB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;kDACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;sDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,eAAgC,EAAE,EAAE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yBAAU,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;GACpD,sBAAsB,CA4ElC","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { IncomeStatement, IncomeStatementStatus } from './income-statement'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_income-statement_history_0',\n (incomeStatementHistory: IncomeStatementHistory) => [\n incomeStatementHistory.originalId,\n incomeStatementHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_income-statement_history_1',\n (incomeStatementHistory: IncomeStatementHistory) => [\n incomeStatementHistory.domain,\n incomeStatementHistory.originalId,\n incomeStatementHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of IncomeStatement' })\nexport class IncomeStatementHistory implements HistoryEntityInterface<IncomeStatement> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((incomeStatement: IncomeStatement) => incomeStatement.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: IncomeStatementStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((incomeStatement: IncomeStatement) => incomeStatement.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((incomeStatement: IncomeStatement) => incomeStatement.updater)\n updaterId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
1
+ {"version":3,"file":"income-statement-history.js","sourceRoot":"","sources":["../../../server/service/income-statement/income-statement-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAAyG;AAEzG,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAG9C,6EAAsE;AAEtE,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAqB7B,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QAOL,YAAO,GAAY,CAAC,CAAA;IAiFtB,CAAC;CAAA,CAAA;AAxFY,wDAAsB;AAGxB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;kDACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CA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,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;uDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,sBAA8C,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC;;yDAC7E;AAGX;IADN,IAAA,yCAAuB,GAAE;;0DACA;AAYnB;IAVN,IAAA,qCAAmB,EAAC;QACnB,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBACzB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAClB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;sDAC+B;iCAvFtB,sBAAsB;IAnBlC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,+BAA+B,EAC/B,CAAC,sBAA8C,EAAE,EAAE,CAAC;QAClD,sBAAsB,CAAC,UAAU;QACjC,sBAAsB,CAAC,OAAO;KAC/B,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,+BAA+B,EAC/B,CAAC,sBAA8C,EAAE,EAAE,CAAC;QAClD,sBAAsB,CAAC,MAAM;QAC7B,sBAAsB,CAAC,UAAU;QACjC,sBAAsB,CAAC,OAAO;KAC/B,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;GACpD,sBAAsB,CAwFlC","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { IncomeStatement, IncomeStatementStatus } from './income-statement'\nimport { IncomeStatementLineItem } from './income-statement-line-item'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_income-statement_history_0',\n (incomeStatementHistory: IncomeStatementHistory) => [\n incomeStatementHistory.originalId,\n incomeStatementHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_income-statement_history_1',\n (incomeStatementHistory: IncomeStatementHistory) => [\n incomeStatementHistory.domain,\n incomeStatementHistory.originalId,\n incomeStatementHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of IncomeStatement' })\nexport class IncomeStatementHistory implements HistoryEntityInterface<IncomeStatement> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((incomeStatementHistory: IncomeStatementHistory) => incomeStatementHistory.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal year of the income statement' })\n year?: number // 회계 연도\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal quarter of the income statement' })\n quarter?: number // 회계 분기\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal month of the income statement' })\n month?: number // 회계 월\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Total revenue recorded in the income statement' })\n revenue?: number // 손익계산서에 기록된 총수익\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Total expenses recorded in the income statement' })\n expense?: number // 손익계산서에 기록된 총비용\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Net income calculated as revenue minus expenses' })\n netIncome?: number // 총수익에서 총비용을 뺀 순이익\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Indicates whether this income statement is active' })\n active?: boolean // 이 손익계산서가 활성 상태인지 여부\n\n @OneToMany(type => IncomeStatementLineItem, lineItem => lineItem.statement)\n @Field(type => [IncomeStatementLineItem], { nullable: true })\n lineItems?: IncomeStatementLineItem[] // 계정별 브레이크다운\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((incomeStatementHistory: IncomeStatementHistory) => incomeStatementHistory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((incomeStatementHistory: IncomeStatementHistory) => incomeStatementHistory.updater)\n updaterId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Account } from '../account/account';
3
+ import { IncomeStatement } from './income-statement';
4
+ export declare class IncomeStatementLineItem {
5
+ readonly id: string;
6
+ statement: IncomeStatement;
7
+ statementId: string;
8
+ account: Account;
9
+ accountId: string;
10
+ amount: number;
11
+ description?: string;
12
+ createdAt?: Date;
13
+ updatedAt?: Date;
14
+ deletedAt?: Date;
15
+ creator?: User;
16
+ creatorId?: string;
17
+ updater?: User;
18
+ updaterId?: string;
19
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IncomeStatementLineItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const account_1 = require("../account/account");
9
+ const income_statement_1 = require("./income-statement");
10
+ let IncomeStatementLineItem = class IncomeStatementLineItem {
11
+ };
12
+ exports.IncomeStatementLineItem = IncomeStatementLineItem;
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
+ ], IncomeStatementLineItem.prototype, "id", void 0);
18
+ tslib_1.__decorate([
19
+ (0, typeorm_1.ManyToOne)(type => income_statement_1.IncomeStatement, statement => statement.lineItems),
20
+ (0, type_graphql_1.Field)(type => income_statement_1.IncomeStatement, { description: 'The income statement this line item belongs to' }),
21
+ tslib_1.__metadata("design:type", income_statement_1.IncomeStatement // 해당 라인 아이템이 속한 손익계산서
22
+ )
23
+ ], IncomeStatementLineItem.prototype, "statement", void 0);
24
+ tslib_1.__decorate([
25
+ (0, typeorm_1.RelationId)((lineItem) => lineItem.statement),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], IncomeStatementLineItem.prototype, "statementId", void 0);
28
+ tslib_1.__decorate([
29
+ (0, typeorm_1.ManyToOne)(type => account_1.Account),
30
+ (0, type_graphql_1.Field)(type => account_1.Account, { description: 'The financial account associated with this line item' }),
31
+ tslib_1.__metadata("design:type", account_1.Account // 라인 아이템에 연결된 계정
32
+ )
33
+ ], IncomeStatementLineItem.prototype, "account", void 0);
34
+ tslib_1.__decorate([
35
+ (0, typeorm_1.RelationId)((lineItem) => lineItem.account),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], IncomeStatementLineItem.prototype, "accountId", void 0);
38
+ tslib_1.__decorate([
39
+ (0, typeorm_1.Column)({ nullable: false }),
40
+ (0, type_graphql_1.Field)({ nullable: false, description: 'The monetary amount associated with this account for the income statement' }),
41
+ tslib_1.__metadata("design:type", Number)
42
+ ], IncomeStatementLineItem.prototype, "amount", void 0);
43
+ tslib_1.__decorate([
44
+ (0, typeorm_1.Column)({ nullable: true }),
45
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Optional description or notes about this line item' }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], IncomeStatementLineItem.prototype, "description", void 0);
48
+ tslib_1.__decorate([
49
+ (0, typeorm_1.CreateDateColumn)(),
50
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when this line item was created' }),
51
+ tslib_1.__metadata("design:type", Date // 라인 아이템이 생성된 날짜 및 시간
52
+ )
53
+ ], IncomeStatementLineItem.prototype, "createdAt", void 0);
54
+ tslib_1.__decorate([
55
+ (0, typeorm_1.UpdateDateColumn)(),
56
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when this line item was last updated' }),
57
+ tslib_1.__metadata("design:type", Date // 라인 아이템이 마지막으로 업데이트된 날짜 및 시간
58
+ )
59
+ ], IncomeStatementLineItem.prototype, "updatedAt", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.DeleteDateColumn)(),
62
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when this line item was deleted' }),
63
+ tslib_1.__metadata("design:type", Date // 라인 아이템이 삭제된 날짜 및 시간
64
+ )
65
+ ], IncomeStatementLineItem.prototype, "deletedAt", void 0);
66
+ tslib_1.__decorate([
67
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
68
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created this line item' }),
69
+ tslib_1.__metadata("design:type", auth_base_1.User // 라인 아이템을 생성한 사용자
70
+ )
71
+ ], IncomeStatementLineItem.prototype, "creator", void 0);
72
+ tslib_1.__decorate([
73
+ (0, typeorm_1.RelationId)((lineItem) => lineItem.creator),
74
+ tslib_1.__metadata("design:type", String)
75
+ ], IncomeStatementLineItem.prototype, "creatorId", void 0);
76
+ tslib_1.__decorate([
77
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
78
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated this line item' }),
79
+ tslib_1.__metadata("design:type", auth_base_1.User // 라인 아이템을 마지막으로 업데이트한 사용자
80
+ )
81
+ ], IncomeStatementLineItem.prototype, "updater", void 0);
82
+ tslib_1.__decorate([
83
+ (0, typeorm_1.RelationId)((lineItem) => lineItem.updater),
84
+ tslib_1.__metadata("design:type", String)
85
+ ], IncomeStatementLineItem.prototype, "updaterId", void 0);
86
+ exports.IncomeStatementLineItem = IncomeStatementLineItem = tslib_1.__decorate([
87
+ (0, type_graphql_1.ObjectType)({
88
+ description: 'Line item for an income statement, representing a detailed breakdown of financial accounts'
89
+ }),
90
+ (0, typeorm_1.Entity)(),
91
+ (0, typeorm_1.Index)('ix_income_statement_line_item_0', (lineItem) => [lineItem.statement, lineItem.account], {
92
+ unique: false,
93
+ where: '"deleted_at" IS NULL'
94
+ })
95
+ ], IncomeStatementLineItem);
96
+ //# sourceMappingURL=income-statement-line-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"income-statement-line-item.js","sourceRoot":"","sources":["../../../server/service/income-statement/income-statement-line-item.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAoD;AAGpD,yDAAgD;AAChD,gDAA4C;AAC5C,yDAAoD;AAc7C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAoDnC,CAAA;AApDY,0DAAuB;AAGzB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;mDACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,kCAAe,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,S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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 { IncomeStatement } from './income-statement'\n\n@ObjectType({\n description: 'Line item for an income statement, representing a detailed breakdown of financial accounts'\n})\n@Entity()\n@Index(\n 'ix_income_statement_line_item_0',\n (lineItem: IncomeStatementLineItem) => [lineItem.statement, lineItem.account],\n {\n unique: false,\n where: '\"deleted_at\" IS NULL'\n }\n)\nexport class IncomeStatementLineItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => IncomeStatement, statement => statement.lineItems)\n @Field(type => IncomeStatement, { description: 'The income statement this line item belongs to' })\n statement: IncomeStatement // 해당 라인 아이템이 속한 손익계산서\n\n @RelationId((lineItem: IncomeStatementLineItem) => 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: IncomeStatementLineItem) => lineItem.account)\n accountId: string // 계정의 ID\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The monetary amount associated with this account for the income statement' })\n amount: number // 계정과 관련된 금액\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Optional description or notes about 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: IncomeStatementLineItem) => 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: IncomeStatementLineItem) => lineItem.updater)\n updaterId?: string // 업데이트한 사용자의 ID\n}\n"]}
@@ -4,18 +4,18 @@ exports.IncomeStatementMutation = 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 income_statement_1 = require("./income-statement");
9
9
  const income_statement_type_1 = require("./income-statement-type");
10
10
  let IncomeStatementMutation = class IncomeStatementMutation {
11
11
  async createIncomeStatement(incomeStatement, context) {
12
12
  const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(income_statement_1.IncomeStatement).save(Object.assign(Object.assign({}, incomeStatement), { domain, creator: user, updater: user }));
13
+ const result = await (0, shell_1.getRepository)(income_statement_1.IncomeStatement, tx).save(Object.assign(Object.assign({}, incomeStatement), { domain, creator: user, updater: user }));
14
14
  return result;
15
15
  }
16
16
  async updateIncomeStatement(id, patch, context) {
17
17
  const { domain, user, tx } = context.state;
18
- const repository = tx.getRepository(income_statement_1.IncomeStatement);
18
+ const repository = (0, shell_1.getRepository)(income_statement_1.IncomeStatement, tx);
19
19
  const incomeStatement = await repository.findOne({
20
20
  where: { domain: { id: domain.id }, id }
21
21
  });
@@ -27,7 +27,7 @@ let IncomeStatementMutation = class IncomeStatementMutation {
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 incomeStatementRepo = tx.getRepository(income_statement_1.IncomeStatement);
30
+ const incomeStatementRepo = (0, shell_1.getRepository)(income_statement_1.IncomeStatement, 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 IncomeStatementMutation = class IncomeStatementMutation {
47
47
  }
48
48
  async deleteIncomeStatement(id, context) {
49
49
  const { domain, tx } = context.state;
50
- await tx.getRepository(income_statement_1.IncomeStatement).delete({ domain: { id: domain.id }, id });
51
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
50
+ await (0, shell_1.getRepository)(income_statement_1.IncomeStatement, tx).delete({ domain: { id: domain.id }, id });
52
51
  return true;
53
52
  }
54
53
  async deleteIncomeStatements(ids, context) {
55
54
  const { domain, tx } = context.state;
56
- await tx.getRepository(income_statement_1.IncomeStatement).delete({
55
+ await (0, shell_1.getRepository)(income_statement_1.IncomeStatement, 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 importIncomeStatements(incomeStatements, context) {
@@ -73,6 +71,7 @@ let IncomeStatementMutation = class IncomeStatementMutation {
73
71
  exports.IncomeStatementMutation = IncomeStatementMutation;
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 => income_statement_1.IncomeStatement, { description: 'To create new IncomeStatement' }),
77
76
  tslib_1.__param(0, (0, type_graphql_1.Arg)('incomeStatement')),
78
77
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -82,6 +81,7 @@ tslib_1.__decorate([
82
81
  ], IncomeStatementMutation.prototype, "createIncomeStatement", 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 => income_statement_1.IncomeStatement, { description: 'To modify IncomeStatement 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
  ], IncomeStatementMutation.prototype, "updateIncomeStatement", 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 => [income_statement_1.IncomeStatement], { description: "To modify multiple IncomeStatements' information" }),
96
97
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [income_statement_type_1.IncomeStatementPatch])),
97
98
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -101,6 +102,7 @@ tslib_1.__decorate([
101
102
  ], IncomeStatementMutation.prototype, "updateMultipleIncomeStatement", 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 IncomeStatement' }),
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
  ], IncomeStatementMutation.prototype, "deleteIncomeStatement", 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 IncomeStatements' }),
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
  ], IncomeStatementMutation.prototype, "deleteIncomeStatements", 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 IncomeStatements' }),
123
127
  tslib_1.__param(0, (0, type_graphql_1.Arg)('incomeStatements', type => [income_statement_type_1.IncomeStatementPatch])),
124
128
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"income-statement-mutation.js","sourceRoot":"","sources":["../../../server/service/income-statement/income-statement-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,yDAAoD;AACpD,mEAAkF;AAG3E,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC,qBAAqB,CACD,eAAmC,EACpD,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,kCAAe,CAAC,CAAC,IAAI,iCACtD,eAAe,KAClB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,qBAAqB,CACd,EAAU,EACP,KAA2B,EAClC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,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,kBAAG,GAAE,CAAA;;;;qEAaP;kCAtIU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,kCAAe,CAAC;GACb,uBAAuB,CAuInC","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 { IncomeStatement } from './income-statement'\nimport { NewIncomeStatement, IncomeStatementPatch } from './income-statement-type'\n\n@Resolver(IncomeStatement)\nexport class IncomeStatementMutation {\n @Directive('@transaction')\n @Mutation(returns => IncomeStatement, { description: 'To create new IncomeStatement' })\n async createIncomeStatement(\n @Arg('incomeStatement') incomeStatement: NewIncomeStatement,\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(IncomeStatement).save({\n ...incomeStatement,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => IncomeStatement, { description: 'To modify IncomeStatement information' })\n async updateIncomeStatement(\n @Arg('id') id: string,\n @Arg('patch') patch: IncomeStatementPatch,\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(IncomeStatement)\n const incomeStatement = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...incomeStatement,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [IncomeStatement], { description: \"To modify multiple IncomeStatements' information\" })\n async updateMultipleIncomeStatement(\n @Arg('patches', type => [IncomeStatementPatch]) patches: IncomeStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement[]> {\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 incomeStatementRepo = tx.getRepository(IncomeStatement)\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 incomeStatementRepo.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 incomeStatement = await incomeStatementRepo.findOneBy({ id: updateRecord.id })\n\n const result = await incomeStatementRepo.save({\n ...incomeStatement,\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 IncomeStatement' })\n async deleteIncomeStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(IncomeStatement).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 IncomeStatements' })\n async deleteIncomeStatements(\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(IncomeStatement).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 IncomeStatements' })\n async importIncomeStatements(\n @Arg('incomeStatements', type => [IncomeStatementPatch]) incomeStatements: IncomeStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n incomeStatements.map(async (incomeStatement: IncomeStatementPatch) => {\n const createdIncomeStatement: IncomeStatement = await tx\n .getRepository(IncomeStatement)\n .save({ domain, ...incomeStatement })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"income-statement-mutation.js","sourceRoot":"","sources":["../../../server/service/income-statement/income-statement-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,yDAAoD;AACpD,mEAAkF;AAG3E,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAI5B,AAAN,KAAK,CAAC,qBAAqB,CACD,eAAmC,EACpD,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,kCAAe,EAAE,EAAE,CAAC,CAAC,IAAI,iCACvD,eAAe,KAClB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,qBAAqB,CACd,EAAU,EACP,KAA2B,EAClC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,kCAAe,EAAE,EAAE,CAAC,CAAA;QACrD,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC/C,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,eAAe,GACf,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,6BAA6B,CACe,OAA+B,EACxE,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,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C,OAAO,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;oEAMxD;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,qCAAqC,EAAE,CAAC;IAElF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qEAUP;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,qCAAqC,EAAE,CAAC;IAElF,mBAAA,IAAA,kBAAG,EAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,4CAAoB,CAAC,CAAC,CAAA;IACvD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qEAaP;kCAzIU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,kCAAe,CAAC;GACb,uBAAuB,CA0InC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { IncomeStatement } from './income-statement'\nimport { NewIncomeStatement, IncomeStatementPatch } from './income-statement-type'\n\n@Resolver(IncomeStatement)\nexport class IncomeStatementMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => IncomeStatement, { description: 'To create new IncomeStatement' })\n async createIncomeStatement(\n @Arg('incomeStatement') incomeStatement: NewIncomeStatement,\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(IncomeStatement, tx).save({\n ...incomeStatement,\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 => IncomeStatement, { description: 'To modify IncomeStatement information' })\n async updateIncomeStatement(\n @Arg('id') id: string,\n @Arg('patch') patch: IncomeStatementPatch,\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(IncomeStatement, tx)\n const incomeStatement = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...incomeStatement,\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 => [IncomeStatement], { description: \"To modify multiple IncomeStatements' information\" })\n async updateMultipleIncomeStatement(\n @Arg('patches', type => [IncomeStatementPatch]) patches: IncomeStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<IncomeStatement[]> {\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 incomeStatementRepo = getRepository(IncomeStatement, 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 incomeStatementRepo.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 incomeStatement = await incomeStatementRepo.findOneBy({ id: updateRecord.id })\n\n const result = await incomeStatementRepo.save({\n ...incomeStatement,\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 IncomeStatement' })\n async deleteIncomeStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(IncomeStatement, 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 IncomeStatements' })\n async deleteIncomeStatements(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(IncomeStatement, 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 IncomeStatements' })\n async importIncomeStatements(\n @Arg('incomeStatements', type => [IncomeStatementPatch]) incomeStatements: IncomeStatementPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n incomeStatements.map(async (incomeStatement: IncomeStatementPatch) => {\n const createdIncomeStatement: IncomeStatement = await tx\n .getRepository(IncomeStatement)\n .save({ domain, ...incomeStatement })\n })\n )\n\n return true\n }\n}\n"]}