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

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,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingDocumentHistory = 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 transaction_1 = require("../transaction/transaction");
12
+ const ORMCONFIG = env_1.config.get('ormconfig', {});
13
+ const DATABASE_TYPE = ORMCONFIG.type;
14
+ let AccountingDocumentHistory = class AccountingDocumentHistory {
15
+ constructor() {
16
+ this.version = 1;
17
+ }
18
+ };
19
+ exports.AccountingDocumentHistory = AccountingDocumentHistory;
20
+ tslib_1.__decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
22
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], AccountingDocumentHistory.prototype, "id", void 0);
25
+ tslib_1.__decorate([
26
+ (0, typeorm_1.Column)({ nullable: true, default: 1 }),
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ tslib_1.__metadata("design:type", Number)
29
+ ], AccountingDocumentHistory.prototype, "version", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
32
+ (0, type_graphql_1.Field)({ nullable: true }),
33
+ tslib_1.__metadata("design:type", shell_1.Domain)
34
+ ], AccountingDocumentHistory.prototype, "domain", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.domain),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], AccountingDocumentHistory.prototype, "domainId", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.documents),
41
+ (0, type_graphql_1.Field)(type => transaction_1.Transaction),
42
+ tslib_1.__metadata("design:type", transaction_1.Transaction)
43
+ ], AccountingDocumentHistory.prototype, "transaction", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.transaction),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], AccountingDocumentHistory.prototype, "transactionId", void 0);
48
+ tslib_1.__decorate([
49
+ (0, typeorm_1.Column)(),
50
+ (0, type_graphql_1.Field)({ nullable: false }),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], AccountingDocumentHistory.prototype, "documentType", void 0);
53
+ tslib_1.__decorate([
54
+ (0, typeorm_1.Column)(),
55
+ (0, type_graphql_1.Field)({ nullable: false }),
56
+ tslib_1.__metadata("design:type", String)
57
+ ], AccountingDocumentHistory.prototype, "documentUrl", void 0);
58
+ tslib_1.__decorate([
59
+ (0, typeorm_1.Column)({ nullable: true }),
60
+ (0, type_graphql_1.Field)({ nullable: true }),
61
+ tslib_1.__metadata("design:type", String)
62
+ ], AccountingDocumentHistory.prototype, "description", void 0);
63
+ tslib_1.__decorate([
64
+ (0, typeorm_1.Column)({ nullable: true }),
65
+ (0, type_graphql_1.Field)({ nullable: true }),
66
+ tslib_1.__metadata("design:type", Date)
67
+ ], AccountingDocumentHistory.prototype, "createdAt", void 0);
68
+ tslib_1.__decorate([
69
+ (0, typeorm_1.Column)({ nullable: true }),
70
+ (0, type_graphql_1.Field)({ nullable: true }),
71
+ tslib_1.__metadata("design:type", Date)
72
+ ], AccountingDocumentHistory.prototype, "updatedAt", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.Column)({ nullable: true }),
75
+ (0, type_graphql_1.Field)({ nullable: true }),
76
+ tslib_1.__metadata("design:type", Date)
77
+ ], AccountingDocumentHistory.prototype, "deletedAt", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
80
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
81
+ tslib_1.__metadata("design:type", auth_base_1.User)
82
+ ], AccountingDocumentHistory.prototype, "creator", void 0);
83
+ tslib_1.__decorate([
84
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.creator),
85
+ tslib_1.__metadata("design:type", String)
86
+ ], AccountingDocumentHistory.prototype, "creatorId", void 0);
87
+ tslib_1.__decorate([
88
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
89
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
90
+ tslib_1.__metadata("design:type", auth_base_1.User)
91
+ ], AccountingDocumentHistory.prototype, "updater", void 0);
92
+ tslib_1.__decorate([
93
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.updater),
94
+ tslib_1.__metadata("design:type", String)
95
+ ], AccountingDocumentHistory.prototype, "updaterId", void 0);
96
+ tslib_1.__decorate([
97
+ (0, type_graphql_1.Field)(type => String, { nullable: true }),
98
+ tslib_1.__metadata("design:type", String)
99
+ ], AccountingDocumentHistory.prototype, "thumbnail", void 0);
100
+ tslib_1.__decorate([
101
+ (0, typeorm_history_1.HistoryOriginalIdColumn)(),
102
+ tslib_1.__metadata("design:type", String)
103
+ ], AccountingDocumentHistory.prototype, "originalId", void 0);
104
+ tslib_1.__decorate([
105
+ (0, typeorm_history_1.HistoryActionColumn)({
106
+ nullable: false,
107
+ type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
108
+ ? 'enum'
109
+ : DATABASE_TYPE == 'oracle'
110
+ ? 'varchar2'
111
+ : 'smallint',
112
+ enum: typeorm_history_1.HistoryActionType
113
+ }),
114
+ tslib_1.__metadata("design:type", String)
115
+ ], AccountingDocumentHistory.prototype, "action", void 0);
116
+ exports.AccountingDocumentHistory = AccountingDocumentHistory = tslib_1.__decorate([
117
+ (0, typeorm_1.Entity)(),
118
+ (0, typeorm_1.Index)('ix_accounting-document_history_0', (accountingDocumentHistory) => [
119
+ accountingDocumentHistory.originalId,
120
+ accountingDocumentHistory.version
121
+ ], { unique: true }),
122
+ (0, typeorm_1.Index)('ix_accounting-document_history_1', (accountingDocumentHistory) => [
123
+ accountingDocumentHistory.domain,
124
+ accountingDocumentHistory.originalId,
125
+ accountingDocumentHistory.version
126
+ ], { unique: true }),
127
+ (0, type_graphql_1.ObjectType)({ description: 'History Entity of AccountingDocument' })
128
+ ], AccountingDocumentHistory);
129
+ //# sourceMappingURL=accounting-document-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-document-history.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,4DAAwD;AAGxD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAqB7B,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAOL,YAAO,GAAY,CAAC,CAAA;IAuEtB,CAAC;CAAA,CAAA;AA9EY,8DAAyB;AAG3B;IA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B,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBACzB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAClB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;yDAC+B;oCA7EtB,yBAAyB;IAnBrC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,kCAAkC,EAClC,CAAC,yBAAoD,EAAE,EAAE,CAAC;QACxD,yBAAyB,CAAC,UAAU;QACpC,yBAAyB,CAAC,OAAO;KAClC,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,kCAAkC,EAClC,CAAC,yBAAoD,EAAE,EAAE,CAAC;QACxD,yBAAyB,CAAC,MAAM;QAChC,yBAAyB,CAAC,UAAU;QACpC,yBAAyB,CAAC,OAAO;KAClC,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,yBAAyB,CA8ErC","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Transaction } from '../transaction/transaction'\nimport { AccountingDocument } from './accounting-document'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_accounting-document_history_0',\n (accountingDocumentHistory: AccountingDocumentHistory) => [\n accountingDocumentHistory.originalId,\n accountingDocumentHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_accounting-document_history_1',\n (accountingDocumentHistory: AccountingDocumentHistory) => [\n accountingDocumentHistory.domain,\n accountingDocumentHistory.originalId,\n accountingDocumentHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of AccountingDocument' })\nexport class AccountingDocumentHistory implements HistoryEntityInterface<AccountingDocument> {\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((accountingDocument: AccountingDocument) => accountingDocument.domain)\n domainId?: string\n\n @ManyToOne(type => Transaction, transaction => transaction.documents)\n @Field(type => Transaction)\n transaction: Transaction\n\n @RelationId((accountingDocument: AccountingDocument) => accountingDocument.transaction)\n transactionId: string\n\n @Column()\n @Field({ nullable: false })\n documentType: string // 문서의 유형 (예: 계약서, 인보이스 등)\n\n @Column()\n @Field({ nullable: false })\n documentUrl: string // 문서의 URL 또는 파일 경로\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string // 문서에 대한 설명\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((accountingDocument: AccountingDocument) => accountingDocument.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingDocument: AccountingDocument) => accountingDocument.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { AccountingDocument } from './accounting-document';
2
+ import { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type';
3
+ export declare class AccountingDocumentMutation {
4
+ createAccountingDocument(accountingDocument: NewAccountingDocument, context: ResolverContext): Promise<AccountingDocument>;
5
+ updateAccountingDocument(id: string, patch: AccountingDocumentPatch, context: ResolverContext): Promise<AccountingDocument>;
6
+ updateMultipleAccountingDocument(patches: AccountingDocumentPatch[], context: ResolverContext): Promise<AccountingDocument[]>;
7
+ deleteAccountingDocument(id: string, context: ResolverContext): Promise<boolean>;
8
+ deleteAccountingDocuments(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ importAccountingDocuments(accountingDocuments: AccountingDocumentPatch[], context: ResolverContext): Promise<boolean>;
10
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingDocumentMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const accounting_document_1 = require("./accounting-document");
9
+ const accounting_document_type_1 = require("./accounting-document-type");
10
+ let AccountingDocumentMutation = class AccountingDocumentMutation {
11
+ async createAccountingDocument(accountingDocument, context) {
12
+ const { domain, user, tx } = context.state;
13
+ const result = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save(Object.assign(Object.assign({}, accountingDocument), { domain, creator: user, updater: user }));
14
+ return result;
15
+ }
16
+ async updateAccountingDocument(id, patch, context) {
17
+ const { domain, user, tx } = context.state;
18
+ const repository = (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx);
19
+ const accountingDocument = await repository.findOne({
20
+ where: { domain: { id: domain.id }, id }
21
+ });
22
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, accountingDocument), patch), { updater: user }));
23
+ return result;
24
+ }
25
+ async updateMultipleAccountingDocument(patches, context) {
26
+ const { domain, user, tx } = context.state;
27
+ let results = [];
28
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
29
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
30
+ const accountingDocumentRepo = (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx);
31
+ if (_createRecords.length > 0) {
32
+ for (let i = 0; i < _createRecords.length; i++) {
33
+ const newRecord = _createRecords[i];
34
+ const result = await accountingDocumentRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
35
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
36
+ }
37
+ }
38
+ if (_updateRecords.length > 0) {
39
+ for (let i = 0; i < _updateRecords.length; i++) {
40
+ const updateRecord = _updateRecords[i];
41
+ const accountingDocument = await accountingDocumentRepo.findOneBy({ id: updateRecord.id });
42
+ const result = await accountingDocumentRepo.save(Object.assign(Object.assign(Object.assign({}, accountingDocument), updateRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteAccountingDocument(id, context) {
49
+ const { domain, tx } = context.state;
50
+ await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).delete({ domain: { id: domain.id }, id });
51
+ return true;
52
+ }
53
+ async deleteAccountingDocuments(ids, context) {
54
+ const { domain, tx } = context.state;
55
+ await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).delete({
56
+ domain: { id: domain.id },
57
+ id: (0, typeorm_1.In)(ids)
58
+ });
59
+ return true;
60
+ }
61
+ async importAccountingDocuments(accountingDocuments, context) {
62
+ const { domain, tx } = context.state;
63
+ await Promise.all(accountingDocuments.map(async (accountingDocument) => {
64
+ const createdAccountingDocument = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save(Object.assign({ domain }, accountingDocument));
65
+ }));
66
+ return true;
67
+ }
68
+ };
69
+ exports.AccountingDocumentMutation = AccountingDocumentMutation;
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To create new AccountingDocument' }),
73
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocument')),
74
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
75
+ tslib_1.__metadata("design:type", Function),
76
+ tslib_1.__metadata("design:paramtypes", [accounting_document_type_1.NewAccountingDocument, Object]),
77
+ tslib_1.__metadata("design:returntype", Promise)
78
+ ], AccountingDocumentMutation.prototype, "createAccountingDocument", null);
79
+ tslib_1.__decorate([
80
+ (0, type_graphql_1.Directive)('@transaction'),
81
+ (0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To modify AccountingDocument information' }),
82
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
83
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
84
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
85
+ tslib_1.__metadata("design:type", Function),
86
+ tslib_1.__metadata("design:paramtypes", [String, accounting_document_type_1.AccountingDocumentPatch, Object]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], AccountingDocumentMutation.prototype, "updateAccountingDocument", null);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Directive)('@transaction'),
91
+ (0, type_graphql_1.Mutation)(returns => [accounting_document_1.AccountingDocument], { description: "To modify multiple AccountingDocuments' information" }),
92
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [accounting_document_type_1.AccountingDocumentPatch])),
93
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
94
+ tslib_1.__metadata("design:type", Function),
95
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
96
+ tslib_1.__metadata("design:returntype", Promise)
97
+ ], AccountingDocumentMutation.prototype, "updateMultipleAccountingDocument", null);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Directive)('@transaction'),
100
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete AccountingDocument' }),
101
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
102
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
103
+ tslib_1.__metadata("design:type", Function),
104
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
105
+ tslib_1.__metadata("design:returntype", Promise)
106
+ ], AccountingDocumentMutation.prototype, "deleteAccountingDocument", null);
107
+ tslib_1.__decorate([
108
+ (0, type_graphql_1.Directive)('@transaction'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple AccountingDocuments' }),
110
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
111
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
112
+ tslib_1.__metadata("design:type", Function),
113
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
114
+ tslib_1.__metadata("design:returntype", Promise)
115
+ ], AccountingDocumentMutation.prototype, "deleteAccountingDocuments", null);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@transaction'),
118
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple AccountingDocuments' }),
119
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocuments', type => [accounting_document_type_1.AccountingDocumentPatch])),
120
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
121
+ tslib_1.__metadata("design:type", Function),
122
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
123
+ tslib_1.__metadata("design:returntype", Promise)
124
+ ], AccountingDocumentMutation.prototype, "importAccountingDocuments", null);
125
+ exports.AccountingDocumentMutation = AccountingDocumentMutation = tslib_1.__decorate([
126
+ (0, type_graphql_1.Resolver)(accounting_document_1.AccountingDocument)
127
+ ], AccountingDocumentMutation);
128
+ //# sourceMappingURL=accounting-document-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-document-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CAA4B,kBAAyC,EAAS,OAAwB;QAClI,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;IAIK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAClD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,+CAC/B,kBAAkB,GAClB,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,gCAAgC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AE,8BAA8B,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0EAM3D;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;qCA/HU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAgItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingDocument } from './accounting-document'\nimport { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentMutation {\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To create new AccountingDocument' })\n async createAccountingDocument(@Arg('accountingDocument') accountingDocument: NewAccountingDocument, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingDocument, tx).save({\n ...accountingDocument,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To modify AccountingDocument information' })\n async updateAccountingDocument(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingDocumentPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingDocument, tx)\n const accountingDocument = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingDocument,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [AccountingDocument], { description: \"To modify multiple AccountingDocuments' information\" })\n async updateMultipleAccountingDocument(\n @Arg('patches', type => [AccountingDocumentPatch]) patches: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument[]> {\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 accountingDocumentRepo = getRepository(AccountingDocument, 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 accountingDocumentRepo.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 accountingDocument = await accountingDocumentRepo.findOneBy({ id: updateRecord.id })\n\n const result = await accountingDocumentRepo.save({\n ...accountingDocument,\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 AccountingDocument' })\n async deleteAccountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingDocuments' })\n async deleteAccountingDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingDocuments' })\n async importAccountingDocuments(\n @Arg('accountingDocuments', type => [AccountingDocumentPatch]) accountingDocuments: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingDocuments.map(async (accountingDocument: AccountingDocumentPatch) => {\n const createdAccountingDocument: AccountingDocument = await getRepository(AccountingDocument, tx).save({ domain, ...accountingDocument })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { AccountingDocument } from './accounting-document';
4
+ import { AccountingDocumentList } from './accounting-document-type';
5
+ export declare class AccountingDocumentQuery {
6
+ accountingDocument(id: string, context: ResolverContext): Promise<AccountingDocument>;
7
+ accountingDocuments(params: ListParam, context: ResolverContext): Promise<AccountingDocumentList>;
8
+ domain(accountingDocument: AccountingDocument): Promise<Domain>;
9
+ updater(accountingDocument: AccountingDocument): Promise<User>;
10
+ creator(accountingDocument: AccountingDocument): Promise<User>;
11
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingDocumentQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const accounting_document_1 = require("./accounting-document");
9
+ const accounting_document_type_1 = require("./accounting-document-type");
10
+ let AccountingDocumentQuery = class AccountingDocumentQuery {
11
+ async accountingDocument(id, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument).findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ });
16
+ }
17
+ async accountingDocuments(params, context) {
18
+ const { domain } = context.state;
19
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
20
+ domain,
21
+ params,
22
+ repository: await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument),
23
+ searchables: ['name', 'description']
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(accountingDocument) {
29
+ return accountingDocument.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: accountingDocument.domainId }));
30
+ }
31
+ async updater(accountingDocument) {
32
+ return accountingDocument.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: accountingDocument.updaterId }));
33
+ }
34
+ async creator(accountingDocument) {
35
+ return accountingDocument.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: accountingDocument.creatorId }));
36
+ }
37
+ };
38
+ exports.AccountingDocumentQuery = AccountingDocumentQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Query)(returns => accounting_document_1.AccountingDocument, { nullable: true, description: 'To fetch a AccountingDocument' }),
41
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
43
+ tslib_1.__metadata("design:type", Function),
44
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
45
+ tslib_1.__metadata("design:returntype", Promise)
46
+ ], AccountingDocumentQuery.prototype, "accountingDocument", null);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Query)(returns => accounting_document_type_1.AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' }),
49
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
50
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
51
+ tslib_1.__metadata("design:type", Function),
52
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
53
+ tslib_1.__metadata("design:returntype", Promise)
54
+ ], AccountingDocumentQuery.prototype, "accountingDocuments", null);
55
+ tslib_1.__decorate([
56
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
57
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
+ ], AccountingDocumentQuery.prototype, "domain", null);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
64
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
65
+ tslib_1.__metadata("design:type", Function),
66
+ tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], AccountingDocumentQuery.prototype, "updater", null);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
71
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], AccountingDocumentQuery.prototype, "creator", null);
76
+ exports.AccountingDocumentQuery = AccountingDocumentQuery = tslib_1.__decorate([
77
+ (0, type_graphql_1.Resolver)(accounting_document_1.AccountingDocument)
78
+ ], AccountingDocumentQuery);
79
+ //# sourceMappingURL=accounting-document-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-document-query.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,y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EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAwCnC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { AccountingDocument } from './accounting-document'\nimport { AccountingDocumentList } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentQuery {\n @Query(returns => AccountingDocument!, { nullable: true, description: 'To fetch a AccountingDocument' })\n async accountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain } = context.state\n\n return await getRepository(AccountingDocument).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' })\n async accountingDocuments(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<AccountingDocumentList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingDocument),\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() accountingDocument: AccountingDocument): Promise<Domain> {\n return accountingDocument.domainId && (await getRepository(Domain).findOneBy({ id: accountingDocument.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.updaterId && (await getRepository(User).findOneBy({ id: accountingDocument.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.creatorId && (await getRepository(User).findOneBy({ id: accountingDocument.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { ObjectRef } from '@things-factory/shell';
2
+ import { AccountingDocument } from './accounting-document';
3
+ export declare class NewAccountingDocument {
4
+ transaction: ObjectRef;
5
+ documentType: string;
6
+ documentUrl: string;
7
+ description?: string;
8
+ }
9
+ export declare class AccountingDocumentPatch {
10
+ id?: string;
11
+ transaction: ObjectRef;
12
+ documentType: string;
13
+ documentUrl: string;
14
+ description?: string;
15
+ cuFlag?: string;
16
+ }
17
+ export declare class AccountingDocumentList {
18
+ items: AccountingDocument[];
19
+ total: number;
20
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingDocumentList = exports.AccountingDocumentPatch = exports.NewAccountingDocument = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const accounting_document_1 = require("./accounting-document");
8
+ let NewAccountingDocument = class NewAccountingDocument {
9
+ };
10
+ exports.NewAccountingDocument = NewAccountingDocument;
11
+ tslib_1.__decorate([
12
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef),
13
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
14
+ ], NewAccountingDocument.prototype, "transaction", void 0);
15
+ tslib_1.__decorate([
16
+ (0, type_graphql_1.Field)({ nullable: false }),
17
+ tslib_1.__metadata("design:type", String)
18
+ ], NewAccountingDocument.prototype, "documentType", void 0);
19
+ tslib_1.__decorate([
20
+ (0, type_graphql_1.Field)({ nullable: false }),
21
+ tslib_1.__metadata("design:type", String)
22
+ ], NewAccountingDocument.prototype, "documentUrl", void 0);
23
+ tslib_1.__decorate([
24
+ (0, type_graphql_1.Field)({ nullable: true }),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], NewAccountingDocument.prototype, "description", void 0);
27
+ exports.NewAccountingDocument = NewAccountingDocument = tslib_1.__decorate([
28
+ (0, type_graphql_1.InputType)()
29
+ ], NewAccountingDocument);
30
+ let AccountingDocumentPatch = class AccountingDocumentPatch {
31
+ };
32
+ exports.AccountingDocumentPatch = AccountingDocumentPatch;
33
+ tslib_1.__decorate([
34
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
35
+ tslib_1.__metadata("design:type", String)
36
+ ], AccountingDocumentPatch.prototype, "id", void 0);
37
+ tslib_1.__decorate([
38
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef),
39
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
40
+ ], AccountingDocumentPatch.prototype, "transaction", void 0);
41
+ tslib_1.__decorate([
42
+ (0, type_graphql_1.Field)({ nullable: false }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], AccountingDocumentPatch.prototype, "documentType", void 0);
45
+ tslib_1.__decorate([
46
+ (0, type_graphql_1.Field)({ nullable: false }),
47
+ tslib_1.__metadata("design:type", String)
48
+ ], AccountingDocumentPatch.prototype, "documentUrl", void 0);
49
+ tslib_1.__decorate([
50
+ (0, type_graphql_1.Field)({ nullable: true }),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], AccountingDocumentPatch.prototype, "description", void 0);
53
+ tslib_1.__decorate([
54
+ (0, type_graphql_1.Field)({ nullable: true }),
55
+ tslib_1.__metadata("design:type", String)
56
+ ], AccountingDocumentPatch.prototype, "cuFlag", void 0);
57
+ exports.AccountingDocumentPatch = AccountingDocumentPatch = tslib_1.__decorate([
58
+ (0, type_graphql_1.InputType)()
59
+ ], AccountingDocumentPatch);
60
+ let AccountingDocumentList = class AccountingDocumentList {
61
+ };
62
+ exports.AccountingDocumentList = AccountingDocumentList;
63
+ tslib_1.__decorate([
64
+ (0, type_graphql_1.Field)(type => [accounting_document_1.AccountingDocument]),
65
+ tslib_1.__metadata("design:type", Array)
66
+ ], AccountingDocumentList.prototype, "items", void 0);
67
+ tslib_1.__decorate([
68
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
69
+ tslib_1.__metadata("design:type", Number)
70
+ ], AccountingDocumentList.prototype, "total", void 0);
71
+ exports.AccountingDocumentList = AccountingDocumentList = tslib_1.__decorate([
72
+ (0, type_graphql_1.ObjectType)()
73
+ ], AccountingDocumentList);
74
+ //# sourceMappingURL=accounting-document-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-document-type.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAEtF,iDAA+D;AAE/D,+DAA0D;AAGnD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAYjC,CAAA;AAZY,sDAAqB;AAEhC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC;sCACZ,iBAAS;0DAAA;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;2DACP;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0DACR;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACN;gCAXT,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAYjC;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAkBnC,CAAA;AAlBY,0DAAuB;AAElC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC;sCACZ,iBAAS;4DAAA;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6DACP;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;4DACR;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACX;kCAjBJ,uBAAuB;IADnC,IAAA,wBAAS,GAAE;GACC,uBAAuB,CAkBnC;AAGM,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAMlC,CAAA;AANY,wDAAsB;AAEjC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wCAAkB,CAAC,CAAC;;qDACT;AAG3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;qDACN;iCALF,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CAMlC","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { AccountingDocument } from './accounting-document'\n\n@InputType()\nexport class NewAccountingDocument {\n @Field(type => ObjectRef)\n transaction: ObjectRef\n\n @Field({ nullable: false })\n documentType: string // 문서의 유형 (예: 계약서, 인보이스 등)\n\n @Field({ nullable: false })\n documentUrl: string // 문서의 URL 또는 파일 경로\n\n @Field({ nullable: true })\n description?: string // 문서에 대한 설명\n}\n\n@InputType()\nexport class AccountingDocumentPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field(type => ObjectRef)\n transaction: ObjectRef\n\n @Field({ nullable: false })\n documentType: string // 문서의 유형 (예: 계약서, 인보이스 등)\n\n @Field({ nullable: false })\n documentUrl: string // 문서의 URL 또는 파일 경로\n\n @Field({ nullable: true })\n description?: string // 문서에 대한 설명\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AccountingDocumentList {\n @Field(type => [AccountingDocument])\n items: AccountingDocument[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { Transaction } from '../transaction/transaction';
4
+ export declare class AccountingDocument {
5
+ readonly id: string;
6
+ version?: number;
7
+ domain?: Domain;
8
+ domainId?: string;
9
+ transaction: Transaction;
10
+ transactionId: string;
11
+ documentType: string;
12
+ documentUrl: string;
13
+ description?: string;
14
+ createdAt?: Date;
15
+ updatedAt?: Date;
16
+ deletedAt?: Date;
17
+ creator?: User;
18
+ creatorId?: string;
19
+ updater?: User;
20
+ updaterId?: string;
21
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountingDocument = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ const transaction_1 = require("../transaction/transaction");
10
+ let AccountingDocument = class AccountingDocument {
11
+ constructor() {
12
+ this.version = 1;
13
+ }
14
+ };
15
+ exports.AccountingDocument = AccountingDocument;
16
+ tslib_1.__decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
18
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], AccountingDocument.prototype, "id", void 0);
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.VersionColumn)(),
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", Number)
25
+ ], AccountingDocument.prototype, "version", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ tslib_1.__metadata("design:type", shell_1.Domain)
30
+ ], AccountingDocument.prototype, "domain", void 0);
31
+ tslib_1.__decorate([
32
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.domain),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], AccountingDocument.prototype, "domainId", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.documents),
37
+ (0, type_graphql_1.Field)(type => transaction_1.Transaction),
38
+ tslib_1.__metadata("design:type", transaction_1.Transaction)
39
+ ], AccountingDocument.prototype, "transaction", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.transaction),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], AccountingDocument.prototype, "transactionId", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.Column)(),
46
+ (0, type_graphql_1.Field)({ nullable: false }),
47
+ tslib_1.__metadata("design:type", String)
48
+ ], AccountingDocument.prototype, "documentType", void 0);
49
+ tslib_1.__decorate([
50
+ (0, typeorm_1.Column)(),
51
+ (0, type_graphql_1.Field)({ nullable: false }),
52
+ tslib_1.__metadata("design:type", String)
53
+ ], AccountingDocument.prototype, "documentUrl", void 0);
54
+ tslib_1.__decorate([
55
+ (0, typeorm_1.Column)({ nullable: true }),
56
+ (0, type_graphql_1.Field)({ nullable: true }),
57
+ tslib_1.__metadata("design:type", String)
58
+ ], AccountingDocument.prototype, "description", void 0);
59
+ tslib_1.__decorate([
60
+ (0, typeorm_1.CreateDateColumn)(),
61
+ (0, type_graphql_1.Field)({ nullable: true }),
62
+ tslib_1.__metadata("design:type", Date)
63
+ ], AccountingDocument.prototype, "createdAt", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.UpdateDateColumn)(),
66
+ (0, type_graphql_1.Field)({ nullable: true }),
67
+ tslib_1.__metadata("design:type", Date)
68
+ ], AccountingDocument.prototype, "updatedAt", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.DeleteDateColumn)(),
71
+ (0, type_graphql_1.Field)({ nullable: true }),
72
+ tslib_1.__metadata("design:type", Date)
73
+ ], AccountingDocument.prototype, "deletedAt", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
76
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
77
+ tslib_1.__metadata("design:type", auth_base_1.User)
78
+ ], AccountingDocument.prototype, "creator", void 0);
79
+ tslib_1.__decorate([
80
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.creator),
81
+ tslib_1.__metadata("design:type", String)
82
+ ], AccountingDocument.prototype, "creatorId", 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 }),
86
+ tslib_1.__metadata("design:type", auth_base_1.User)
87
+ ], AccountingDocument.prototype, "updater", void 0);
88
+ tslib_1.__decorate([
89
+ (0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.updater),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], AccountingDocument.prototype, "updaterId", void 0);
92
+ exports.AccountingDocument = AccountingDocument = tslib_1.__decorate([
93
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for AccountingDocument' }),
94
+ (0, typeorm_1.Entity)(),
95
+ (0, typeorm_1.Index)('ix_accounting_document_0', (accountingDocument) => [
96
+ accountingDocument.domain,
97
+ accountingDocument.transaction,
98
+ accountingDocument.createdAt
99
+ ], {
100
+ unique: false,
101
+ where: '"deleted_at" IS NULL'
102
+ })
103
+ ], AccountingDocument);
104
+ //# sourceMappingURL=accounting-document.js.map