@things-factory/accounting 10.1.134 → 10.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist-client/route.d.ts +1 -1
  2. package/dist-client/route.js +0 -12
  3. package/dist-client/route.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-server/index.d.ts +0 -1
  6. package/dist-server/index.js +0 -1
  7. package/dist-server/index.js.map +1 -1
  8. package/dist-server/service/account/account-history.d.ts +13 -6
  9. package/dist-server/service/account/account-history.js +44 -17
  10. package/dist-server/service/account/account-history.js.map +1 -1
  11. package/dist-server/service/account/account-mutation.js +2 -2
  12. package/dist-server/service/account/account-mutation.js.map +1 -1
  13. package/dist-server/service/account/account-type.d.ts +16 -0
  14. package/dist-server/service/account/account-type.js +71 -13
  15. package/dist-server/service/account/account-type.js.map +1 -1
  16. package/dist-server/service/account/account.d.ts +9 -3
  17. package/dist-server/service/account/account.js +34 -8
  18. package/dist-server/service/account/account.js.map +1 -1
  19. package/dist-server/service/accounting-category/accounting-category-mutation.js +2 -2
  20. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  21. package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
  22. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
  23. package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
  24. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
  25. package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
  26. package/dist-server/service/bank-account/bank-account-history.js +46 -59
  27. package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
  28. package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
  29. package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
  30. package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
  31. package/dist-server/service/bank-account/bank-account-query.js +2 -0
  32. package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
  33. package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
  34. package/dist-server/service/bank-account/bank-account-service.js +21 -0
  35. package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
  36. package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
  37. package/dist-server/service/bank-account/bank-account-type.js +45 -69
  38. package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
  39. package/dist-server/service/bank-account/bank-account.d.ts +14 -17
  40. package/dist-server/service/bank-account/bank-account.js +45 -57
  41. package/dist-server/service/bank-account/bank-account.js.map +1 -1
  42. package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
  43. package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
  44. package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
  45. package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
  46. package/dist-server/service/bank-statement/bank-statement.js +109 -0
  47. package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
  48. package/dist-server/service/bank-statement/index.d.ts +5 -0
  49. package/dist-server/service/bank-statement/index.js +9 -0
  50. package/dist-server/service/bank-statement/index.js.map +1 -0
  51. package/dist-server/service/cash-flow-type.d.ts +5 -0
  52. package/dist-server/service/cash-flow-type.js +15 -0
  53. package/dist-server/service/cash-flow-type.js.map +1 -0
  54. package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
  55. package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
  56. package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
  57. package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
  58. package/dist-server/service/financial-institution/index.d.ts +1 -1
  59. package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
  60. package/dist-server/service/financial-statement/financial-statement-history.js +47 -36
  61. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  62. package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
  63. package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
  64. package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
  65. package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
  66. package/dist-server/service/financial-statement/financial-statement-mutation.js +10 -135
  67. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  68. package/dist-server/service/financial-statement/financial-statement-query.d.ts +8 -7
  69. package/dist-server/service/financial-statement/financial-statement-query.js +40 -30
  70. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  71. package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
  72. package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
  73. package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
  74. package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
  75. package/dist-server/service/financial-statement/financial-statement.js +73 -65
  76. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  77. package/dist-server/service/financial-statement/index.d.ts +3 -2
  78. package/dist-server/service/financial-statement/index.js +2 -2
  79. package/dist-server/service/financial-statement/index.js.map +1 -1
  80. package/dist-server/service/index.d.ts +15 -3
  81. package/dist-server/service/index.js +30 -13
  82. package/dist-server/service/index.js.map +1 -1
  83. package/dist-server/service/payment/index.d.ts +1 -0
  84. package/dist-server/service/payment/index.js +1 -0
  85. package/dist-server/service/payment/index.js.map +1 -1
  86. package/dist-server/service/payment/payment-history.d.ts +9 -16
  87. package/dist-server/service/payment/payment-history.js +36 -70
  88. package/dist-server/service/payment/payment-history.js.map +1 -1
  89. package/dist-server/service/payment/payment-mutation.d.ts +0 -1
  90. package/dist-server/service/payment/payment-mutation.js +14 -79
  91. package/dist-server/service/payment/payment-mutation.js.map +1 -1
  92. package/dist-server/service/payment/payment-query.d.ts +3 -0
  93. package/dist-server/service/payment/payment-query.js +30 -1
  94. package/dist-server/service/payment/payment-query.js.map +1 -1
  95. package/dist-server/service/payment/payment-service.d.ts +16 -0
  96. package/dist-server/service/payment/payment-service.js +140 -0
  97. package/dist-server/service/payment/payment-service.js.map +1 -0
  98. package/dist-server/service/payment/payment-targets.d.ts +31 -0
  99. package/dist-server/service/payment/payment-targets.js +19 -0
  100. package/dist-server/service/payment/payment-targets.js.map +1 -0
  101. package/dist-server/service/payment/payment-type.d.ts +13 -17
  102. package/dist-server/service/payment/payment-type.js +35 -51
  103. package/dist-server/service/payment/payment-type.js.map +1 -1
  104. package/dist-server/service/payment/payment.d.ts +23 -22
  105. package/dist-server/service/payment/payment.js +66 -94
  106. package/dist-server/service/payment/payment.js.map +1 -1
  107. package/dist-server/service/payment/transfer-target.d.ts +1 -0
  108. package/dist-server/service/payment/transfer-target.js +43 -0
  109. package/dist-server/service/payment/transfer-target.js.map +1 -0
  110. package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
  111. package/dist-server/service/recurring-cash-item/index.js +10 -0
  112. package/dist-server/service/recurring-cash-item/index.js.map +1 -0
  113. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
  114. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
  115. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
  116. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
  117. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
  118. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
  119. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
  120. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
  121. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
  122. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
  123. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
  124. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
  125. package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
  126. package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
  127. package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
  128. package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
  129. package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
  130. package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
  131. package/dist-server/service/transaction/transaction-history.d.ts +42 -15
  132. package/dist-server/service/transaction/transaction-history.js +160 -54
  133. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  134. package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
  135. package/dist-server/service/transaction/transaction-mutation.js +13 -78
  136. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  137. package/dist-server/service/transaction/transaction-period.d.ts +16 -0
  138. package/dist-server/service/transaction/transaction-period.js +49 -0
  139. package/dist-server/service/transaction/transaction-period.js.map +1 -0
  140. package/dist-server/service/transaction/transaction-query.d.ts +12 -0
  141. package/dist-server/service/transaction/transaction-query.js +84 -2
  142. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  143. package/dist-server/service/transaction/transaction-service.d.ts +30 -0
  144. package/dist-server/service/transaction/transaction-service.js +130 -0
  145. package/dist-server/service/transaction/transaction-service.js.map +1 -0
  146. package/dist-server/service/transaction/transaction-type.d.ts +39 -7
  147. package/dist-server/service/transaction/transaction-type.js +145 -23
  148. package/dist-server/service/transaction/transaction-type.js.map +1 -1
  149. package/dist-server/service/transaction/transaction.d.ts +58 -31
  150. package/dist-server/service/transaction/transaction.js +216 -102
  151. package/dist-server/service/transaction/transaction.js.map +1 -1
  152. package/dist-server/tsconfig.tsbuildinfo +1 -1
  153. package/package.json +5 -3
  154. package/things-factory.config.js +0 -4
  155. package/translations/en.json +34 -2
  156. package/translations/ja.json +0 -1
  157. package/translations/ko.json +34 -2
  158. package/translations/ms.json +0 -1
  159. package/translations/zh.json +0 -1
  160. package/dist-client/pages/account/account-importer.d.ts +0 -22
  161. package/dist-client/pages/account/account-importer.js +0 -99
  162. package/dist-client/pages/account/account-importer.js.map +0 -1
  163. package/dist-client/pages/account/account-list-page.d.ts +0 -57
  164. package/dist-client/pages/account/account-list-page.js +0 -306
  165. package/dist-client/pages/account/account-list-page.js.map +0 -1
  166. package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
  167. package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
  168. package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
  169. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
  170. package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
  171. package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
  172. package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
  173. package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
  174. package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
  175. package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
  176. package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
  177. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
  178. package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
  179. package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
  180. package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
  181. package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
  182. package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
  183. package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
  184. package/dist-client/pages/payment/payment-importer.d.ts +0 -23
  185. package/dist-client/pages/payment/payment-importer.js +0 -92
  186. package/dist-client/pages/payment/payment-importer.js.map +0 -1
  187. package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
  188. package/dist-client/pages/payment/payment-list-page.js +0 -317
  189. package/dist-client/pages/payment/payment-list-page.js.map +0 -1
  190. package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
  191. package/dist-client/pages/transaction/transaction-importer.js +0 -99
  192. package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
  193. package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
  194. package/dist-client/pages/transaction/transaction-list-page.js +0 -280
  195. package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
  196. package/dist-server/controllers/index.d.ts +0 -1
  197. package/dist-server/controllers/index.js +0 -5
  198. package/dist-server/controllers/index.js.map +0 -1
  199. package/dist-server/controllers/summary-statements.d.ts +0 -4
  200. package/dist-server/controllers/summary-statements.js +0 -149
  201. package/dist-server/controllers/summary-statements.js.map +0 -1
  202. package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
  203. package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
  204. package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
  205. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
  206. package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -95
  207. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
  208. package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
  209. package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
  210. package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
  211. package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
  212. package/dist-server/service/income-statement/event-subscriber.js +0 -21
  213. package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
  214. package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
  215. package/dist-server/service/income-statement/income-statement-history.js +0 -146
  216. package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
  217. package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
  218. package/dist-server/service/income-statement/income-statement-line-item.js +0 -97
  219. package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
  220. package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
  221. package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
  222. package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
  223. package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
  224. package/dist-server/service/income-statement/income-statement-query.js +0 -81
  225. package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
  226. package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
  227. package/dist-server/service/income-statement/income-statement-type.js +0 -77
  228. package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
  229. package/dist-server/service/income-statement/income-statement.d.ts +0 -28
  230. package/dist-server/service/income-statement/income-statement.js +0 -137
  231. package/dist-server/service/income-statement/income-statement.js.map +0 -1
  232. package/dist-server/service/income-statement/index.d.ts +0 -8
  233. package/dist-server/service/income-statement/index.js +0 -13
  234. package/dist-server/service/income-statement/index.js.map +0 -1
@@ -1,33 +1,30 @@
1
1
  import { Domain } from '@things-factory/shell';
2
2
  import { User } from '@things-factory/auth-base';
3
3
  export declare enum AccountType {
4
- Bank = "Bank",
5
- Card = "Card"
4
+ BANK = "BANK",
5
+ CARD = "CARD"
6
6
  }
7
- export declare enum OwnerType {
8
- Company = "Company",
9
- Vendor = "Vendor",
10
- Employee = "Employee"
7
+ export declare enum BankAccountPurpose {
8
+ OPERATING = "OPERATING",
9
+ RESTRICTED = "RESTRICTED",
10
+ CASH = "CASH"
11
11
  }
12
12
  export declare class BankAccount {
13
13
  readonly id: string;
14
14
  version?: number;
15
15
  domain?: Domain;
16
16
  domainId?: string;
17
- name?: string;
17
+ name: string;
18
18
  description?: string;
19
- accountHolderName?: string;
20
- accountNumber?: string;
21
19
  bankName?: string;
20
+ accountNumber?: string;
22
21
  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;
22
+ currency: string;
23
+ timezone: string;
24
+ purpose: BankAccountPurpose;
25
+ statedBalance?: number;
26
+ statedBalanceDate?: string;
27
+ active: boolean;
31
28
  createdAt?: Date;
32
29
  updatedAt?: Date;
33
30
  deletedAt?: Date;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BankAccount = exports.OwnerType = exports.AccountType = void 0;
3
+ exports.BankAccount = exports.BankAccountPurpose = exports.AccountType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const typeorm_1 = require("typeorm");
6
6
  const type_graphql_1 = require("type-graphql");
@@ -8,22 +8,22 @@ const shell_1 = require("@things-factory/shell");
8
8
  const auth_base_1 = require("@things-factory/auth-base");
9
9
  var AccountType;
10
10
  (function (AccountType) {
11
- AccountType["Bank"] = "Bank";
12
- AccountType["Card"] = "Card";
11
+ AccountType["BANK"] = "BANK";
12
+ AccountType["CARD"] = "CARD";
13
13
  })(AccountType || (exports.AccountType = AccountType = {}));
14
14
  (0, type_graphql_1.registerEnumType)(AccountType, {
15
15
  name: 'AccountType',
16
- description: 'Type of the account (Bank or Card)'
16
+ description: 'Type of the account (bank or card)'
17
17
  });
18
- var OwnerType;
19
- (function (OwnerType) {
20
- OwnerType["Company"] = "Company";
21
- OwnerType["Vendor"] = "Vendor";
22
- OwnerType["Employee"] = "Employee";
23
- })(OwnerType || (exports.OwnerType = OwnerType = {}));
24
- (0, type_graphql_1.registerEnumType)(OwnerType, {
25
- name: 'OwnerType',
26
- description: 'Type of the owner of the bank account'
18
+ var BankAccountPurpose;
19
+ (function (BankAccountPurpose) {
20
+ BankAccountPurpose["OPERATING"] = "OPERATING";
21
+ BankAccountPurpose["RESTRICTED"] = "RESTRICTED";
22
+ BankAccountPurpose["CASH"] = "CASH";
23
+ })(BankAccountPurpose || (exports.BankAccountPurpose = BankAccountPurpose = {}));
24
+ (0, type_graphql_1.registerEnumType)(BankAccountPurpose, {
25
+ name: 'BankAccountPurpose',
26
+ description: 'What the money in an account may be used for - running the business, held for one purpose, cash kept on hand'
27
27
  });
28
28
  let BankAccount = class BankAccount {
29
29
  constructor() {
@@ -51,75 +51,63 @@ tslib_1.__decorate([
51
51
  tslib_1.__metadata("design:type", String)
52
52
  ], BankAccount.prototype, "domainId", void 0);
53
53
  tslib_1.__decorate([
54
- (0, typeorm_1.Column)({ nullable: false }),
55
- (0, type_graphql_1.Field)({ nullable: true }),
54
+ (0, typeorm_1.Column)(),
55
+ (0, type_graphql_1.Field)({ description: 'Name of the account, unique in the domain' }),
56
56
  tslib_1.__metadata("design:type", String)
57
57
  ], BankAccount.prototype, "name", void 0);
58
58
  tslib_1.__decorate([
59
- (0, typeorm_1.Column)({ nullable: true }),
60
- (0, type_graphql_1.Field)({ nullable: true }),
59
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
60
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Description' }),
61
61
  tslib_1.__metadata("design:type", String)
62
62
  ], BankAccount.prototype, "description", void 0);
63
63
  tslib_1.__decorate([
64
64
  (0, typeorm_1.Column)({ nullable: true }),
65
- (0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
65
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
66
66
  tslib_1.__metadata("design:type", String)
67
- ], BankAccount.prototype, "accountHolderName", void 0);
67
+ ], BankAccount.prototype, "bankName", void 0);
68
68
  tslib_1.__decorate([
69
- (0, typeorm_1.Column)({ nullable: false }),
70
- (0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
69
+ (0, typeorm_1.Column)({ nullable: true }),
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Account number' }),
71
71
  tslib_1.__metadata("design:type", String)
72
72
  ], BankAccount.prototype, "accountNumber", void 0);
73
73
  tslib_1.__decorate([
74
- (0, typeorm_1.Column)({ nullable: false }),
75
- (0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
76
- tslib_1.__metadata("design:type", String)
77
- ], BankAccount.prototype, "bankName", void 0);
78
- tslib_1.__decorate([
79
- (0, typeorm_1.Column)({ nullable: false }),
80
- (0, type_graphql_1.Field)(type => AccountType, { description: 'Type of the account (Bank or Card)' }),
74
+ (0, typeorm_1.Column)({ default: AccountType.BANK }),
75
+ (0, type_graphql_1.Field)(type => AccountType, { description: 'Type of the account (bank or card)' }),
81
76
  tslib_1.__metadata("design:type", String)
82
77
  ], BankAccount.prototype, "accountType", void 0);
83
78
  tslib_1.__decorate([
84
- (0, typeorm_1.Column)({ nullable: true }),
85
- (0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
79
+ (0, typeorm_1.Column)({ default: 'KRW' }),
80
+ (0, type_graphql_1.Field)({ description: 'ISO 4217 code - the currency of the account' }),
86
81
  tslib_1.__metadata("design:type", String)
87
82
  ], BankAccount.prototype, "currency", void 0);
88
83
  tslib_1.__decorate([
89
- (0, typeorm_1.Column)({ nullable: false, default: false }),
90
- (0, type_graphql_1.Field)({ nullable: true }),
91
- tslib_1.__metadata("design:type", Boolean)
92
- ], BankAccount.prototype, "active", void 0);
93
- tslib_1.__decorate([
94
- (0, typeorm_1.Column)({ nullable: false }),
95
- (0, type_graphql_1.Field)(type => OwnerType, { description: 'Type of the owner of the bank account' }),
84
+ (0, typeorm_1.Column)({ default: 'Asia/Seoul' }),
85
+ (0, type_graphql_1.Field)({ description: 'IANA time zone the bank keeps the account in - the day of a bank line is its day there' }),
96
86
  tslib_1.__metadata("design:type", String)
97
- ], BankAccount.prototype, "ownerType", void 0);
87
+ ], BankAccount.prototype, "timezone", void 0);
98
88
  tslib_1.__decorate([
99
- (0, typeorm_1.Column)({ nullable: false }),
100
- (0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
89
+ (0, typeorm_1.Column)({ default: BankAccountPurpose.OPERATING }),
90
+ (0, type_graphql_1.Field)(type => BankAccountPurpose, { description: 'What the money in the account may be used for' }),
101
91
  tslib_1.__metadata("design:type", String)
102
- ], BankAccount.prototype, "ownerId", void 0);
92
+ ], BankAccount.prototype, "purpose", void 0);
103
93
  tslib_1.__decorate([
104
- (0, typeorm_1.Column)({ nullable: true }),
105
- (0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
106
- tslib_1.__metadata("design:type", String)
107
- ], BankAccount.prototype, "iban", void 0);
108
- tslib_1.__decorate([
109
- (0, typeorm_1.Column)({ nullable: true }),
110
- (0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
111
- tslib_1.__metadata("design:type", String)
112
- ], BankAccount.prototype, "bic", void 0);
94
+ (0, typeorm_1.Column)((0, shell_1.moneyColumn)({ nullable: true, default: null })),
95
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, {
96
+ nullable: true,
97
+ description: 'A balance someone read off the account, for an account with no bank lines (a pension, cash in the safe)'
98
+ }),
99
+ tslib_1.__metadata("design:type", Number)
100
+ ], BankAccount.prototype, "statedBalance", void 0);
113
101
  tslib_1.__decorate([
114
102
  (0, typeorm_1.Column)({ nullable: true }),
115
- (0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
103
+ (0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the day the stated balance was read' }),
116
104
  tslib_1.__metadata("design:type", String)
117
- ], BankAccount.prototype, "country", void 0);
105
+ ], BankAccount.prototype, "statedBalanceDate", void 0);
118
106
  tslib_1.__decorate([
119
- (0, typeorm_1.Column)({ nullable: true }),
120
- (0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
121
- tslib_1.__metadata("design:type", String)
122
- ], BankAccount.prototype, "image", void 0);
107
+ (0, typeorm_1.Column)({ default: true }),
108
+ (0, type_graphql_1.Field)({ description: 'An inactive account stays on old lines but is not offered for new ones' }),
109
+ tslib_1.__metadata("design:type", Boolean)
110
+ ], BankAccount.prototype, "active", void 0);
123
111
  tslib_1.__decorate([
124
112
  (0, typeorm_1.CreateDateColumn)(),
125
113
  (0, type_graphql_1.Field)({ nullable: true }),
@@ -159,6 +147,6 @@ exports.BankAccount = BankAccount = tslib_1.__decorate([
159
147
  where: '"deleted_at" IS NULL',
160
148
  unique: true
161
149
  }),
162
- (0, type_graphql_1.ObjectType)({ description: 'Entity for BankAccount' })
150
+ (0, type_graphql_1.ObjectType)({ description: 'An account of the business at a bank or card company, or cash it keeps' })
163
151
  ], BankAccount);
164
152
  //# sourceMappingURL=bank-account.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bank-account.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,IAAA,+BAAgB,EAAC,WAAW,EAAE;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAEF,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAED,IAAA,+BAAgB,EAAC,SAAS,EAAE;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAA;AAQK,IAAM,WAAW,GAAjB,MAAM,WAAW;IAAjB;QAOL,YAAO,GAAY,CAAC,CAAA;IA0FtB,CAAC;CAAA,CAAA;AAjGY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;uCACC;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;2CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC;;6CA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yToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum AccountType {\n Bank = 'Bank',\n Card = 'Card'\n}\n\nregisterEnumType(AccountType, {\n name: 'AccountType',\n description: 'Type of the account (Bank or Card)'\n})\n\nexport enum OwnerType {\n Company = 'Company',\n Vendor = 'Vendor',\n Employee = 'Employee'\n}\n\nregisterEnumType(OwnerType, {\n name: 'OwnerType',\n description: 'Type of the owner of the bank account'\n})\n\n@Entity()\n@Index('ix_bank_account_0', (bankAccount: BankAccount) => [bankAccount.domain, bankAccount.name], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@ObjectType({ description: 'Entity for BankAccount' })\nexport class BankAccount {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((bankAccount: BankAccount) => bankAccount.domain)\n domainId?: string\n\n @Column({ nullable: false })\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Name of the account holder' })\n accountHolderName?: string // 계좌 소유자의 이름\n\n @Column({ nullable: false })\n @Field({ nullable: true, description: 'Bank account number' })\n accountNumber?: string\n\n @Column({ nullable: false })\n @Field({ nullable: true, description: 'Bank name' })\n bankName?: string\n\n @Column({ nullable: false })\n @Field(type => AccountType, { description: 'Type of the account (Bank or Card)' })\n accountType: AccountType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Currency of the account' })\n currency?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: false })\n @Field(type => OwnerType, { description: 'Type of the owner of the bank account' })\n ownerType: OwnerType\n\n @Column({ nullable: false })\n @Field({ description: 'ID of the owner of the bank account' })\n ownerId: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'IBAN of the bank account' })\n iban?: string // 은행 계좌의 IBAN\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'BIC of the bank account' })\n bic?: string // 은행 계좌의 BIC\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Country of the bank account' })\n country?: string // 은행 계좌의 국적\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Cover image of the bank account' })\n image?: string // 은행 계좌의 커버이미지\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"bank-account.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA6E;AAE7E,iDAA2D;AAC3D,yDAAgD;AAEhD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,IAAA,+BAAgB,EAAC,WAAW,EAAE;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAEF,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,+CAAyB,CAAA;IACzB,mCAAa,CAAA;AACf,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B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CAAC,EAAE;QAChG,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wEAAwE,EAAE,CAAC;GACzF,WAAW,CAyFvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Float, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain, moneyColumn } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum AccountType {\n BANK = 'BANK',\n CARD = 'CARD'\n}\n\nregisterEnumType(AccountType, {\n name: 'AccountType',\n description: 'Type of the account (bank or card)'\n})\n\nexport enum BankAccountPurpose {\n OPERATING = 'OPERATING',\n RESTRICTED = 'RESTRICTED',\n CASH = 'CASH'\n}\n\nregisterEnumType(BankAccountPurpose, {\n name: 'BankAccountPurpose',\n description:\n 'What the money in an account may be used for - running the business, held for one purpose, cash kept on hand'\n})\n\n@Entity()\n@Index('ix_bank_account_0', (bankAccount: BankAccount) => [bankAccount.domain, bankAccount.name], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@ObjectType({ description: 'An account of the business at a bank or card company, or cash it keeps' })\nexport class BankAccount {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((bankAccount: BankAccount) => bankAccount.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'Name of the account, unique in the domain' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Description' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Bank name' })\n bankName?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Account number' })\n accountNumber?: string\n\n @Column({ default: AccountType.BANK })\n @Field(type => AccountType, { description: 'Type of the account (bank or card)' })\n accountType: AccountType\n\n @Column({ default: 'KRW' })\n @Field({ description: 'ISO 4217 code - the currency of the account' })\n currency: string\n\n @Column({ default: 'Asia/Seoul' })\n @Field({ description: 'IANA time zone the bank keeps the account in - the day of a bank line is its day there' })\n timezone: string\n\n @Column({ default: BankAccountPurpose.OPERATING })\n @Field(type => BankAccountPurpose, { description: 'What the money in the account may be used for' })\n purpose: BankAccountPurpose\n\n @Column(moneyColumn({ nullable: true, default: null }))\n @Field(type => Float, {\n nullable: true,\n description:\n 'A balance someone read off the account, for an account with no bank lines (a pension, cash in the safe)'\n })\n statedBalance?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the day the stated balance was read' })\n statedBalanceDate?: string\n\n @Column({ default: true })\n @Field({ description: 'An inactive account stays on old lines but is not offered for new ones' })\n active: boolean\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { BankStatement } from './bank-statement';
4
+ export declare class BankStatementList {
5
+ items: BankStatement[];
6
+ total: number;
7
+ }
8
+ export declare class BankStatementQuery {
9
+ bankStatement(id: string, context: ResolverContext): Promise<BankStatement | null>;
10
+ bankStatements(params: ListParam, context: ResolverContext): Promise<BankStatementList>;
11
+ domain(statement: BankStatement): Promise<Domain>;
12
+ creator(statement: BankStatement): Promise<User | null>;
13
+ updater(statement: BankStatement): Promise<User | null>;
14
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankStatementQuery = exports.BankStatementList = 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_statement_1 = require("./bank-statement");
9
+ let BankStatementList = class BankStatementList {
10
+ };
11
+ exports.BankStatementList = BankStatementList;
12
+ tslib_1.__decorate([
13
+ (0, type_graphql_1.Field)(type => [bank_statement_1.BankStatement], { description: 'The statements on this page' }),
14
+ tslib_1.__metadata("design:type", Array)
15
+ ], BankStatementList.prototype, "items", void 0);
16
+ tslib_1.__decorate([
17
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many there are in all' }),
18
+ tslib_1.__metadata("design:type", Number)
19
+ ], BankStatementList.prototype, "total", void 0);
20
+ exports.BankStatementList = BankStatementList = tslib_1.__decorate([
21
+ (0, type_graphql_1.ObjectType)({ description: 'A page of bank statements' })
22
+ ], BankStatementList);
23
+ let BankStatementQuery = class BankStatementQuery {
24
+ async bankStatement(id, context) {
25
+ const { domain } = context.state;
26
+ return await (0, shell_1.getRepository)(bank_statement_1.BankStatement).findOne({ where: { domain: { id: domain.id }, id } });
27
+ }
28
+ async bankStatements(params, context) {
29
+ const { domain } = context.state;
30
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
31
+ domain,
32
+ params,
33
+ repository: (0, shell_1.getRepository)(bank_statement_1.BankStatement),
34
+ searchables: ['filename', 'bankName', 'accountNumber']
35
+ });
36
+ const [items, total] = await queryBuilder.getManyAndCount();
37
+ return { items, total };
38
+ }
39
+ async domain(statement) {
40
+ return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: statement.domainId });
41
+ }
42
+ async creator(statement) {
43
+ return statement.creatorId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: statement.creatorId }) : null;
44
+ }
45
+ async updater(statement) {
46
+ return statement.updaterId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: statement.updaterId }) : null;
47
+ }
48
+ };
49
+ exports.BankStatementQuery = BankStatementQuery;
50
+ tslib_1.__decorate([
51
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
52
+ (0, type_graphql_1.Query)(returns => bank_statement_1.BankStatement, { nullable: true, description: 'To fetch a BankStatement' }),
53
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
54
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
55
+ tslib_1.__metadata("design:type", Function),
56
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
57
+ tslib_1.__metadata("design:returntype", Promise)
58
+ ], BankStatementQuery.prototype, "bankStatement", null);
59
+ tslib_1.__decorate([
60
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
61
+ (0, type_graphql_1.Query)(returns => BankStatementList, { description: 'To fetch multiple BankStatements' }),
62
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
63
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
64
+ tslib_1.__metadata("design:type", Function),
65
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
66
+ tslib_1.__metadata("design:returntype", Promise)
67
+ ], BankStatementQuery.prototype, "bankStatements", null);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
70
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [bank_statement_1.BankStatement]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], BankStatementQuery.prototype, "domain", null);
75
+ tslib_1.__decorate([
76
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
77
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
78
+ tslib_1.__metadata("design:type", Function),
79
+ tslib_1.__metadata("design:paramtypes", [bank_statement_1.BankStatement]),
80
+ tslib_1.__metadata("design:returntype", Promise)
81
+ ], BankStatementQuery.prototype, "creator", null);
82
+ tslib_1.__decorate([
83
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
84
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
85
+ tslib_1.__metadata("design:type", Function),
86
+ tslib_1.__metadata("design:paramtypes", [bank_statement_1.BankStatement]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], BankStatementQuery.prototype, "updater", null);
89
+ exports.BankStatementQuery = BankStatementQuery = tslib_1.__decorate([
90
+ (0, type_graphql_1.Resolver)(bank_statement_1.BankStatement)
91
+ ], BankStatementQuery);
92
+ //# sourceMappingURL=bank-statement-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-statement-query.js","sourceRoot":"","sources":["../../../server/service/bank-statement/bank-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAsH;AAEtH,iDAAuG;AACvG,yDAAgD;AAEhD,qDAAgD;AAGzC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AANY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;gDACzD;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;gDACpD;4BALF,iBAAiB;IAD7B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;GAC5C,iBAAiB,CAM7B;AAGM,IAAM,kBAAkB,GAAxB,MAAM,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,CAAA;;6CAAY,8BAAa;;iDAE7C;6BAxCU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAyC9B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive, ObjectType, Field, Int } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { BankStatement } from './bank-statement'\n\n@ObjectType({ description: 'A page of bank statements' })\nexport class BankStatementList {\n @Field(type => [BankStatement], { description: 'The statements on this page' })\n items: BankStatement[]\n\n @Field(type => Int, { description: 'How many there are in all' })\n total: number\n}\n\n@Resolver(BankStatement)\nexport class BankStatementQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => BankStatement, { nullable: true, description: 'To fetch a BankStatement' })\n async bankStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BankStatement | null> {\n const { domain } = context.state\n\n return await getRepository(BankStatement).findOne({ where: { domain: { id: domain.id }, id } })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => BankStatementList, { description: 'To fetch multiple BankStatements' })\n async bankStatements(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<BankStatementList> {\n const { domain } = context.state\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: getRepository(BankStatement),\n searchables: ['filename', 'bankName', 'accountNumber']\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() statement: BankStatement): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: statement.domainId })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() statement: BankStatement): Promise<User | null> {\n return statement.creatorId ? await getRepository(User).findOneBy({ id: statement.creatorId }) : null\n }\n\n @FieldResolver(type => User, { nullable: true })\n async updater(@Root() statement: BankStatement): Promise<User | null> {\n return statement.updaterId ? await getRepository(User).findOneBy({ id: statement.updaterId }) : null\n }\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ /**
4
+ * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row
5
+ * and the same file is not read twice.
6
+ */
7
+ export declare class BankStatement {
8
+ readonly id: string;
9
+ domain?: Domain;
10
+ domainId?: string;
11
+ filename: string;
12
+ fileHash: string;
13
+ bankName: string;
14
+ accountNumber: string;
15
+ periodStart?: string;
16
+ periodEnd?: string;
17
+ timezones?: Record<string, string>;
18
+ rawRows: any[];
19
+ createdAt?: Date;
20
+ updatedAt?: Date;
21
+ deletedAt?: Date;
22
+ creator?: User;
23
+ creatorId?: string;
24
+ updater?: User;
25
+ updaterId?: string;
26
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BankStatement = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ /**
10
+ * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row
11
+ * and the same file is not read twice.
12
+ */
13
+ let BankStatement = class BankStatement {
14
+ };
15
+ exports.BankStatement = BankStatement;
16
+ tslib_1.__decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
18
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], BankStatement.prototype, "id", void 0);
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
23
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain whose statement it is' }),
24
+ tslib_1.__metadata("design:type", shell_1.Domain)
25
+ ], BankStatement.prototype, "domain", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.RelationId)((statement) => statement.domain),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], BankStatement.prototype, "domainId", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.Column)(),
32
+ (0, type_graphql_1.Field)({ description: 'The file name it was uploaded under' }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], BankStatement.prototype, "filename", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.Column)(),
37
+ (0, type_graphql_1.Field)({ description: 'Hash of the file - the same file is read once' }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], BankStatement.prototype, "fileHash", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)(),
42
+ (0, type_graphql_1.Field)({ description: 'The bank, as the file says' }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], BankStatement.prototype, "bankName", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.Column)(),
47
+ (0, type_graphql_1.Field)({ description: 'The account number, as the file says' }),
48
+ tslib_1.__metadata("design:type", String)
49
+ ], BankStatement.prototype, "accountNumber", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.Column)({ nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the first day the file covers' }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], BankStatement.prototype, "periodStart", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.Column)({ nullable: true }),
57
+ (0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the last day the file covers' }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], BankStatement.prototype, "periodEnd", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
62
+ tslib_1.__metadata("design:type", Object)
63
+ ], BankStatement.prototype, "timezones", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.Column)({ type: 'simple-json' }),
66
+ tslib_1.__metadata("design:type", Array)
67
+ ], BankStatement.prototype, "rawRows", void 0);
68
+ tslib_1.__decorate([
69
+ (0, typeorm_1.CreateDateColumn)(),
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was read' }),
71
+ tslib_1.__metadata("design:type", Date)
72
+ ], BankStatement.prototype, "createdAt", void 0);
73
+ tslib_1.__decorate([
74
+ (0, typeorm_1.UpdateDateColumn)(),
75
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it last changed' }),
76
+ tslib_1.__metadata("design:type", Date)
77
+ ], BankStatement.prototype, "updatedAt", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.DeleteDateColumn)(),
80
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was deleted' }),
81
+ tslib_1.__metadata("design:type", Date)
82
+ ], BankStatement.prototype, "deletedAt", void 0);
83
+ tslib_1.__decorate([
84
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
85
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who read it' }),
86
+ tslib_1.__metadata("design:type", auth_base_1.User)
87
+ ], BankStatement.prototype, "creator", void 0);
88
+ tslib_1.__decorate([
89
+ (0, typeorm_1.RelationId)((statement) => statement.creator),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], BankStatement.prototype, "creatorId", void 0);
92
+ tslib_1.__decorate([
93
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
94
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who last changed it' }),
95
+ tslib_1.__metadata("design:type", auth_base_1.User)
96
+ ], BankStatement.prototype, "updater", void 0);
97
+ tslib_1.__decorate([
98
+ (0, typeorm_1.RelationId)((statement) => statement.updater),
99
+ tslib_1.__metadata("design:type", String)
100
+ ], BankStatement.prototype, "updaterId", void 0);
101
+ exports.BankStatement = BankStatement = tslib_1.__decorate([
102
+ (0, typeorm_1.Entity)(),
103
+ (0, typeorm_1.Index)('ix_bank_statement_0', (statement) => [statement.domain, statement.fileHash], {
104
+ unique: true,
105
+ where: '"deleted_at" IS NULL'
106
+ }),
107
+ (0, type_graphql_1.ObjectType)({ description: 'A bank statement file as it was read' })
108
+ ], BankStatement);
109
+ //# sourceMappingURL=bank-statement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank-statement.js","sourceRoot":"","sources":["../../../server/service/bank-statement/bank-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAoD;AAEpD,iDAA8C;AAC9C,yDAAgD;AAEhD;;;GAGG;AAOI,IAAM,aAAa,GAAnB,MAAM,aAAa;CAmEzB,CAAA;AAnEY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;yCACrC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;sCAClF,cAAM;6CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,SAAwB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;;+CAC1C;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;+CAC9C;AAIhB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;+CACxD;AAIhB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE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,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;sCAC1D,gBAAI;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAwB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;gDAC1C;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;sCAClE,gBAAI;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAwB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;gDAC1C;wBAlEP,aAAa;IANzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,SAAwB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QAClG,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,aAAa,CAmEzB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, ObjectType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n/**\n * A bank statement file as it was read: what the bank gave, kept whole, so every line can be traced back to its row\n * and the same file is not read twice.\n */\n@Entity()\n@Index('ix_bank_statement_0', (statement: BankStatement) => [statement.domain, statement.fileHash], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType({ description: 'A bank statement file as it was read' })\nexport class BankStatement {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain whose statement it is' })\n domain?: Domain\n\n @RelationId((statement: BankStatement) => statement.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'The file name it was uploaded under' })\n filename: string\n\n @Column()\n @Field({ description: 'Hash of the file - the same file is read once' })\n fileHash: string\n\n @Column()\n @Field({ description: 'The bank, as the file says' })\n bankName: string\n\n @Column()\n @Field({ description: 'The account number, as the file says' })\n accountNumber: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the first day the file covers' })\n periodStart?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the last day the file covers' })\n periodEnd?: string\n\n @Column({ type: 'simple-json', nullable: true })\n timezones?: Record<string, string>\n\n @Column({ type: 'simple-json' })\n rawRows: any[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'When it was read' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'When it last changed' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When it was deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who read it' })\n creator?: User\n\n @RelationId((statement: BankStatement) => statement.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who last changed it' })\n updater?: User\n\n @RelationId((statement: BankStatement) => statement.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { BankStatement } from './bank-statement';
2
+ import { BankStatementQuery } from './bank-statement-query';
3
+ export declare const entities: (typeof BankStatement)[];
4
+ export declare const resolvers: (typeof BankStatementQuery)[];
5
+ export declare const subscribers: any[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribers = exports.resolvers = exports.entities = void 0;
4
+ const bank_statement_1 = require("./bank-statement");
5
+ const bank_statement_query_1 = require("./bank-statement-query");
6
+ exports.entities = [bank_statement_1.BankStatement];
7
+ exports.resolvers = [bank_statement_query_1.BankStatementQuery];
8
+ exports.subscribers = [];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/bank-statement/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,iEAA2D;AAE9C,QAAA,QAAQ,GAAG,CAAC,8BAAa,CAAC,CAAA;AAC1B,QAAA,SAAS,GAAG,CAAC,yCAAkB,CAAC,CAAA;AAChC,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { BankStatement } from './bank-statement'\nimport { BankStatementQuery } from './bank-statement-query'\n\nexport const entities = [BankStatement]\nexport const resolvers = [BankStatementQuery]\nexport const subscribers = []\n"]}
@@ -0,0 +1,5 @@
1
+ /** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */
2
+ export declare enum CashFlowType {
3
+ INCOME = "INCOME",
4
+ EXPENSE = "EXPENSE"
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CashFlowType = void 0;
4
+ const type_graphql_1 = require("type-graphql");
5
+ /** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */
6
+ var CashFlowType;
7
+ (function (CashFlowType) {
8
+ CashFlowType["INCOME"] = "INCOME";
9
+ CashFlowType["EXPENSE"] = "EXPENSE";
10
+ })(CashFlowType || (exports.CashFlowType = CashFlowType = {}));
11
+ (0, type_graphql_1.registerEnumType)(CashFlowType, {
12
+ name: 'CashFlowType',
13
+ description: 'Direction of a cash movement - money in or money out'
14
+ });
15
+ //# sourceMappingURL=cash-flow-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cash-flow-type.js","sourceRoot":"","sources":["../../server/service/cash-flow-type.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAE/C,qHAAqH;AACrH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,sDAAsD;CACpE,CAAC,CAAA","sourcesContent":["import { registerEnumType } from 'type-graphql'\n\n/** Which way money moves. Shared by transactions, account subjects and recurring items - all say it the same way. */\nexport enum CashFlowType {\n INCOME = 'INCOME',\n EXPENSE = 'EXPENSE'\n}\n\nregisterEnumType(CashFlowType, {\n name: 'CashFlowType',\n description: 'Direction of a cash movement - money in or money out'\n})\n"]}