@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
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingCategoryHistory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const typeorm_history_1 = require("@operato/typeorm-history");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ const env_1 = require("@things-factory/env");
10
+ const shell_1 = require("@things-factory/shell");
11
+ const ORMCONFIG = env_1.config.get('ormconfig', {});
12
+ const DATABASE_TYPE = ORMCONFIG.type;
13
+ let AccountingCategoryHistory = class AccountingCategoryHistory {
14
+ constructor() {
15
+ this.version = 1;
16
+ }
17
+ };
18
+ exports.AccountingCategoryHistory = AccountingCategoryHistory;
19
+ tslib_1.__decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
21
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], AccountingCategoryHistory.prototype, "id", void 0);
24
+ tslib_1.__decorate([
25
+ (0, typeorm_1.Column)({ nullable: true, default: 1 }),
26
+ (0, type_graphql_1.Field)({ nullable: true }),
27
+ tslib_1.__metadata("design:type", Number)
28
+ ], AccountingCategoryHistory.prototype, "version", void 0);
29
+ tslib_1.__decorate([
30
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
31
+ (0, type_graphql_1.Field)({ nullable: true }),
32
+ tslib_1.__metadata("design:type", shell_1.Domain)
33
+ ], AccountingCategoryHistory.prototype, "domain", void 0);
34
+ tslib_1.__decorate([
35
+ (0, typeorm_1.RelationId)((accountingCategoryHistory) => accountingCategoryHistory.domain),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], AccountingCategoryHistory.prototype, "domainId", void 0);
38
+ tslib_1.__decorate([
39
+ (0, typeorm_1.Column)(),
40
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Account category code' }),
41
+ tslib_1.__metadata("design:type", String)
42
+ ], AccountingCategoryHistory.prototype, "code", void 0);
43
+ tslib_1.__decorate([
44
+ (0, typeorm_1.Column)(),
45
+ (0, type_graphql_1.Field)({ nullable: true }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], AccountingCategoryHistory.prototype, "name", void 0);
48
+ tslib_1.__decorate([
49
+ (0, typeorm_1.Column)({ nullable: true }),
50
+ (0, type_graphql_1.Field)({ nullable: true }),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], AccountingCategoryHistory.prototype, "description", void 0);
53
+ tslib_1.__decorate([
54
+ (0, typeorm_1.Column)({ nullable: true }),
55
+ (0, type_graphql_1.Field)({ nullable: true }),
56
+ tslib_1.__metadata("design:type", Boolean)
57
+ ], AccountingCategoryHistory.prototype, "active", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.ManyToOne)(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.children, {
60
+ nullable: true
61
+ }),
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ tslib_1.__metadata("design:type", AccountingCategoryHistory)
64
+ ], AccountingCategoryHistory.prototype, "parent", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.RelationId)((accountingCategoryHistory) => accountingCategoryHistory.parent),
67
+ tslib_1.__metadata("design:type", String)
68
+ ], AccountingCategoryHistory.prototype, "parentId", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.OneToMany)(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.parent),
71
+ (0, type_graphql_1.Field)(type => [AccountingCategoryHistory]),
72
+ tslib_1.__metadata("design:type", Array)
73
+ ], AccountingCategoryHistory.prototype, "children", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.Column)({ nullable: true }),
76
+ (0, type_graphql_1.Field)({ nullable: true }),
77
+ tslib_1.__metadata("design:type", Date)
78
+ ], AccountingCategoryHistory.prototype, "createdAt", void 0);
79
+ tslib_1.__decorate([
80
+ (0, typeorm_1.Column)({ nullable: true }),
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ tslib_1.__metadata("design:type", Date)
83
+ ], AccountingCategoryHistory.prototype, "updatedAt", void 0);
84
+ tslib_1.__decorate([
85
+ (0, typeorm_1.Column)({ nullable: true }),
86
+ (0, type_graphql_1.Field)({ nullable: true }),
87
+ tslib_1.__metadata("design:type", Date)
88
+ ], AccountingCategoryHistory.prototype, "deletedAt", void 0);
89
+ tslib_1.__decorate([
90
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
91
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
92
+ tslib_1.__metadata("design:type", auth_base_1.User)
93
+ ], AccountingCategoryHistory.prototype, "creator", void 0);
94
+ tslib_1.__decorate([
95
+ (0, typeorm_1.RelationId)((accountingCategory) => accountingCategory.creator),
96
+ tslib_1.__metadata("design:type", String)
97
+ ], AccountingCategoryHistory.prototype, "creatorId", void 0);
98
+ tslib_1.__decorate([
99
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
100
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
101
+ tslib_1.__metadata("design:type", auth_base_1.User)
102
+ ], AccountingCategoryHistory.prototype, "updater", void 0);
103
+ tslib_1.__decorate([
104
+ (0, typeorm_1.RelationId)((accountingCategory) => accountingCategory.updater),
105
+ tslib_1.__metadata("design:type", String)
106
+ ], AccountingCategoryHistory.prototype, "updaterId", void 0);
107
+ tslib_1.__decorate([
108
+ (0, typeorm_history_1.HistoryOriginalIdColumn)(),
109
+ tslib_1.__metadata("design:type", String)
110
+ ], AccountingCategoryHistory.prototype, "originalId", void 0);
111
+ tslib_1.__decorate([
112
+ (0, typeorm_history_1.HistoryActionColumn)({
113
+ nullable: false,
114
+ type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
115
+ ? 'enum'
116
+ : DATABASE_TYPE == 'oracle'
117
+ ? 'varchar2'
118
+ : 'smallint',
119
+ enum: typeorm_history_1.HistoryActionType
120
+ }),
121
+ tslib_1.__metadata("design:type", String)
122
+ ], AccountingCategoryHistory.prototype, "action", void 0);
123
+ exports.AccountingCategoryHistory = AccountingCategoryHistory = tslib_1.__decorate([
124
+ (0, typeorm_1.Entity)(),
125
+ (0, typeorm_1.Index)('ix_accounting_category_history_0', (accountingCategoryHistory) => [
126
+ accountingCategoryHistory.originalId,
127
+ accountingCategoryHistory.version
128
+ ], { unique: true }),
129
+ (0, typeorm_1.Index)('ix_accounting_category_history_1', (accountingCategoryHistory) => [
130
+ accountingCategoryHistory.domain,
131
+ accountingCategoryHistory.originalId,
132
+ accountingCategoryHistory.version
133
+ ], { unique: true }),
134
+ (0, type_graphql_1.ObjectType)({ description: 'History Entity of Accounting Category' })
135
+ ], AccountingCategoryHistory);
136
+ //# sourceMappingURL=accounting-category-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-category-history.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAAyG;AAEzG,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAI9C,MAAM,SAAS,GAAG,YA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AAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;GACxD,yBAAyB,CAqFrC","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Entity, Index, Column, ManyToOne, RelationId, PrimaryGeneratedColumn, OneToMany } 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 { AccountingCategory } from './accounting-category'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_accounting_category_history_0',\n (accountingCategoryHistory: AccountingCategoryHistory) => [\n accountingCategoryHistory.originalId,\n accountingCategoryHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_accounting_category_history_1',\n (accountingCategoryHistory: AccountingCategoryHistory) => [\n accountingCategoryHistory.domain,\n accountingCategoryHistory.originalId,\n accountingCategoryHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Accounting Category' })\nexport class AccountingCategoryHistory implements HistoryEntityInterface<AccountingCategory> {\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((accountingCategoryHistory: AccountingCategoryHistory) => accountingCategoryHistory.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Account category code' })\n code?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @ManyToOne(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.children, {\n nullable: true\n })\n @Field({ nullable: true })\n parent?: AccountingCategoryHistory\n\n @RelationId((accountingCategoryHistory: AccountingCategoryHistory) => accountingCategoryHistory.parent)\n parentId?: string\n\n @OneToMany(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.parent)\n @Field(type => [AccountingCategoryHistory])\n children?: AccountingCategoryHistory[]\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(type => User, { nullable: true })\n creator?: User\n\n @RelationId((accountingCategory: AccountingCategoryHistory) => accountingCategory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingCategory: AccountingCategoryHistory) => accountingCategory.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"]}
@@ -4,18 +4,18 @@ exports.AccountingCategoryMutation = 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 accounting_category_1 = require("./accounting-category");
9
9
  const accounting_category_type_1 = require("./accounting-category-type");
10
10
  let AccountingCategoryMutation = class AccountingCategoryMutation {
11
11
  async createAccountingCategory(accountingCategory, context) {
12
12
  const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(accounting_category_1.AccountingCategory).save(Object.assign(Object.assign({}, accountingCategory), { domain, creator: user, updater: user }));
13
+ const result = await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).save(Object.assign(Object.assign({}, accountingCategory), { domain, creator: user, updater: user }));
14
14
  return result;
15
15
  }
16
16
  async updateAccountingCategory(id, patch, context) {
17
17
  const { domain, user, tx } = context.state;
18
- const repository = tx.getRepository(accounting_category_1.AccountingCategory);
18
+ const repository = (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx);
19
19
  const accountingCategory = await repository.findOne({
20
20
  where: { domain: { id: domain.id }, id }
21
21
  });
@@ -27,7 +27,7 @@ let AccountingCategoryMutation = class AccountingCategoryMutation {
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 accountingCategoryRepo = tx.getRepository(accounting_category_1.AccountingCategory);
30
+ const accountingCategoryRepo = (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, 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 AccountingCategoryMutation = class AccountingCategoryMutation {
47
47
  }
48
48
  async deleteAccountingCategory(id, context) {
49
49
  const { domain, tx } = context.state;
50
- await tx.getRepository(accounting_category_1.AccountingCategory).delete({ domain: { id: domain.id }, id });
51
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
50
+ await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).delete({ domain: { id: domain.id }, id });
52
51
  return true;
53
52
  }
54
53
  async deleteAccountingCategories(ids, context) {
55
54
  const { domain, tx } = context.state;
56
- await tx.getRepository(accounting_category_1.AccountingCategory).delete({
55
+ await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, 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 importAccountingCategories(accountingCategories, context) {
@@ -73,6 +71,7 @@ let AccountingCategoryMutation = class AccountingCategoryMutation {
73
71
  exports.AccountingCategoryMutation = AccountingCategoryMutation;
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 => accounting_category_1.AccountingCategory, { description: 'To create new AccountingCategory' }),
77
76
  tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingCategory')),
78
77
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -82,6 +81,7 @@ tslib_1.__decorate([
82
81
  ], AccountingCategoryMutation.prototype, "createAccountingCategory", 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 => accounting_category_1.AccountingCategory, { description: 'To modify AccountingCategory 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
  ], AccountingCategoryMutation.prototype, "updateAccountingCategory", 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 => [accounting_category_1.AccountingCategory], { description: "To modify multiple AccountingCategories' information" }),
96
97
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [accounting_category_type_1.AccountingCategoryPatch])),
97
98
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -101,6 +102,7 @@ tslib_1.__decorate([
101
102
  ], AccountingCategoryMutation.prototype, "updateMultipleAccountingCategory", 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 AccountingCategory' }),
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
  ], AccountingCategoryMutation.prototype, "deleteAccountingCategory", 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 AccountingCategories' }),
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
  ], AccountingCategoryMutation.prototype, "deleteAccountingCategories", 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 AccountingCategories' }),
123
127
  tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingCategories', type => [accounting_category_type_1.AccountingCategoryPatch])),
124
128
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"accounting-category-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,E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AAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC9D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAaP;qCAtIU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAuItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { AccountingCategory } from './accounting-category'\nimport { NewAccountingCategory, AccountingCategoryPatch } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryMutation {\n @Directive('@transaction')\n @Mutation(returns => AccountingCategory, { description: 'To create new AccountingCategory' })\n async createAccountingCategory(\n @Arg('accountingCategory') accountingCategory: NewAccountingCategory,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(AccountingCategory).save({\n ...accountingCategory,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => AccountingCategory, { description: 'To modify AccountingCategory information' })\n async updateAccountingCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(AccountingCategory)\n const accountingCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingCategory,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [AccountingCategory], { description: \"To modify multiple AccountingCategories' information\" })\n async updateMultipleAccountingCategory(\n @Arg('patches', type => [AccountingCategoryPatch]) patches: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory[]> {\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 accountingCategoryRepo = tx.getRepository(AccountingCategory)\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 accountingCategoryRepo.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 accountingCategory = await accountingCategoryRepo.findOneBy({ id: updateRecord.id })\n\n const result = await accountingCategoryRepo.save({\n ...accountingCategory,\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 AccountingCategory' })\n async deleteAccountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(AccountingCategory).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 AccountingCategories' })\n async deleteAccountingCategories(\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(AccountingCategory).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 AccountingCategories' })\n async importAccountingCategories(\n @Arg('accountingCategories', type => [AccountingCategoryPatch]) accountingCategories: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingCategories.map(async (accountingCategory: AccountingCategoryPatch) => {\n const createdAccountingCategory: AccountingCategory = await tx\n .getRepository(AccountingCategory)\n .save({ domain, ...accountingCategory })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"accounting-category-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAI/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,iCAC1D,kBAAkB,KACrB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAA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AE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC9D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAaP;qCAzIU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CA0ItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingCategory } from './accounting-category'\nimport { NewAccountingCategory, AccountingCategoryPatch } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => AccountingCategory, { description: 'To create new AccountingCategory' })\n async createAccountingCategory(\n @Arg('accountingCategory') accountingCategory: NewAccountingCategory,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingCategory, tx).save({\n ...accountingCategory,\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 => AccountingCategory, { description: 'To modify AccountingCategory information' })\n async updateAccountingCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingCategory, tx)\n const accountingCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingCategory,\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 => [AccountingCategory], { description: \"To modify multiple AccountingCategories' information\" })\n async updateMultipleAccountingCategory(\n @Arg('patches', type => [AccountingCategoryPatch]) patches: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory[]> {\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 accountingCategoryRepo = getRepository(AccountingCategory, 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 accountingCategoryRepo.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 accountingCategory = await accountingCategoryRepo.findOneBy({ id: updateRecord.id })\n\n const result = await accountingCategoryRepo.save({\n ...accountingCategory,\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 AccountingCategory' })\n async deleteAccountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, 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 AccountingCategories' })\n async deleteAccountingCategories(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, 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 AccountingCategories' })\n async importAccountingCategories(\n @Arg('accountingCategories', type => [AccountingCategoryPatch]) accountingCategories: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingCategories.map(async (accountingCategory: AccountingCategoryPatch) => {\n const createdAccountingCategory: AccountingCategory = await tx\n .getRepository(AccountingCategory)\n .save({ domain, ...accountingCategory })\n })\n )\n\n return true\n }\n}\n"]}
@@ -3,6 +3,7 @@ import { User } from '@things-factory/auth-base';
3
3
  import { AccountingCategory } from './accounting-category';
4
4
  import { AccountingCategoryList } from './accounting-category-type';
5
5
  export declare class AccountingCategoryQuery {
6
+ accountingCategoryRoots(params: ListParam, context: ResolverContext): Promise<AccountingCategoryList>;
6
7
  accountingCategory(id: string, context: ResolverContext): Promise<AccountingCategory>;
7
8
  accountingCategories(params: ListParam, context: ResolverContext): Promise<AccountingCategoryList>;
8
9
  domain(accountingCategory: AccountingCategory): Promise<Domain>;
@@ -3,11 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AccountingCategoryQuery = 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 shell_1 = require("@things-factory/shell");
7
8
  const auth_base_1 = require("@things-factory/auth-base");
8
9
  const accounting_category_1 = require("./accounting-category");
9
10
  const accounting_category_type_1 = require("./accounting-category-type");
10
11
  let AccountingCategoryQuery = class AccountingCategoryQuery {
12
+ async accountingCategoryRoots(params, context) {
13
+ const { domain } = context.state;
14
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
15
+ domain,
16
+ params,
17
+ repository: await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory),
18
+ searchables: ['name', 'description', 'code']
19
+ }).andWhere({ domain: { id: domain.id }, parent: { id: (0, typeorm_1.IsNull)() } });
20
+ const [items, total] = await queryBuilder.getManyAndCount();
21
+ return { items, total };
22
+ }
11
23
  async accountingCategory(id, context) {
12
24
  const { domain } = context.state;
13
25
  return await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory).findOne({
@@ -37,6 +49,16 @@ let AccountingCategoryQuery = class AccountingCategoryQuery {
37
49
  };
38
50
  exports.AccountingCategoryQuery = AccountingCategoryQuery;
39
51
  tslib_1.__decorate([
52
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
53
+ (0, type_graphql_1.Query)(returns => accounting_category_type_1.AccountingCategoryList, { nullable: true, description: 'To fetch a Root AccountingCategorys' }),
54
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
55
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
56
+ tslib_1.__metadata("design:type", Function),
57
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
58
+ tslib_1.__metadata("design:returntype", Promise)
59
+ ], AccountingCategoryQuery.prototype, "accountingCategoryRoots", null);
60
+ tslib_1.__decorate([
61
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
40
62
  (0, type_graphql_1.Query)(returns => accounting_category_1.AccountingCategory, { nullable: true, description: 'To fetch a AccountingCategory' }),
41
63
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
64
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -45,6 +67,7 @@ tslib_1.__decorate([
45
67
  tslib_1.__metadata("design:returntype", Promise)
46
68
  ], AccountingCategoryQuery.prototype, "accountingCategory", null);
47
69
  tslib_1.__decorate([
70
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
48
71
  (0, type_graphql_1.Query)(returns => accounting_category_type_1.AccountingCategoryList, { description: 'To fetch multiple AccountingCategories' }),
49
72
  tslib_1.__param(0, (0, type_graphql_1.Args)()),
50
73
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"accounting-category-query.js","sourceRo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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 { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryList } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryQuery {\n @Query(returns => AccountingCategory!, { nullable: true, description: 'To fetch a AccountingCategory' })\n async accountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<AccountingCategory> {\n const { domain } = context.state\n\n return await getRepository(AccountingCategory).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => AccountingCategoryList, { description: 'To fetch multiple AccountingCategories' })\n async accountingCategories(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategoryList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingCategory),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() accountingCategory: AccountingCategory): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: accountingCategory.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() accountingCategory: AccountingCategory): Promise<User> {\n return await getRepository(User).findOneBy({ id: accountingCategory.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() accountingCategory: AccountingCategory): Promise<User> {\n return await getRepository(User).findOneBy({ id: accountingCategory.creatorId })\n }\n}\n"]}
1
+ {"version":3,"file":"accounting-category-query.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAgC;AAChC,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC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G,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMrD;AAIK;IAFL,IAAA,wBAAS,EAAC,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAEjG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;mEAe1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCAhEU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAiEnC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { IsNull } from 'typeorm'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryList } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => AccountingCategoryList, { nullable: true, description: 'To fetch a Root AccountingCategorys' })\n async accountingCategoryRoots(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategoryList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingCategory),\n searchables: ['name', 'description', 'code']\n }).andWhere({ domain: { id: domain.id }, parent: { id: IsNull() } })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => AccountingCategory!, { nullable: true, description: 'To fetch a AccountingCategory' })\n async accountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<AccountingCategory> {\n const { domain } = context.state\n\n return await getRepository(AccountingCategory).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => AccountingCategoryList, { description: 'To fetch multiple AccountingCategories' })\n async accountingCategories(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategoryList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingCategory),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() accountingCategory: AccountingCategory): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: accountingCategory.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() accountingCategory: AccountingCategory): Promise<User> {\n return await getRepository(User).findOneBy({ id: accountingCategory.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() accountingCategory: AccountingCategory): Promise<User> {\n return await getRepository(User).findOneBy({ id: accountingCategory.creatorId })\n }\n}\n"]}
@@ -17,4 +17,5 @@ export declare class AccountingCategory {
17
17
  creatorId?: string;
18
18
  updater?: User;
19
19
  updaterId?: string;
20
+ deletedAt?: Date;
20
21
  }
@@ -54,7 +54,7 @@ tslib_1.__decorate([
54
54
  ], AccountingCategory.prototype, "parentId", void 0);
55
55
  tslib_1.__decorate([
56
56
  (0, typeorm_1.OneToMany)(type => AccountingCategory, accountingCategory => accountingCategory.parent),
57
- (0, type_graphql_1.Field)(type => [AccountingCategory]),
57
+ (0, type_graphql_1.Field)(type => [AccountingCategory], { nullable: true }),
58
58
  tslib_1.__metadata("design:type", Array)
59
59
  ], AccountingCategory.prototype, "children", void 0);
60
60
  tslib_1.__decorate([
@@ -85,10 +85,21 @@ tslib_1.__decorate([
85
85
  (0, typeorm_1.RelationId)((accountingCategory) => accountingCategory.updater),
86
86
  tslib_1.__metadata("design:type", String)
87
87
  ], AccountingCategory.prototype, "updaterId", void 0);
88
+ tslib_1.__decorate([
89
+ (0, typeorm_1.DeleteDateColumn)(),
90
+ (0, type_graphql_1.Field)({ nullable: true }),
91
+ tslib_1.__metadata("design:type", Date)
92
+ ], AccountingCategory.prototype, "deletedAt", void 0);
88
93
  exports.AccountingCategory = AccountingCategory = tslib_1.__decorate([
89
94
  (0, typeorm_1.Entity)(),
90
- (0, typeorm_1.Index)('ix_accounting_category_0', (accountingCategory) => [accountingCategory.domain, accountingCategory.name], { unique: true }),
91
- (0, typeorm_1.Index)('ix_accounting_category_1', (accountingCategory) => [accountingCategory.domain, accountingCategory.code], { unique: true }),
95
+ (0, typeorm_1.Index)('ix_accounting_category_0', (accountingCategory) => [accountingCategory.domain, accountingCategory.name], {
96
+ unique: true,
97
+ where: '"deleted_at" IS NULL'
98
+ }),
99
+ (0, typeorm_1.Index)('ix_accounting_category_1', (accountingCategory) => [accountingCategory.domain, accountingCategory.code], {
100
+ unique: true,
101
+ where: '"deleted_at" IS NULL'
102
+ }),
92
103
  (0, type_graphql_1.ObjectType)({ description: 'Entity for AccountingCategory' })
93
104
  ], AccountingCategory);
94
105
  //# sourceMappingURL=accounting-category.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounting-category.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAy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E;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAChG,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAChG,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CA4D9B","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n@Entity()\n@Index(\n 'ix_accounting_category_0',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.name],\n { unique: true }\n)\n@Index(\n 'ix_accounting_category_1',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.code],\n { unique: true }\n)\n@ObjectType({ description: 'Entity for AccountingCategory' })\nexport class AccountingCategory {\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((accountingCategory: AccountingCategory) => accountingCategory.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Account category code' })\n code?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @ManyToOne(type => AccountingCategory, accountingCategory => accountingCategory.children, { nullable: true })\n @Field({ nullable: true })\n parent?: AccountingCategory\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.parent)\n parentId?: string\n\n @OneToMany(type => AccountingCategory, accountingCategory => accountingCategory.parent)\n @Field(type => [AccountingCategory])\n children?: AccountingCategory[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"accounting-category.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAyD;AAEzD,iDAA8C;AAC9C,yDAAgD;AAoBzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAgE9B,CAAA;AAhEY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;;oDACjE;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;gDACnD;AAIb;IAFC,IAAA,gBAAM,GA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,CAgE9B","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n@Entity()\n@Index(\n 'ix_accounting_category_0',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.name],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@Index(\n 'ix_accounting_category_1',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.code],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@ObjectType({ description: 'Entity for AccountingCategory' })\nexport class AccountingCategory {\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((accountingCategory: AccountingCategory) => accountingCategory.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Account category code' })\n code?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @ManyToOne(type => AccountingCategory, accountingCategory => accountingCategory.children, { nullable: true })\n @Field({ nullable: true })\n parent?: AccountingCategory\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.parent)\n parentId?: string\n\n @OneToMany(type => AccountingCategory, accountingCategory => accountingCategory.parent)\n @Field(type => [AccountingCategory], { nullable: true })\n children?: AccountingCategory[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.updater)\n updaterId?: string\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { HistoryEntitySubscriber } from '@operato/typeorm-history';
2
+ import { AccountingCategory } from './accounting-category';
3
+ import { AccountingCategoryHistory } from './accounting-category-history';
4
+ export declare class AccountingCategoryHistoryEntitySubscriber extends HistoryEntitySubscriber<AccountingCategory, AccountingCategoryHistory> {
5
+ get entity(): typeof AccountingCategory;
6
+ get historyEntity(): typeof AccountingCategoryHistory;
7
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingCategoryHistoryEntitySubscriber = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const typeorm_history_1 = require("@operato/typeorm-history");
7
+ const accounting_category_1 = require("./accounting-category");
8
+ const accounting_category_history_1 = require("./accounting-category-history");
9
+ let AccountingCategoryHistoryEntitySubscriber = class AccountingCategoryHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
10
+ get entity() {
11
+ return accounting_category_1.AccountingCategory;
12
+ }
13
+ get historyEntity() {
14
+ return accounting_category_history_1.AccountingCategoryHistory;
15
+ }
16
+ };
17
+ exports.AccountingCategoryHistoryEntitySubscriber = AccountingCategoryHistoryEntitySubscriber;
18
+ exports.AccountingCategoryHistoryEntitySubscriber = AccountingCategoryHistoryEntitySubscriber = tslib_1.__decorate([
19
+ (0, typeorm_1.EventSubscriber)()
20
+ ], AccountingCategoryHistoryEntitySubscriber);
21
+ //# sourceMappingURL=event-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/accounting-category/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,+DAA0D;AAC1D,+EAAyE;AAGlE,IAAM,yCAAyC,GAA/C,MAAM,yCAA0C,SAAQ,yCAG9D;IACC,IAAW,MAAM;QACf,OAAO,wCAAkB,CAAA;IAC3B,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,uDAAyB,CAAA;IAClC,CAAC;CACF,CAAA;AAXY,8FAAyC;oDAAzC,yCAAyC;IADrD,IAAA,yBAAe,GAAE;GACL,yCAAyC,CAWrD","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryHistory } from './accounting-category-history'\n\n@EventSubscriber()\nexport class AccountingCategoryHistoryEntitySubscriber extends HistoryEntitySubscriber<\n AccountingCategory,\n AccountingCategoryHistory\n> {\n public get entity() {\n return AccountingCategory\n }\n\n public get historyEntity() {\n return AccountingCategoryHistory\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { AccountingCategory } from './accounting-category';
2
2
  import { AccountingCategoryQuery } from './accounting-category-query';
3
3
  import { AccountingCategoryMutation } from './accounting-category-mutation';
4
+ import { AccountingCategoryHistoryEntitySubscriber } from './event-subscriber';
4
5
  export declare const entities: (typeof AccountingCategory)[];
5
6
  export declare const resolvers: (typeof AccountingCategoryQuery | typeof AccountingCategoryMutation)[];
6
- export declare const subscribers: any[];
7
+ export declare const subscribers: (typeof AccountingCategoryHistoryEntitySubscriber)[];
@@ -4,7 +4,9 @@ exports.subscribers = exports.resolvers = exports.entities = void 0;
4
4
  const accounting_category_1 = require("./accounting-category");
5
5
  const accounting_category_query_1 = require("./accounting-category-query");
6
6
  const accounting_category_mutation_1 = require("./accounting-category-mutation");
7
- exports.entities = [accounting_category_1.AccountingCategory];
7
+ const accounting_category_history_1 = require("./accounting-category-history");
8
+ const event_subscriber_1 = require("./event-subscriber");
9
+ exports.entities = [accounting_category_1.AccountingCategory, accounting_category_history_1.AccountingCategoryHistory];
8
10
  exports.resolvers = [accounting_category_query_1.AccountingCategoryQuery, accounting_category_mutation_1.AccountingCategoryMutation];
9
- exports.subscribers = [];
11
+ exports.subscribers = [event_subscriber_1.AccountingCategoryHistoryEntitySubscriber];
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/accounting-category/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,2EAAqE;AACrE,iFAA2E;AAE9D,QAAA,QAAQ,GAAG,CAAC,wCAAkB,CAAC,CAAA;AAC/B,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryQuery } from './accounting-category-query'\nimport { AccountingCategoryMutation } from './accounting-category-mutation'\n\nexport const entities = [AccountingCategory]\nexport const resolvers = [AccountingCategoryQuery, AccountingCategoryMutation]\nexport const subscribers = []\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/accounting-category/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,2EAAqE;AACrE,iFAA2E;AAC3E,+EAAyE;AACzE,yDAA8E;AAEjE,QAAA,QAAQ,GAAG,CAAC,wCAAkB,EAAE,uDAAyB,CAAC,CAAA;AAC1D,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,CAAC,4DAAyC,CAAC,CAAA","sourcesContent":["import { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryQuery } from './accounting-category-query'\nimport { AccountingCategoryMutation } from './accounting-category-mutation'\nimport { AccountingCategoryHistory } from './accounting-category-history'\nimport { AccountingCategoryHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [AccountingCategory, AccountingCategoryHistory]\nexport const resolvers = [AccountingCategoryQuery, AccountingCategoryMutation]\nexport const subscribers = [AccountingCategoryHistoryEntitySubscriber]\n"]}
@@ -0,0 +1,26 @@
1
+ import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { Domain } from '@things-factory/shell';
4
+ import { Transaction } from '../transaction/transaction';
5
+ import { AccountingDocument } from './accounting-document';
6
+ export declare class AccountingDocumentHistory implements HistoryEntityInterface<AccountingDocument> {
7
+ readonly id: string;
8
+ version?: number;
9
+ domain?: Domain;
10
+ domainId?: string;
11
+ transaction: Transaction;
12
+ transactionId: string;
13
+ documentType: string;
14
+ documentUrl: string;
15
+ description?: string;
16
+ createdAt?: Date;
17
+ updatedAt?: Date;
18
+ deletedAt?: Date;
19
+ creator?: User;
20
+ creatorId?: string;
21
+ updater?: User;
22
+ updaterId?: string;
23
+ thumbnail?: string;
24
+ originalId: string;
25
+ action: HistoryActionType;
26
+ }