@things-factory/accounting 10.1.124 → 10.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist-client/route.d.ts +1 -1
  2. package/dist-client/route.js +0 -12
  3. package/dist-client/route.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-server/index.d.ts +0 -1
  6. package/dist-server/index.js +0 -1
  7. package/dist-server/index.js.map +1 -1
  8. package/dist-server/service/account/account-history.d.ts +13 -6
  9. package/dist-server/service/account/account-history.js +44 -17
  10. package/dist-server/service/account/account-history.js.map +1 -1
  11. package/dist-server/service/account/account-mutation.js +8 -8
  12. package/dist-server/service/account/account-mutation.js.map +1 -1
  13. package/dist-server/service/account/account-query.js +2 -2
  14. package/dist-server/service/account/account-query.js.map +1 -1
  15. package/dist-server/service/account/account-type.d.ts +16 -0
  16. package/dist-server/service/account/account-type.js +71 -13
  17. package/dist-server/service/account/account-type.js.map +1 -1
  18. package/dist-server/service/account/account.d.ts +9 -3
  19. package/dist-server/service/account/account.js +34 -8
  20. package/dist-server/service/account/account.js.map +1 -1
  21. package/dist-server/service/account/index.d.ts +1 -1
  22. package/dist-server/service/accounting-category/accounting-category-mutation.js +8 -8
  23. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  24. package/dist-server/service/accounting-category/accounting-category-query.js +2 -2
  25. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
  26. package/dist-server/service/accounting-category/index.d.ts +1 -1
  27. package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
  28. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
  29. package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
  30. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
  31. package/dist-server/service/accounting-document/index.d.ts +1 -1
  32. package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
  33. package/dist-server/service/bank-account/bank-account-history.js +46 -59
  34. package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
  35. package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
  36. package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
  37. package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
  38. package/dist-server/service/bank-account/bank-account-query.js +2 -0
  39. package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
  40. package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
  41. package/dist-server/service/bank-account/bank-account-service.js +21 -0
  42. package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
  43. package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
  44. package/dist-server/service/bank-account/bank-account-type.js +45 -69
  45. package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
  46. package/dist-server/service/bank-account/bank-account.d.ts +14 -17
  47. package/dist-server/service/bank-account/bank-account.js +45 -57
  48. package/dist-server/service/bank-account/bank-account.js.map +1 -1
  49. package/dist-server/service/bank-account/index.d.ts +1 -1
  50. package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
  51. package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
  52. package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
  53. package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
  54. package/dist-server/service/bank-statement/bank-statement.js +109 -0
  55. package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
  56. package/dist-server/service/bank-statement/index.d.ts +5 -0
  57. package/dist-server/service/bank-statement/index.js +9 -0
  58. package/dist-server/service/bank-statement/index.js.map +1 -0
  59. package/dist-server/service/cash-flow-type.d.ts +5 -0
  60. package/dist-server/service/cash-flow-type.js +15 -0
  61. package/dist-server/service/cash-flow-type.js.map +1 -0
  62. package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
  63. package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
  64. package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
  65. package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
  66. package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
  67. package/dist-server/service/financial-statement/financial-statement-history.js +44 -33
  68. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  69. package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
  70. package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
  71. package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
  72. package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
  73. package/dist-server/service/financial-statement/financial-statement-mutation.js +11 -136
  74. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  75. package/dist-server/service/financial-statement/financial-statement-query.d.ts +8 -7
  76. package/dist-server/service/financial-statement/financial-statement-query.js +42 -32
  77. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  78. package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
  79. package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
  80. package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
  81. package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
  82. package/dist-server/service/financial-statement/financial-statement.js +70 -62
  83. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  84. package/dist-server/service/financial-statement/index.d.ts +4 -3
  85. package/dist-server/service/financial-statement/index.js +2 -2
  86. package/dist-server/service/financial-statement/index.js.map +1 -1
  87. package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -6
  88. package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
  89. package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -2
  90. package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
  91. package/dist-server/service/fiscal-month/index.d.ts +1 -1
  92. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -6
  93. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
  94. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -2
  95. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
  96. package/dist-server/service/fiscal-quarter/index.d.ts +1 -1
  97. package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -6
  98. package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
  99. package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -2
  100. package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
  101. package/dist-server/service/fiscal-year/index.d.ts +1 -1
  102. package/dist-server/service/index.d.ts +15 -3
  103. package/dist-server/service/index.js +30 -13
  104. package/dist-server/service/index.js.map +1 -1
  105. package/dist-server/service/payment/index.d.ts +2 -1
  106. package/dist-server/service/payment/index.js +1 -0
  107. package/dist-server/service/payment/index.js.map +1 -1
  108. package/dist-server/service/payment/payment-history.d.ts +9 -16
  109. package/dist-server/service/payment/payment-history.js +36 -70
  110. package/dist-server/service/payment/payment-history.js.map +1 -1
  111. package/dist-server/service/payment/payment-mutation.d.ts +0 -1
  112. package/dist-server/service/payment/payment-mutation.js +19 -84
  113. package/dist-server/service/payment/payment-mutation.js.map +1 -1
  114. package/dist-server/service/payment/payment-query.d.ts +3 -0
  115. package/dist-server/service/payment/payment-query.js +32 -3
  116. package/dist-server/service/payment/payment-query.js.map +1 -1
  117. package/dist-server/service/payment/payment-service.d.ts +16 -0
  118. package/dist-server/service/payment/payment-service.js +140 -0
  119. package/dist-server/service/payment/payment-service.js.map +1 -0
  120. package/dist-server/service/payment/payment-targets.d.ts +31 -0
  121. package/dist-server/service/payment/payment-targets.js +19 -0
  122. package/dist-server/service/payment/payment-targets.js.map +1 -0
  123. package/dist-server/service/payment/payment-type.d.ts +13 -17
  124. package/dist-server/service/payment/payment-type.js +35 -51
  125. package/dist-server/service/payment/payment-type.js.map +1 -1
  126. package/dist-server/service/payment/payment.d.ts +23 -22
  127. package/dist-server/service/payment/payment.js +65 -95
  128. package/dist-server/service/payment/payment.js.map +1 -1
  129. package/dist-server/service/payment/transfer-target.d.ts +1 -0
  130. package/dist-server/service/payment/transfer-target.js +43 -0
  131. package/dist-server/service/payment/transfer-target.js.map +1 -0
  132. package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
  133. package/dist-server/service/recurring-cash-item/index.js +10 -0
  134. package/dist-server/service/recurring-cash-item/index.js.map +1 -0
  135. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
  136. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
  137. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
  138. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
  139. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
  140. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
  141. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
  142. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
  143. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
  144. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
  145. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
  146. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
  147. package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
  148. package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
  149. package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
  150. package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
  151. package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
  152. package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
  153. package/dist-server/service/transaction/index.d.ts +2 -2
  154. package/dist-server/service/transaction/transaction-history.d.ts +42 -15
  155. package/dist-server/service/transaction/transaction-history.js +160 -54
  156. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  157. package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
  158. package/dist-server/service/transaction/transaction-mutation.js +18 -83
  159. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  160. package/dist-server/service/transaction/transaction-period.d.ts +16 -0
  161. package/dist-server/service/transaction/transaction-period.js +49 -0
  162. package/dist-server/service/transaction/transaction-period.js.map +1 -0
  163. package/dist-server/service/transaction/transaction-query.d.ts +12 -0
  164. package/dist-server/service/transaction/transaction-query.js +86 -4
  165. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  166. package/dist-server/service/transaction/transaction-service.d.ts +30 -0
  167. package/dist-server/service/transaction/transaction-service.js +130 -0
  168. package/dist-server/service/transaction/transaction-service.js.map +1 -0
  169. package/dist-server/service/transaction/transaction-type.d.ts +39 -7
  170. package/dist-server/service/transaction/transaction-type.js +145 -23
  171. package/dist-server/service/transaction/transaction-type.js.map +1 -1
  172. package/dist-server/service/transaction/transaction.d.ts +58 -31
  173. package/dist-server/service/transaction/transaction.js +213 -111
  174. package/dist-server/service/transaction/transaction.js.map +1 -1
  175. package/dist-server/tsconfig.tsbuildinfo +1 -1
  176. package/package.json +8 -4
  177. package/things-factory.config.js +0 -4
  178. package/translations/en.json +34 -2
  179. package/translations/ja.json +0 -1
  180. package/translations/ko.json +34 -2
  181. package/translations/ms.json +0 -1
  182. package/translations/zh.json +0 -1
  183. package/dist-client/pages/account/account-importer.d.ts +0 -22
  184. package/dist-client/pages/account/account-importer.js +0 -99
  185. package/dist-client/pages/account/account-importer.js.map +0 -1
  186. package/dist-client/pages/account/account-list-page.d.ts +0 -57
  187. package/dist-client/pages/account/account-list-page.js +0 -306
  188. package/dist-client/pages/account/account-list-page.js.map +0 -1
  189. package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
  190. package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
  191. package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
  192. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
  193. package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
  194. package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
  195. package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
  196. package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
  197. package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
  198. package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
  199. package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
  200. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
  201. package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
  202. package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
  203. package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
  204. package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
  205. package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
  206. package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
  207. package/dist-client/pages/payment/payment-importer.d.ts +0 -23
  208. package/dist-client/pages/payment/payment-importer.js +0 -92
  209. package/dist-client/pages/payment/payment-importer.js.map +0 -1
  210. package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
  211. package/dist-client/pages/payment/payment-list-page.js +0 -317
  212. package/dist-client/pages/payment/payment-list-page.js.map +0 -1
  213. package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
  214. package/dist-client/pages/transaction/transaction-importer.js +0 -99
  215. package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
  216. package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
  217. package/dist-client/pages/transaction/transaction-list-page.js +0 -280
  218. package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
  219. package/dist-server/controllers/index.d.ts +0 -1
  220. package/dist-server/controllers/index.js +0 -5
  221. package/dist-server/controllers/index.js.map +0 -1
  222. package/dist-server/controllers/summary-statements.d.ts +0 -4
  223. package/dist-server/controllers/summary-statements.js +0 -149
  224. package/dist-server/controllers/summary-statements.js.map +0 -1
  225. package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
  226. package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
  227. package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
  228. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
  229. package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -94
  230. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
  231. package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
  232. package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
  233. package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
  234. package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
  235. package/dist-server/service/income-statement/event-subscriber.js +0 -21
  236. package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
  237. package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
  238. package/dist-server/service/income-statement/income-statement-history.js +0 -146
  239. package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
  240. package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
  241. package/dist-server/service/income-statement/income-statement-line-item.js +0 -96
  242. package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
  243. package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
  244. package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
  245. package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
  246. package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
  247. package/dist-server/service/income-statement/income-statement-query.js +0 -81
  248. package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
  249. package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
  250. package/dist-server/service/income-statement/income-statement-type.js +0 -77
  251. package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
  252. package/dist-server/service/income-statement/income-statement.d.ts +0 -28
  253. package/dist-server/service/income-statement/income-statement.js +0 -137
  254. package/dist-server/service/income-statement/income-statement.js.map +0 -1
  255. package/dist-server/service/income-statement/index.d.ts +0 -8
  256. package/dist-server/service/income-statement/index.js +0 -13
  257. package/dist-server/service/income-statement/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-statement-query.js","sourceRoot":"","sources":["../../../server/service/bank-statement/bank-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAsH;AAEtH,iDAAuG;AACvG,yDAAgD;AAEhD,qDAAgD;AAGzC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AANY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;gDACzD;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;gDACpD;4BALF,iBAAiB;IAD7B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;GAC5C,iBAAiB,CAM7B;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,aAAa,CAAY,EAAU,EAAS,OAAwB;QACxE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,8BAAa,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IACjG,CAAC;IAIK,AAAN,KAAK,CAAC,cAAc,CACO,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,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L,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAEtF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;wDAa3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,8BAAa;;gDAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,8BAAa;;iDAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,8BAAa;;iDAE7C;6BAxCU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAyC9B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive, ObjectType, Field, Int } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { BankStatement } from './bank-statement'\n\n@ObjectType({ description: 'A page of bank statements' })\nexport class BankStatementList {\n @Field(type => [BankStatement], { description: 'The statements on this page' })\n items: BankStatement[]\n\n @Field(type => Int, { description: 'How many there are in all' })\n total: number\n}\n\n@Resolver(BankStatement)\nexport class BankStatementQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => BankStatement, { nullable: true, description: 'To fetch a BankStatement' })\n async bankStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BankStatement | null> {\n const { domain } = context.state\n\n return await getRepository(BankStatement).findOne({ where: { domain: { id: domain.id }, id } })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => BankStatementList, { description: 'To fetch multiple BankStatements' })\n async bankStatements(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<BankStatementList> {\n const { domain } = context.state\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: getRepository(BankStatement),\n searchables: ['filename', 'bankName', 'accountNumber']\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() statement: BankStatement): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: statement.domainId })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() statement: BankStatement): Promise<User | null> {\n return statement.creatorId ? await getRepository(User).findOneBy({ id: statement.creatorId }) : null\n }\n\n @FieldResolver(type => User, { nullable: true })\n async updater(@Root() statement: BankStatement): Promise<User | null> {\n return statement.updaterId ? await getRepository(User).findOneBy({ id: statement.updaterId }) : null\n }\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ /**
4
+ * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row
5
+ * and the same file is not read twice.
6
+ */
7
+ export declare class BankStatement {
8
+ readonly id: string;
9
+ domain?: Domain;
10
+ domainId?: string;
11
+ filename: string;
12
+ fileHash: string;
13
+ bankName: string;
14
+ accountNumber: string;
15
+ periodStart?: string;
16
+ periodEnd?: string;
17
+ timezones?: Record<string, string>;
18
+ rawRows: any[];
19
+ createdAt?: Date;
20
+ updatedAt?: Date;
21
+ deletedAt?: Date;
22
+ creator?: User;
23
+ creatorId?: string;
24
+ updater?: User;
25
+ updaterId?: string;
26
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankStatement = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ /**
10
+ * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row
11
+ * and the same file is not read twice.
12
+ */
13
+ let BankStatement = class BankStatement {
14
+ };
15
+ exports.BankStatement = BankStatement;
16
+ tslib_1.__decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
18
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], BankStatement.prototype, "id", void 0);
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
23
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain whose statement it is' }),
24
+ tslib_1.__metadata("design:type", shell_1.Domain)
25
+ ], BankStatement.prototype, "domain", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.RelationId)((statement) => statement.domain),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], BankStatement.prototype, "domainId", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.Column)(),
32
+ (0, type_graphql_1.Field)({ description: 'The file name it was uploaded under' }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], BankStatement.prototype, "filename", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.Column)(),
37
+ (0, type_graphql_1.Field)({ description: 'Hash of the file - the same file is read once' }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], BankStatement.prototype, "fileHash", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)(),
42
+ (0, type_graphql_1.Field)({ description: 'The bank, as the file says' }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], BankStatement.prototype, "bankName", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.Column)(),
47
+ (0, type_graphql_1.Field)({ description: 'The account number, as the file says' }),
48
+ tslib_1.__metadata("design:type", String)
49
+ ], BankStatement.prototype, "accountNumber", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.Column)({ nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the first day the file covers' }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], BankStatement.prototype, "periodStart", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.Column)({ nullable: true }),
57
+ (0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the last day the file covers' }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], BankStatement.prototype, "periodEnd", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
62
+ tslib_1.__metadata("design:type", Object)
63
+ ], BankStatement.prototype, "timezones", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.Column)({ type: 'simple-json' }),
66
+ tslib_1.__metadata("design:type", Array)
67
+ ], BankStatement.prototype, "rawRows", void 0);
68
+ tslib_1.__decorate([
69
+ (0, typeorm_1.CreateDateColumn)(),
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was read' }),
71
+ tslib_1.__metadata("design:type", Date)
72
+ ], BankStatement.prototype, "createdAt", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.UpdateDateColumn)(),
75
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it last changed' }),
76
+ tslib_1.__metadata("design:type", Date)
77
+ ], BankStatement.prototype, "updatedAt", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.DeleteDateColumn)(),
80
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was deleted' }),
81
+ tslib_1.__metadata("design:type", Date)
82
+ ], BankStatement.prototype, "deletedAt", void 0);
83
+ tslib_1.__decorate([
84
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
85
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who read it' }),
86
+ tslib_1.__metadata("design:type", auth_base_1.User)
87
+ ], BankStatement.prototype, "creator", void 0);
88
+ tslib_1.__decorate([
89
+ (0, typeorm_1.RelationId)((statement) => statement.creator),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], BankStatement.prototype, "creatorId", void 0);
92
+ tslib_1.__decorate([
93
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
94
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who last changed it' }),
95
+ tslib_1.__metadata("design:type", auth_base_1.User)
96
+ ], BankStatement.prototype, "updater", void 0);
97
+ tslib_1.__decorate([
98
+ (0, typeorm_1.RelationId)((statement) => statement.updater),
99
+ tslib_1.__metadata("design:type", String)
100
+ ], BankStatement.prototype, "updaterId", void 0);
101
+ exports.BankStatement = BankStatement = tslib_1.__decorate([
102
+ (0, typeorm_1.Entity)(),
103
+ (0, typeorm_1.Index)('ix_bank_statement_0', (statement) => [statement.domain, statement.fileHash], {
104
+ unique: true,
105
+ where: '"deleted_at" IS NULL'
106
+ }),
107
+ (0, type_graphql_1.ObjectType)({ description: 'A bank statement file as it was read' })
108
+ ], BankStatement);
109
+ //# sourceMappingURL=bank-statement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-statement.js","sourceRoot":"","sources":["../../../server/service/bank-statement/bank-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAoD;AAEpD,iDAA8C;AAC9C,yDAAgD;AAEhD;;;GAGG;AAOI,IAAM,aAAa,GAAnB,MAAM,aAAa;CAmEzB,CAAA;AAnEY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EA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,CAAC,OAAO,CAAC;;gDAC1C;wBAlEP,aAAa;IANzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,SAAwB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QAClG,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,aAAa,CAmEzB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, ObjectType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n/**\n * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row\n * and the same file is not read twice.\n */\n@Entity()\n@Index('ix_bank_statement_0', (statement: BankStatement) => [statement.domain, statement.fileHash], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'A bank statement file as it was read' })\nexport class BankStatement {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain whose statement it is' })\n domain?: Domain\n\n @RelationId((statement: BankStatement) => statement.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'The file name it was uploaded under' })\n filename: string\n\n @Column()\n @Field({ description: 'Hash of the file - the same file is read once' })\n fileHash: string\n\n @Column()\n @Field({ description: 'The bank, as the file says' })\n bankName: string\n\n @Column()\n @Field({ description: 'The account number, as the file says' })\n accountNumber: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the first day the file covers' })\n periodStart?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the last day the file covers' })\n periodEnd?: string\n\n @Column({ type: 'simple-json', nullable: true })\n timezones?: Record<string, string>\n\n @Column({ type: 'simple-json' })\n rawRows: any[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'When it was read' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'When it last changed' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When it was deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who read it' })\n creator?: User\n\n @RelationId((statement: BankStatement) => statement.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who last changed it' })\n updater?: User\n\n @RelationId((statement: BankStatement) => statement.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { BankStatement } from './bank-statement';
2
+ import { BankStatementQuery } from './bank-statement-query';
3
+ export declare const entities: (typeof BankStatement)[];
4
+ export declare const resolvers: (typeof BankStatementQuery)[];
5
+ export declare const subscribers: any[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribers = exports.resolvers = exports.entities = void 0;
4
+ const bank_statement_1 = require("./bank-statement");
5
+ const bank_statement_query_1 = require("./bank-statement-query");
6
+ exports.entities = [bank_statement_1.BankStatement];
7
+ exports.resolvers = [bank_statement_query_1.BankStatementQuery];
8
+ exports.subscribers = [];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/bank-statement/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,iEAA2D;AAE9C,QAAA,QAAQ,GAAG,CAAC,8BAAa,CAAC,CAAA;AAC1B,QAAA,SAAS,GAAG,CAAC,yCAAkB,CAAC,CAAA;AAChC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { BankStatement } from './bank-statement'\nimport { BankStatementQuery } from './bank-statement-query'\n\nexport const entities = [BankStatement]\nexport const resolvers = [BankStatementQuery]\nexport const subscribers = []\n"]}
@@ -0,0 +1,5 @@
1
+ /** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */
2
+ export declare enum CashFlowType {
3
+ INCOME = "INCOME",
4
+ EXPENSE = "EXPENSE"
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CashFlowType = void 0;
4
+ const type_graphql_1 = require("type-graphql");
5
+ /** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */
6
+ var CashFlowType;
7
+ (function (CashFlowType) {
8
+ CashFlowType["INCOME"] = "INCOME";
9
+ CashFlowType["EXPENSE"] = "EXPENSE";
10
+ })(CashFlowType || (exports.CashFlowType = CashFlowType = {}));
11
+ (0, type_graphql_1.registerEnumType)(CashFlowType, {
12
+ name: 'CashFlowType',
13
+ description: 'Direction of a cash movement - money in or money out'
14
+ });
15
+ //# sourceMappingURL=cash-flow-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cash-flow-type.js","sourceRoot":"","sources":["../../server/service/cash-flow-type.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAE/C,qHAAqH;AACrH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,sDAAsD;CACpE,CAAC,CAAA","sourcesContent":["import { registerEnumType } from 'type-graphql'\n\n/** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */\nexport enum CashFlowType {\n INCOME = 'INCOME',\n EXPENSE = 'EXPENSE'\n}\n\nregisterEnumType(CashFlowType, {\n name: 'CashFlowType',\n description: 'Direction of a cash movement - money in or money out'\n})\n"]}
@@ -125,7 +125,10 @@ let FinancialInstitutionMutation = class FinancialInstitutionMutation {
125
125
  async importFinancialInstitutions(financialInstitutions, context) {
126
126
  const { domain, tx } = context.state;
127
127
  await Promise.all(financialInstitutions.map(async (financialInstitution) => {
128
- const createdFinancialInstitution = await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution, tx).save({ domain, ...financialInstitution });
128
+ const createdFinancialInstitution = await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution, tx).save({
129
+ domain,
130
+ ...financialInstitution
131
+ });
129
132
  }));
130
133
  return true;
131
134
  }
@@ -133,6 +136,7 @@ let FinancialInstitutionMutation = class FinancialInstitutionMutation {
133
136
  exports.FinancialInstitutionMutation = FinancialInstitutionMutation;
134
137
  tslib_1.__decorate([
135
138
  (0, type_graphql_1.Directive)('@transaction'),
139
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
136
140
  (0, type_graphql_1.Mutation)(returns => financial_institution_1.FinancialInstitution, { description: 'To create new FinancialInstitution' }),
137
141
  tslib_1.__param(0, (0, type_graphql_1.Arg)('financialInstitution')),
138
142
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -142,6 +146,7 @@ tslib_1.__decorate([
142
146
  ], FinancialInstitutionMutation.prototype, "createFinancialInstitution", null);
143
147
  tslib_1.__decorate([
144
148
  (0, type_graphql_1.Directive)('@transaction'),
149
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
145
150
  (0, type_graphql_1.Mutation)(returns => financial_institution_1.FinancialInstitution, { description: 'To modify FinancialInstitution information' }),
146
151
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
147
152
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -152,6 +157,7 @@ tslib_1.__decorate([
152
157
  ], FinancialInstitutionMutation.prototype, "updateFinancialInstitution", null);
153
158
  tslib_1.__decorate([
154
159
  (0, type_graphql_1.Directive)('@transaction'),
160
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
155
161
  (0, type_graphql_1.Mutation)(returns => [financial_institution_1.FinancialInstitution], { description: "To modify multiple FinancialInstitutions' information" }),
156
162
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [financial_institution_type_1.FinancialInstitutionPatch])),
157
163
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -161,6 +167,7 @@ tslib_1.__decorate([
161
167
  ], FinancialInstitutionMutation.prototype, "updateMultipleFinancialInstitution", null);
162
168
  tslib_1.__decorate([
163
169
  (0, type_graphql_1.Directive)('@transaction'),
170
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
164
171
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete FinancialInstitution' }),
165
172
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
166
173
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -170,6 +177,7 @@ tslib_1.__decorate([
170
177
  ], FinancialInstitutionMutation.prototype, "deleteFinancialInstitution", null);
171
178
  tslib_1.__decorate([
172
179
  (0, type_graphql_1.Directive)('@transaction'),
180
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
173
181
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple FinancialInstitutions' }),
174
182
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
175
183
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -179,6 +187,7 @@ tslib_1.__decorate([
179
187
  ], FinancialInstitutionMutation.prototype, "deleteFinancialInstitutions", null);
180
188
  tslib_1.__decorate([
181
189
  (0, type_graphql_1.Directive)('@transaction'),
190
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
182
191
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple FinancialInstitutions' }),
183
192
  tslib_1.__param(0, (0, type_graphql_1.Arg)('financialInstitutions', type => [financial_institution_type_1.FinancialInstitutionPatch])),
184
193
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"financial-institution-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,qEAA0F;AAC1F,mEAA8D;AAC9D,6EAAiG;AAG1F,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAGjC,AAAN,KAAK,CAAC,0BAA0B,CAA8B,oBAA6C,EAAS,OAAwB;QAC1I,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,4CAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YAChE,GAAG,oBAAoB;YACvB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,IAAI,oBAAoB,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,kCAAgB,EACpB,IAAI,EACJ;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,oBAAoB,CAAC,SAAS;oBACpC,OAAO,EAAE,4CAAoB,CAAC,IAAI;oBAClC,KAAK,EAAE,MAAM,CAAC,EAAE;iBACjB;aACF,EACD,OAAO,CACR,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,0BAA0B,CACnB,EAAU,EACP,KAAgC,EACvC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,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c,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAEvF,mBAAA,IAAA,kBAAG,EAAC,uBAAuB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sDAAyB,CAAC,CAAC,CAAA;IACjE,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+EAWP;uCAjMU,4BAA4B;IADxC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,4BAA4B,CAkMxC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { NewFinancialInstitution, FinancialInstitutionPatch } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionMutation {\n @Directive('@transaction')\n @Mutation(returns => FinancialInstitution, { description: 'To create new FinancialInstitution' })\n async createFinancialInstitution(@Arg('financialInstitution') financialInstitution: NewFinancialInstitution, @Ctx() context: ResolverContext): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FinancialInstitution, tx).save({\n ...financialInstitution,\n domain,\n creator: user,\n updater: user\n })\n\n if (financialInstitution.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: financialInstitution.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => FinancialInstitution, { description: 'To modify FinancialInstitution information' })\n async updateFinancialInstitution(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialInstitutionPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FinancialInstitution, tx)\n const financialInstitution = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialInstitution,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [FinancialInstitution], { description: \"To modify multiple FinancialInstitutions' information\" })\n async updateMultipleFinancialInstitution(\n @Arg('patches', type => [FinancialInstitutionPatch]) patches: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution[]> {\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 financialInstitutionRepo = getRepository(FinancialInstitution, 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 financialInstitutionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 financialInstitution = await financialInstitutionRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!financialInstitution) {\n throw new Error(`failed to find financialInstitution to update: ${updateRecord.id}`)\n }\n\n const result = await financialInstitutionRepo.save({\n ...financialInstitution,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 FinancialInstitution' })\n async deleteFinancialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).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 FinancialInstitutions' })\n async deleteFinancialInstitutions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).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 FinancialInstitutions' })\n async importFinancialInstitutions(\n @Arg('financialInstitutions', type => [FinancialInstitutionPatch]) financialInstitutions: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialInstitutions.map(async (financialInstitution: FinancialInstitutionPatch) => {\n const createdFinancialInstitution: FinancialInstitution = await getRepository(FinancialInstitution, tx).save({ domain, ...financialInstitution })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"financial-institution-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,qEAA0F;AAC1F,mEAA8D;AAC9D,6EAAiG;AAG1F,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAIjC,AAAN,KAAK,CAAC,0BAA0B,CACD,oBAA6C,EACnE,OAAwB;QAE/B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EAcP;uCA9MU,4BAA4B;IADxC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,4BAA4B,CA+MxC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { NewFinancialInstitution, FinancialInstitutionPatch } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => FinancialInstitution, { description: 'To create new FinancialInstitution' })\n async createFinancialInstitution(\n @Arg('financialInstitution') financialInstitution: NewFinancialInstitution,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FinancialInstitution, tx).save({\n ...financialInstitution,\n domain,\n creator: user,\n updater: user\n })\n\n if (financialInstitution.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: financialInstitution.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => FinancialInstitution, { description: 'To modify FinancialInstitution information' })\n async updateFinancialInstitution(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialInstitutionPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FinancialInstitution, tx)\n const financialInstitution = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialInstitution,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [FinancialInstitution], { description: \"To modify multiple FinancialInstitutions' information\" })\n async updateMultipleFinancialInstitution(\n @Arg('patches', type => [FinancialInstitutionPatch]) patches: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution[]> {\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 financialInstitutionRepo = getRepository(FinancialInstitution, 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 financialInstitutionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 financialInstitution = await financialInstitutionRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!financialInstitution) {\n throw new Error(`failed to find financialInstitution to update: ${updateRecord.id}`)\n }\n\n const result = await financialInstitutionRepo.save({\n ...financialInstitution,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete FinancialInstitution' })\n async deleteFinancialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple FinancialInstitutions' })\n async deleteFinancialInstitutions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).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 @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple FinancialInstitutions' })\n async importFinancialInstitutions(\n @Arg('financialInstitutions', type => [FinancialInstitutionPatch])\n financialInstitutions: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialInstitutions.map(async (financialInstitution: FinancialInstitutionPatch) => {\n const createdFinancialInstitution: FinancialInstitution = await getRepository(FinancialInstitution, tx).save({\n domain,\n ...financialInstitution\n })\n })\n )\n\n return true\n }\n}\n"]}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FinancialInstitutionQuery = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
6
7
  const attachment_base_1 = require("@things-factory/attachment-base");
7
8
  const shell_1 = require("@things-factory/shell");
8
9
  const auth_base_1 = require("@things-factory/auth-base");
@@ -11,18 +12,23 @@ const financial_institution_type_1 = require("./financial-institution-type");
11
12
  let FinancialInstitutionQuery = class FinancialInstitutionQuery {
12
13
  async financialInstitution(id, context) {
13
14
  const { domain } = context.state;
15
+ /* The seeded institutions belong to no domain - every domain reads them beside its own. */
14
16
  return await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution).findOne({
15
- where: { domain: { id: domain.id }, id }
17
+ where: [
18
+ { domain: (0, typeorm_1.IsNull)(), id },
19
+ { domain: { id: domain.id }, id }
20
+ ]
16
21
  });
17
22
  }
18
23
  async financialInstitutions(params, context) {
19
24
  const { domain } = context.state;
25
+ /* The seeded institutions belong to no domain - every domain reads them beside its own. */
20
26
  const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
21
- domain,
22
27
  params,
28
+ alias: 'institution',
23
29
  repository: await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution),
24
30
  searchables: ['name', 'description']
25
- });
31
+ }).andWhere('(institution.domain IS NULL OR institution.domain = :domain)', { domain: domain.id });
26
32
  const [items, total] = await queryBuilder.getManyAndCount();
27
33
  return { items, total };
28
34
  }
@@ -37,17 +43,18 @@ let FinancialInstitutionQuery = class FinancialInstitutionQuery {
37
43
  return attachment?.fullpath;
38
44
  }
39
45
  async domain(financialInstitution) {
40
- return financialInstitution.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: financialInstitution.domainId }));
46
+ return (financialInstitution.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: financialInstitution.domainId })));
41
47
  }
42
48
  async updater(financialInstitution) {
43
- return financialInstitution.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.updaterId }));
49
+ return (financialInstitution.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.updaterId })));
44
50
  }
45
51
  async creator(financialInstitution) {
46
- return financialInstitution.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.creatorId }));
52
+ return (financialInstitution.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.creatorId })));
47
53
  }
48
54
  };
49
55
  exports.FinancialInstitutionQuery = FinancialInstitutionQuery;
50
56
  tslib_1.__decorate([
57
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
51
58
  (0, type_graphql_1.Query)(returns => financial_institution_1.FinancialInstitution, { nullable: true, description: 'To fetch a FinancialInstitution' }),
52
59
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
53
60
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -56,6 +63,7 @@ tslib_1.__decorate([
56
63
  tslib_1.__metadata("design:returntype", Promise)
57
64
  ], FinancialInstitutionQuery.prototype, "financialInstitution", null);
58
65
  tslib_1.__decorate([
66
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
59
67
  (0, type_graphql_1.Query)(returns => financial_institution_type_1.FinancialInstitutionList, { description: 'To fetch multiple FinancialInstitutions' }),
60
68
  tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
61
69
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"financial-institution-query.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,mEAA8D;AAC9D,6EAAuE;AAGhE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAE9B,AAAN,KAAK,CAAC,oBAAoB,CAAY,EAAU,EAAS,OAAwB;QAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,4CAAoB,CAAC,CAAC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IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAuB,4CAAoB;;wDAE/D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAuB,4CAAoB;;wDAE/D;oCApDU,yBAAyB;IADrC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,yBAAyB,CAqDrC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { FinancialInstitutionList } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionQuery {\n @Query(returns => FinancialInstitution!, { nullable: true, description: 'To fetch a FinancialInstitution' })\n async financialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialInstitution> {\n const { domain } = context.state\n\n return await getRepository(FinancialInstitution).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => FinancialInstitutionList, { description: 'To fetch multiple FinancialInstitutions' })\n async financialInstitutions(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<FinancialInstitutionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(FinancialInstitution),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() financialInstitution: FinancialInstitution): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: financialInstitution.domainId },\n refType: FinancialInstitution.name,\n refBy: financialInstitution.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() financialInstitution: FinancialInstitution): Promise<Domain> {\n return financialInstitution.domainId && (await getRepository(Domain).findOneBy({ id: financialInstitution.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return financialInstitution.updaterId && (await getRepository(User).findOneBy({ id: financialInstitution.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return financialInstitution.creatorId && (await getRepository(User).findOneBy({ id: financialInstitution.creatorId }))\n }\n}\n"]}
1
+ {"version":3,"file":"financial-institution-query.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAgC;AAChC,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,mEAA8D;AAC9D,6EAAuE;AAGhE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAG9B,AAAN,KAAK,CAAC,oBAAoB,CAAY,EAAU,EAAS,OAAwB;QAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,2FAA2F;QAC3F,OAAO,MAAM,IAAA,qBAAa,EAAC,4CAAoB,CAAC,CAAC,OAAO,CAAC;YACvD,KAAK,EAAE;gBACL,EAAE,MAAM,EAAE,IAAA,gBAAM,GAAE,EAAE,EAAE,EAAE;gBACxB,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;aAClC;SACF,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,qBAAqB,CACA,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,2FAA2F;QAC3F,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,KAAK,EAAE,aAAa;YACpB,UAAU,EAAE,MAAM,IAAA,q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,CAAA;;6CAAuB,4CAAoB;;wDAI/D;oCApEU,yBAAyB;IADrC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,yBAAyB,CAqErC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { IsNull } from 'typeorm'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { FinancialInstitutionList } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => FinancialInstitution!, { nullable: true, description: 'To fetch a FinancialInstitution' })\n async financialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialInstitution> {\n const { domain } = context.state\n\n /* The seeded institutions belong to no domain - every domain reads them beside its own. */\n return await getRepository(FinancialInstitution).findOne({\n where: [\n { domain: IsNull(), id },\n { domain: { id: domain.id }, id }\n ]\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => FinancialInstitutionList, { description: 'To fetch multiple FinancialInstitutions' })\n async financialInstitutions(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitutionList> {\n const { domain } = context.state\n\n /* The seeded institutions belong to no domain - every domain reads them beside its own. */\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n alias: 'institution',\n repository: await getRepository(FinancialInstitution),\n searchables: ['name', 'description']\n }).andWhere('(institution.domain IS NULL OR institution.domain = :domain)', { domain: domain.id })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() financialInstitution: FinancialInstitution): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: financialInstitution.domainId },\n refType: FinancialInstitution.name,\n refBy: financialInstitution.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() financialInstitution: FinancialInstitution): Promise<Domain> {\n return (\n financialInstitution.domainId && (await getRepository(Domain).findOneBy({ id: financialInstitution.domainId }))\n )\n }\n\n @FieldResolver(type => User)\n async updater(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return (\n financialInstitution.updaterId && (await getRepository(User).findOneBy({ id: financialInstitution.updaterId }))\n )\n }\n\n @FieldResolver(type => User)\n async creator(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return (\n financialInstitution.creatorId && (await getRepository(User).findOneBy({ id: financialInstitution.creatorId }))\n )\n }\n}\n"]}
@@ -1,20 +1,22 @@
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 { FinancialStatement } from './financial-statement';
5
- import { FinancialStatementLineItem } from './financial-statement-line-item';
4
+ import { FinancialStatement, FinancialStatementKind } from './financial-statement';
5
+ /** Each version of a financial statement, written when it changes. */
6
6
  export declare class FinancialStatementHistory implements HistoryEntityInterface<FinancialStatement> {
7
7
  readonly id: string;
8
8
  version?: number;
9
9
  domain?: Domain;
10
10
  domainId?: string;
11
- year?: number;
12
- quarter?: number;
13
- month?: number;
14
- asset?: number;
15
- liability?: number;
16
- equity?: number;
17
- lineItems?: FinancialStatementLineItem[];
11
+ fiscalYear: number;
12
+ kind: FinancialStatementKind;
13
+ periodFrom: string;
14
+ periodTo: string;
15
+ filingKind: string;
16
+ filedOn: string;
17
+ issueNo: string;
18
+ source: string;
19
+ notes: string;
18
20
  createdAt?: Date;
19
21
  updatedAt?: Date;
20
22
  deletedAt?: Date;