@things-factory/accounting 8.0.0 → 9.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
  2. package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
  3. package/dist-client/pages/bank/bank-importer.d.ts +23 -0
  4. package/dist-client/pages/bank/bank-importer.js +93 -0
  5. package/dist-client/pages/bank/bank-importer.js.map +1 -0
  6. package/dist-client/pages/bank/bank-list-page.d.ts +66 -0
  7. package/dist-client/pages/bank/bank-list-page.js +370 -0
  8. package/dist-client/pages/bank/bank-list-page.js.map +1 -0
  9. package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
  10. package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
  11. package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
  12. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
  13. package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
  14. package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
  15. package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
  16. package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
  17. package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
  18. package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
  19. package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
  20. package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
  21. package/dist-client/tsconfig.tsbuildinfo +1 -1
  22. package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
  23. package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
  24. package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
  25. package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
  26. package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
  27. package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
  28. package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
  29. package/dist-server/service/bank-account/bank-account-history.js +172 -0
  30. package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
  31. package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
  32. package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
  33. package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
  34. package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
  35. package/dist-server/service/bank-account/bank-account-query.js +79 -0
  36. package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
  37. package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
  38. package/dist-server/service/bank-account/bank-account-type.js +153 -0
  39. package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
  40. package/dist-server/service/bank-account/bank-account.d.ts +38 -0
  41. package/dist-server/service/bank-account/bank-account.js +164 -0
  42. package/dist-server/service/bank-account/bank-account.js.map +1 -0
  43. package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
  44. package/dist-server/service/bank-account/event-subscriber.js +21 -0
  45. package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
  46. package/dist-server/service/bank-account/index.d.ts +7 -0
  47. package/dist-server/service/bank-account/index.js +12 -0
  48. package/dist-server/service/bank-account/index.js.map +1 -0
  49. package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
  50. package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
  51. package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
  52. package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
  53. package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
  54. package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
  55. package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
  56. package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
  57. package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
  58. package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
  59. package/dist-server/service/financial-institution/financial-institution.js +137 -0
  60. package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
  61. package/dist-server/service/financial-institution/index.d.ts +6 -0
  62. package/dist-server/service/financial-institution/index.js +10 -0
  63. package/dist-server/service/financial-institution/index.js.map +1 -0
  64. package/dist-server/service/index.d.ts +3 -2
  65. package/dist-server/service/index.js +5 -0
  66. package/dist-server/service/index.js.map +1 -1
  67. package/dist-server/service/payment/index.d.ts +1 -2
  68. package/dist-server/service/payment/payment-history.d.ts +8 -1
  69. package/dist-server/service/payment/payment-history.js +41 -10
  70. package/dist-server/service/payment/payment-history.js.map +1 -1
  71. package/dist-server/service/payment/payment-type.d.ts +7 -1
  72. package/dist-server/service/payment/payment-type.js +24 -0
  73. package/dist-server/service/payment/payment-type.js.map +1 -1
  74. package/dist-server/service/payment/payment.d.ts +12 -0
  75. package/dist-server/service/payment/payment.js +36 -1
  76. package/dist-server/service/payment/payment.js.map +1 -1
  77. package/dist-server/tsconfig.tsbuildinfo +1 -1
  78. package/helps/accounting/bank-account.md +160 -0
  79. package/helps/accounting/bank.md +160 -0
  80. package/helps/accounting/financial-institution.md +160 -0
  81. package/package.json +7 -7
  82. package/client/activities/activity-book-edit.ts +0 -88
  83. package/client/activities/activity-book-view.ts +0 -88
  84. package/client/activities/activity-expense-edit.ts +0 -88
  85. package/client/activities/activity-expense-view.ts +0 -88
  86. package/client/bootstrap.ts +0 -10
  87. package/client/components/accounting-category-selector.ts +0 -136
  88. package/client/components/accounting-category-view.ts +0 -75
  89. package/client/grist-editors/grist-editor-accounting-category-object.ts +0 -83
  90. package/client/grist-editors/grist-renderer-accounting-category-object.ts +0 -13
  91. package/client/index.ts +0 -0
  92. package/client/pages/account/account-importer.ts +0 -97
  93. package/client/pages/account/account-list-page.ts +0 -364
  94. package/client/pages/accounting-category/accounting-category-importer.ts +0 -97
  95. package/client/pages/accounting-category/accounting-category-list-page.ts +0 -368
  96. package/client/pages/accounting-category/accounting-category-tree-page.ts +0 -338
  97. package/client/pages/accounting-document/accounting-document-importer.ts +0 -90
  98. package/client/pages/accounting-document/accounting-document-list-page.ts +0 -398
  99. package/client/pages/financial-statement/financial-statement-importer.ts +0 -97
  100. package/client/pages/financial-statement/financial-statement-list-page.ts +0 -338
  101. package/client/pages/fiscal-month/fiscal-month-importer.ts +0 -90
  102. package/client/pages/fiscal-month/fiscal-month-list-page.ts +0 -398
  103. package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +0 -90
  104. package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +0 -398
  105. package/client/pages/fiscal-year/fiscal-year-importer.ts +0 -90
  106. package/client/pages/fiscal-year/fiscal-year-list-page.ts +0 -398
  107. package/client/pages/income-statement/income-statement-importer.ts +0 -97
  108. package/client/pages/income-statement/income-statement-list-page.ts +0 -338
  109. package/client/pages/payment/payment-importer.ts +0 -90
  110. package/client/pages/payment/payment-list-page.ts +0 -398
  111. package/client/pages/transaction/transaction-importer.ts +0 -97
  112. package/client/pages/transaction/transaction-list-page.ts +0 -338
  113. package/client/route.ts +0 -35
  114. package/client/tsconfig.json +0 -13
  115. package/client/types/accounting-category.ts +0 -23
  116. package/client/types/index.ts +0 -1
  117. package/server/activities/activity-book.ts +0 -172
  118. package/server/activities/activity-expense.ts +0 -149
  119. package/server/activities/index.ts +0 -18
  120. package/server/controllers/index.ts +0 -1
  121. package/server/controllers/summary-statements.ts +0 -166
  122. package/server/index.ts +0 -6
  123. package/server/middlewares/index.ts +0 -3
  124. package/server/migrations/1725200507196-seed-fiscal-entities.ts +0 -106
  125. package/server/migrations/1725201467183-seed-accounts.ts +0 -339
  126. package/server/migrations/index.ts +0 -9
  127. package/server/routes.ts +0 -26
  128. package/server/service/account/account-history.ts +0 -117
  129. package/server/service/account/account-mutation.ts +0 -140
  130. package/server/service/account/account-query.ts +0 -51
  131. package/server/service/account/account-type.ts +0 -44
  132. package/server/service/account/account.ts +0 -97
  133. package/server/service/account/event-subscriber.ts +0 -17
  134. package/server/service/account/index.ts +0 -9
  135. package/server/service/accounting-category/accounting-category-history.ts +0 -129
  136. package/server/service/accounting-category/accounting-category-mutation.ts +0 -148
  137. package/server/service/accounting-category/accounting-category-query.ts +0 -74
  138. package/server/service/accounting-category/accounting-category-type.ts +0 -48
  139. package/server/service/accounting-category/accounting-category.ts +0 -100
  140. package/server/service/accounting-category/event-subscriber.ts +0 -20
  141. package/server/service/accounting-category/index.ts +0 -9
  142. package/server/service/accounting-document/accounting-document-history.ts +0 -123
  143. package/server/service/accounting-document/accounting-document-mutation.ts +0 -137
  144. package/server/service/accounting-document/accounting-document-query.ts +0 -48
  145. package/server/service/accounting-document/accounting-document-type.ts +0 -52
  146. package/server/service/accounting-document/accounting-document.ts +0 -93
  147. package/server/service/accounting-document/event-subscriber.ts +0 -17
  148. package/server/service/accounting-document/index.ts +0 -9
  149. package/server/service/common-type.ts +0 -12
  150. package/server/service/financial-statement/event-subscriber.ts +0 -17
  151. package/server/service/financial-statement/financial-statement-history.ts +0 -129
  152. package/server/service/financial-statement/financial-statement-line-item.ts +0 -82
  153. package/server/service/financial-statement/financial-statement-mutation.ts +0 -148
  154. package/server/service/financial-statement/financial-statement-query.ts +0 -53
  155. package/server/service/financial-statement/financial-statement-type.ts +0 -51
  156. package/server/service/financial-statement/financial-statement.ts +0 -116
  157. package/server/service/financial-statement/index.ts +0 -10
  158. package/server/service/fiscal-month/fiscal-month-mutation.ts +0 -145
  159. package/server/service/fiscal-month/fiscal-month-query.ts +0 -58
  160. package/server/service/fiscal-month/fiscal-month-type.ts +0 -66
  161. package/server/service/fiscal-month/fiscal-month.ts +0 -84
  162. package/server/service/fiscal-month/index.ts +0 -7
  163. package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +0 -148
  164. package/server/service/fiscal-quarter/fiscal-quarter-query.ts +0 -60
  165. package/server/service/fiscal-quarter/fiscal-quarter-type.ts +0 -60
  166. package/server/service/fiscal-quarter/fiscal-quarter.ts +0 -80
  167. package/server/service/fiscal-quarter/index.ts +0 -7
  168. package/server/service/fiscal-year/fiscal-year-mutation.ts +0 -145
  169. package/server/service/fiscal-year/fiscal-year-query.ts +0 -53
  170. package/server/service/fiscal-year/fiscal-year-type.ts +0 -54
  171. package/server/service/fiscal-year/fiscal-year.ts +0 -76
  172. package/server/service/fiscal-year/index.ts +0 -7
  173. package/server/service/income-statement/event-subscriber.ts +0 -17
  174. package/server/service/income-statement/income-statement-history.ts +0 -133
  175. package/server/service/income-statement/income-statement-line-item.ts +0 -84
  176. package/server/service/income-statement/income-statement-mutation.ts +0 -147
  177. package/server/service/income-statement/income-statement-query.ts +0 -50
  178. package/server/service/income-statement/income-statement-type.ts +0 -51
  179. package/server/service/income-statement/income-statement.ts +0 -120
  180. package/server/service/income-statement/index.ts +0 -10
  181. package/server/service/index.ts +0 -108
  182. package/server/service/payment/event-subscriber.ts +0 -17
  183. package/server/service/payment/index.ts +0 -9
  184. package/server/service/payment/payment-history.ts +0 -132
  185. package/server/service/payment/payment-mutation.ts +0 -139
  186. package/server/service/payment/payment-query.ts +0 -50
  187. package/server/service/payment/payment-type.ts +0 -64
  188. package/server/service/payment/payment.ts +0 -123
  189. package/server/service/transaction/event-subscriber.ts +0 -17
  190. package/server/service/transaction/index.ts +0 -9
  191. package/server/service/transaction/transaction-history.ts +0 -161
  192. package/server/service/transaction/transaction-mutation.ts +0 -146
  193. package/server/service/transaction/transaction-query.ts +0 -50
  194. package/server/service/transaction/transaction-type.ts +0 -48
  195. package/server/service/transaction/transaction.ts +0 -230
  196. package/server/tsconfig.json +0 -10
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankAccountMutation = 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 bank_account_1 = require("./bank-account");
9
+ const bank_account_type_1 = require("./bank-account-type");
10
+ let BankAccountMutation = class BankAccountMutation {
11
+ async createBankAccount(bankAccount, context) {
12
+ const { domain, user, tx } = context.state;
13
+ const result = await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).save(Object.assign(Object.assign({}, bankAccount), { domain, creator: user, updater: user }));
14
+ return result;
15
+ }
16
+ async updateBankAccount(id, patch, context) {
17
+ const { domain, user, tx } = context.state;
18
+ const repository = (0, shell_1.getRepository)(bank_account_1.BankAccount, tx);
19
+ const bankAccount = await repository.findOne({
20
+ where: { domain: { id: domain.id }, id }
21
+ });
22
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, bankAccount), patch), { updater: user }));
23
+ return result;
24
+ }
25
+ async updateMultipleBankAccount(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 bankAccountRepo = (0, shell_1.getRepository)(bank_account_1.BankAccount, tx);
31
+ if (_createRecords.length > 0) {
32
+ for (let i = 0; i < _createRecords.length; i++) {
33
+ const newRecord = _createRecords[i];
34
+ const result = await bankAccountRepo.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 bankAccount = await bankAccountRepo.findOneBy({ id: updateRecord.id });
42
+ const result = await bankAccountRepo.save(Object.assign(Object.assign(Object.assign({}, bankAccount), updateRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteBankAccount(id, context) {
49
+ const { domain, tx } = context.state;
50
+ await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).delete({ domain: { id: domain.id }, id });
51
+ return true;
52
+ }
53
+ async deleteBankAccounts(ids, context) {
54
+ const { domain, tx } = context.state;
55
+ await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).delete({
56
+ domain: { id: domain.id },
57
+ id: (0, typeorm_1.In)(ids)
58
+ });
59
+ return true;
60
+ }
61
+ async importBankAccounts(bankAccounts, context) {
62
+ const { domain, tx } = context.state;
63
+ await Promise.all(bankAccounts.map(async (bankAccount) => {
64
+ const createdBankAccount = await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).save(Object.assign({ domain }, bankAccount));
65
+ }));
66
+ return true;
67
+ }
68
+ };
69
+ exports.BankAccountMutation = BankAccountMutation;
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => bank_account_1.BankAccount, { description: 'To create new BankAccount' }),
73
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('bankAccount')),
74
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
75
+ tslib_1.__metadata("design:type", Function),
76
+ tslib_1.__metadata("design:paramtypes", [bank_account_type_1.NewBankAccount, Object]),
77
+ tslib_1.__metadata("design:returntype", Promise)
78
+ ], BankAccountMutation.prototype, "createBankAccount", null);
79
+ tslib_1.__decorate([
80
+ (0, type_graphql_1.Directive)('@transaction'),
81
+ (0, type_graphql_1.Mutation)(returns => bank_account_1.BankAccount, { description: 'To modify BankAccount 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, bank_account_type_1.BankAccountPatch, Object]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], BankAccountMutation.prototype, "updateBankAccount", null);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Directive)('@transaction'),
91
+ (0, type_graphql_1.Mutation)(returns => [bank_account_1.BankAccount], { description: "To modify multiple BankAccounts' information" }),
92
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [bank_account_type_1.BankAccountPatch])),
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
+ ], BankAccountMutation.prototype, "updateMultipleBankAccount", null);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Directive)('@transaction'),
100
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete BankAccount' }),
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
+ ], BankAccountMutation.prototype, "deleteBankAccount", null);
107
+ tslib_1.__decorate([
108
+ (0, type_graphql_1.Directive)('@transaction'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple BankAccounts' }),
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
+ ], BankAccountMutation.prototype, "deleteBankAccounts", null);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@transaction'),
118
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple BankAccounts' }),
119
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('bankAccounts', type => [bank_account_type_1.BankAccountPatch])),
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
+ ], BankAccountMutation.prototype, "importBankAccounts", null);
125
+ exports.BankAccountMutation = BankAccountMutation = tslib_1.__decorate([
126
+ (0, type_graphql_1.Resolver)(bank_account_1.BankAccount)
127
+ ], BankAccountMutation);
128
+ //# sourceMappingURL=bank-account-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-account-mutation.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,iDAA4C;AAC5C,2DAAsE;AAG/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAwB;QACtG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,0BAAW,EAAE,EAAE,CAAC,CAAC,IAAI,iCACnD,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,0BAAW,EAAE,EAAE,CAAC,CAAA;QACjD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC3C,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,+CA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,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAMpD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,oCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BA/HU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAgI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { BankAccount } from './bank-account'\nimport { NewBankAccount, BankAccountPatch } from './bank-account-type'\n\n@Resolver(BankAccount)\nexport class BankAccountMutation {\n @Directive('@transaction')\n @Mutation(returns => BankAccount, { description: 'To create new BankAccount' })\n async createBankAccount(@Arg('bankAccount') bankAccount: NewBankAccount, @Ctx() context: ResolverContext): Promise<BankAccount> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(BankAccount, tx).save({\n ...bankAccount,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => BankAccount, { description: 'To modify BankAccount information' })\n async updateBankAccount(\n @Arg('id') id: string,\n @Arg('patch') patch: BankAccountPatch,\n @Ctx() context: ResolverContext\n ): Promise<BankAccount> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(BankAccount, tx)\n const bankAccount = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...bankAccount,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [BankAccount], { description: \"To modify multiple BankAccounts' information\" })\n async updateMultipleBankAccount(\n @Arg('patches', type => [BankAccountPatch]) patches: BankAccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<BankAccount[]> {\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 bankAccountRepo = getRepository(BankAccount, 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 bankAccountRepo.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 bankAccount = await bankAccountRepo.findOneBy({ id: updateRecord.id })\n\n const result = await bankAccountRepo.save({\n ...bankAccount,\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 BankAccount' })\n async deleteBankAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(BankAccount, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple BankAccounts' })\n async deleteBankAccounts(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(BankAccount, 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 BankAccounts' })\n async importBankAccounts(\n @Arg('bankAccounts', type => [BankAccountPatch]) bankAccounts: BankAccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n bankAccounts.map(async (bankAccount: BankAccountPatch) => {\n const createdBankAccount: BankAccount = await getRepository(BankAccount, tx).save({ domain, ...bankAccount })\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 { BankAccount } from './bank-account';
4
+ import { BankAccountList } from './bank-account-type';
5
+ export declare class BankAccountQuery {
6
+ bankAccount(id: string, context: ResolverContext): Promise<BankAccount>;
7
+ bankAccounts(params: ListParam, context: ResolverContext): Promise<BankAccountList>;
8
+ domain(bankAccount: BankAccount): Promise<Domain>;
9
+ updater(bankAccount: BankAccount): Promise<User>;
10
+ creator(bankAccount: BankAccount): Promise<User>;
11
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankAccountQuery = 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 bank_account_1 = require("./bank-account");
9
+ const bank_account_type_1 = require("./bank-account-type");
10
+ let BankAccountQuery = class BankAccountQuery {
11
+ async bankAccount(id, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(bank_account_1.BankAccount).findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ });
16
+ }
17
+ async bankAccounts(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)(bank_account_1.BankAccount),
23
+ searchables: ['name', 'description']
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(bankAccount) {
29
+ return bankAccount.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: bankAccount.domainId }));
30
+ }
31
+ async updater(bankAccount) {
32
+ return bankAccount.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: bankAccount.updaterId }));
33
+ }
34
+ async creator(bankAccount) {
35
+ return bankAccount.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: bankAccount.creatorId }));
36
+ }
37
+ };
38
+ exports.BankAccountQuery = BankAccountQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Query)(returns => bank_account_1.BankAccount, { nullable: true, description: 'To fetch a BankAccount' }),
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
+ ], BankAccountQuery.prototype, "bankAccount", null);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Query)(returns => bank_account_type_1.BankAccountList, { description: 'To fetch multiple BankAccounts' }),
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
+ ], BankAccountQuery.prototype, "bankAccounts", 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", [bank_account_1.BankAccount]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
+ ], BankAccountQuery.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", [bank_account_1.BankAccount]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], BankAccountQuery.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", [bank_account_1.BankAccount]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], BankAccountQuery.prototype, "creator", null);
76
+ exports.BankAccountQuery = BankAccountQuery = tslib_1.__decorate([
77
+ (0, type_graphql_1.Resolver)(bank_account_1.BankAccount)
78
+ ], BankAccountQuery);
79
+ //# sourceMappingURL=bank-account-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-account-query.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAwB;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,OAA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AAC,SAAS,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IACtG,CAAC;CACF,CAAA;AAxCY,4CAAgB;AAErB;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,0BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IACvE,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;mDAM9C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mCAAe,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACjE,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;oDAa5D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;2BAvCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CAwC5B","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 { BankAccount } from './bank-account'\nimport { BankAccountList } from './bank-account-type'\n\n@Resolver(BankAccount)\nexport class BankAccountQuery {\n @Query(returns => BankAccount!, { nullable: true, description: 'To fetch a BankAccount' })\n async bankAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BankAccount> {\n const { domain } = context.state\n\n return await getRepository(BankAccount).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => BankAccountList, { description: 'To fetch multiple BankAccounts' })\n async bankAccounts(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<BankAccountList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(BankAccount),\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() bankAccount: BankAccount): Promise<Domain> {\n return bankAccount.domainId && (await getRepository(Domain).findOneBy({ id: bankAccount.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() bankAccount: BankAccount): Promise<User> {\n return bankAccount.updaterId && (await getRepository(User).findOneBy({ id: bankAccount.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() bankAccount: BankAccount): Promise<User> {\n return bankAccount.creatorId && (await getRepository(User).findOneBy({ id: bankAccount.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { AccountType, BankAccount, OwnerType } from './bank-account';
2
+ export declare class NewBankAccount {
3
+ name: string;
4
+ description?: string;
5
+ accountHolderName?: string;
6
+ accountNumber?: string;
7
+ bankName?: string;
8
+ accountType: AccountType;
9
+ currency?: string;
10
+ active?: boolean;
11
+ ownerType: OwnerType;
12
+ ownerId: string;
13
+ iban?: string;
14
+ bic?: string;
15
+ country?: string;
16
+ image?: string;
17
+ }
18
+ export declare class BankAccountPatch {
19
+ id?: string;
20
+ name?: string;
21
+ description?: string;
22
+ accountHolderName?: string;
23
+ accountNumber?: string;
24
+ bankName?: string;
25
+ accountType: AccountType;
26
+ currency?: string;
27
+ active?: boolean;
28
+ ownerType: OwnerType;
29
+ ownerId: string;
30
+ iban?: string;
31
+ bic?: string;
32
+ country?: string;
33
+ image?: string;
34
+ cuFlag?: string;
35
+ }
36
+ export declare class BankAccountList {
37
+ items: BankAccount[];
38
+ total: number;
39
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankAccountList = exports.BankAccountPatch = exports.NewBankAccount = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const bank_account_1 = require("./bank-account");
7
+ let NewBankAccount = class NewBankAccount {
8
+ };
9
+ exports.NewBankAccount = NewBankAccount;
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)(),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewBankAccount.prototype, "name", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: true }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewBankAccount.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
20
+ tslib_1.__metadata("design:type", String)
21
+ ], NewBankAccount.prototype, "accountHolderName", void 0);
22
+ tslib_1.__decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
24
+ tslib_1.__metadata("design:type", String)
25
+ ], NewBankAccount.prototype, "accountNumber", void 0);
26
+ tslib_1.__decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], NewBankAccount.prototype, "bankName", void 0);
30
+ tslib_1.__decorate([
31
+ (0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
32
+ tslib_1.__metadata("design:type", String)
33
+ ], NewBankAccount.prototype, "accountType", void 0);
34
+ tslib_1.__decorate([
35
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], NewBankAccount.prototype, "currency", void 0);
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.Field)({ nullable: true }),
40
+ tslib_1.__metadata("design:type", Boolean)
41
+ ], NewBankAccount.prototype, "active", void 0);
42
+ tslib_1.__decorate([
43
+ (0, type_graphql_1.Field)(type => bank_account_1.OwnerType, { description: 'Type of the owner of the bank account' }),
44
+ tslib_1.__metadata("design:type", String)
45
+ ], NewBankAccount.prototype, "ownerType", void 0);
46
+ tslib_1.__decorate([
47
+ (0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
48
+ tslib_1.__metadata("design:type", String)
49
+ ], NewBankAccount.prototype, "ownerId", void 0);
50
+ tslib_1.__decorate([
51
+ (0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
52
+ tslib_1.__metadata("design:type", String)
53
+ ], NewBankAccount.prototype, "iban", void 0);
54
+ tslib_1.__decorate([
55
+ (0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
56
+ tslib_1.__metadata("design:type", String)
57
+ ], NewBankAccount.prototype, "bic", void 0);
58
+ tslib_1.__decorate([
59
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
60
+ tslib_1.__metadata("design:type", String)
61
+ ], NewBankAccount.prototype, "country", void 0);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
64
+ tslib_1.__metadata("design:type", String)
65
+ ], NewBankAccount.prototype, "image", void 0);
66
+ exports.NewBankAccount = NewBankAccount = tslib_1.__decorate([
67
+ (0, type_graphql_1.InputType)()
68
+ ], NewBankAccount);
69
+ let BankAccountPatch = class BankAccountPatch {
70
+ };
71
+ exports.BankAccountPatch = BankAccountPatch;
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
74
+ tslib_1.__metadata("design:type", String)
75
+ ], BankAccountPatch.prototype, "id", void 0);
76
+ tslib_1.__decorate([
77
+ (0, type_graphql_1.Field)({ nullable: true }),
78
+ tslib_1.__metadata("design:type", String)
79
+ ], BankAccountPatch.prototype, "name", void 0);
80
+ tslib_1.__decorate([
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ tslib_1.__metadata("design:type", String)
83
+ ], BankAccountPatch.prototype, "description", void 0);
84
+ tslib_1.__decorate([
85
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
86
+ tslib_1.__metadata("design:type", String)
87
+ ], BankAccountPatch.prototype, "accountHolderName", void 0);
88
+ tslib_1.__decorate([
89
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], BankAccountPatch.prototype, "accountNumber", void 0);
92
+ tslib_1.__decorate([
93
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
94
+ tslib_1.__metadata("design:type", String)
95
+ ], BankAccountPatch.prototype, "bankName", void 0);
96
+ tslib_1.__decorate([
97
+ (0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
98
+ tslib_1.__metadata("design:type", String)
99
+ ], BankAccountPatch.prototype, "accountType", void 0);
100
+ tslib_1.__decorate([
101
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
102
+ tslib_1.__metadata("design:type", String)
103
+ ], BankAccountPatch.prototype, "currency", void 0);
104
+ tslib_1.__decorate([
105
+ (0, type_graphql_1.Field)({ nullable: true }),
106
+ tslib_1.__metadata("design:type", Boolean)
107
+ ], BankAccountPatch.prototype, "active", void 0);
108
+ tslib_1.__decorate([
109
+ (0, type_graphql_1.Field)(type => bank_account_1.OwnerType, { description: 'Type of the owner of the bank account' }),
110
+ tslib_1.__metadata("design:type", String)
111
+ ], BankAccountPatch.prototype, "ownerType", void 0);
112
+ tslib_1.__decorate([
113
+ (0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
114
+ tslib_1.__metadata("design:type", String)
115
+ ], BankAccountPatch.prototype, "ownerId", void 0);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
118
+ tslib_1.__metadata("design:type", String)
119
+ ], BankAccountPatch.prototype, "iban", void 0);
120
+ tslib_1.__decorate([
121
+ (0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
122
+ tslib_1.__metadata("design:type", String)
123
+ ], BankAccountPatch.prototype, "bic", void 0);
124
+ tslib_1.__decorate([
125
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
126
+ tslib_1.__metadata("design:type", String)
127
+ ], BankAccountPatch.prototype, "country", void 0);
128
+ tslib_1.__decorate([
129
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
130
+ tslib_1.__metadata("design:type", String)
131
+ ], BankAccountPatch.prototype, "image", void 0);
132
+ tslib_1.__decorate([
133
+ (0, type_graphql_1.Field)({ nullable: true }),
134
+ tslib_1.__metadata("design:type", String)
135
+ ], BankAccountPatch.prototype, "cuFlag", void 0);
136
+ exports.BankAccountPatch = BankAccountPatch = tslib_1.__decorate([
137
+ (0, type_graphql_1.InputType)()
138
+ ], BankAccountPatch);
139
+ let BankAccountList = class BankAccountList {
140
+ };
141
+ exports.BankAccountList = BankAccountList;
142
+ tslib_1.__decorate([
143
+ (0, type_graphql_1.Field)(type => [bank_account_1.BankAccount]),
144
+ tslib_1.__metadata("design:type", Array)
145
+ ], BankAccountList.prototype, "items", void 0);
146
+ tslib_1.__decorate([
147
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
148
+ tslib_1.__metadata("design:type", Number)
149
+ ], BankAccountList.prototype, "total", void 0);
150
+ exports.BankAccountList = BankAccountList = tslib_1.__decorate([
151
+ (0, type_graphql_1.ObjectType)()
152
+ ], BankAccountList);
153
+ //# sourceMappingURL=bank-account-type.js.map
@@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AAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAS,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;mDAC/D;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;iDAC/C;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;;8CACtD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;;6CACtD;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;iDACtD;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;;+CAC5D;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACX;2BA/CJ,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAgD5B;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AANY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC;;8CACT;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACN;0BALF,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B","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 { AccountType, BankAccount, OwnerType } from './bank-account'\n\n@InputType()\nexport class NewBankAccount {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true, description: 'Name of the account holder' })\n accountHolderName?: string // 계좌 소유자의 이름\n\n @Field({ nullable: true, description: 'Bank account number' })\n accountNumber?: string\n\n @Field({ nullable: true, description: 'Bank name' })\n bankName?: string\n\n @Field(type => AccountType, { description: 'Type of the account (Bank or Card)' })\n accountType: AccountType\n\n @Field({ nullable: true, description: 'Currency of the account' })\n currency?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => OwnerType, { description: 'Type of the owner of the bank account' })\n ownerType: OwnerType\n\n @Field({ description: 'ID of the owner of the bank account' })\n ownerId: string\n\n @Field({ nullable: true, description: 'IBAN of the bank account' })\n iban?: string // 은행 계좌의 IBAN\n\n @Field({ nullable: true, description: 'BIC of the bank account' })\n bic?: string // 은행 계좌의 BIC\n\n @Field({ nullable: true, description: 'Country of the bank account' })\n country?: string // 은행 계좌의 국적\n\n @Field({ nullable: true, description: 'Cover image of the bank account' })\n image?: string // 은행 계좌의 커버이미지\n}\n\n@InputType()\nexport class BankAccountPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true, description: 'Name of the account holder' })\n accountHolderName?: string // 계좌 소유자의 이름\n\n @Field({ nullable: true, description: 'Bank account number' })\n accountNumber?: string\n\n @Field({ nullable: true, description: 'Bank name' })\n bankName?: string\n\n @Field(type => AccountType, { description: 'Type of the account (Bank or Card)' })\n accountType: AccountType\n\n @Field({ nullable: true, description: 'Currency of the account' })\n currency?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => OwnerType, { description: 'Type of the owner of the bank account' })\n ownerType: OwnerType\n\n @Field({ description: 'ID of the owner of the bank account' })\n ownerId: string\n\n @Field({ nullable: true, description: 'IBAN of the bank account' })\n iban?: string // 은행 계좌의 IBAN\n\n @Field({ nullable: true, description: 'BIC of the bank account' })\n bic?: string // 은행 계좌의 BIC\n\n @Field({ nullable: true, description: 'Country of the bank account' })\n country?: string // 은행 계좌의 국적\n\n @Field({ nullable: true, description: 'Cover image of the bank account' })\n image?: string // 은행 계좌의 커버이미지\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class BankAccountList {\n @Field(type => [BankAccount])\n items: BankAccount[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ export declare enum AccountType {
4
+ Bank = "Bank",
5
+ Card = "Card"
6
+ }
7
+ export declare enum OwnerType {
8
+ Company = "Company",
9
+ Vendor = "Vendor",
10
+ Employee = "Employee"
11
+ }
12
+ export declare class BankAccount {
13
+ readonly id: string;
14
+ version?: number;
15
+ domain?: Domain;
16
+ domainId?: string;
17
+ name?: string;
18
+ description?: string;
19
+ accountHolderName?: string;
20
+ accountNumber?: string;
21
+ bankName?: string;
22
+ accountType: AccountType;
23
+ currency?: string;
24
+ active?: boolean;
25
+ ownerType: OwnerType;
26
+ ownerId: string;
27
+ iban?: string;
28
+ bic?: string;
29
+ country?: string;
30
+ image?: string;
31
+ createdAt?: Date;
32
+ updatedAt?: Date;
33
+ deletedAt?: Date;
34
+ creator?: User;
35
+ creatorId?: string;
36
+ updater?: User;
37
+ updaterId?: string;
38
+ }