@things-factory/accounting 10.1.124 → 10.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist-client/route.d.ts +1 -1
  2. package/dist-client/route.js +0 -12
  3. package/dist-client/route.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-server/index.d.ts +0 -1
  6. package/dist-server/index.js +0 -1
  7. package/dist-server/index.js.map +1 -1
  8. package/dist-server/service/account/account-history.d.ts +13 -6
  9. package/dist-server/service/account/account-history.js +44 -17
  10. package/dist-server/service/account/account-history.js.map +1 -1
  11. package/dist-server/service/account/account-mutation.js +8 -8
  12. package/dist-server/service/account/account-mutation.js.map +1 -1
  13. package/dist-server/service/account/account-query.js +2 -2
  14. package/dist-server/service/account/account-query.js.map +1 -1
  15. package/dist-server/service/account/account-type.d.ts +16 -0
  16. package/dist-server/service/account/account-type.js +71 -13
  17. package/dist-server/service/account/account-type.js.map +1 -1
  18. package/dist-server/service/account/account.d.ts +9 -3
  19. package/dist-server/service/account/account.js +34 -8
  20. package/dist-server/service/account/account.js.map +1 -1
  21. package/dist-server/service/account/index.d.ts +1 -1
  22. package/dist-server/service/accounting-category/accounting-category-mutation.js +8 -8
  23. package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
  24. package/dist-server/service/accounting-category/accounting-category-query.js +2 -2
  25. package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
  26. package/dist-server/service/accounting-category/index.d.ts +1 -1
  27. package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
  28. package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
  29. package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
  30. package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
  31. package/dist-server/service/accounting-document/index.d.ts +1 -1
  32. package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
  33. package/dist-server/service/bank-account/bank-account-history.js +46 -59
  34. package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
  35. package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
  36. package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
  37. package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
  38. package/dist-server/service/bank-account/bank-account-query.js +2 -0
  39. package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
  40. package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
  41. package/dist-server/service/bank-account/bank-account-service.js +21 -0
  42. package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
  43. package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
  44. package/dist-server/service/bank-account/bank-account-type.js +45 -69
  45. package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
  46. package/dist-server/service/bank-account/bank-account.d.ts +14 -17
  47. package/dist-server/service/bank-account/bank-account.js +45 -57
  48. package/dist-server/service/bank-account/bank-account.js.map +1 -1
  49. package/dist-server/service/bank-account/index.d.ts +1 -1
  50. package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
  51. package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
  52. package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
  53. package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
  54. package/dist-server/service/bank-statement/bank-statement.js +109 -0
  55. package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
  56. package/dist-server/service/bank-statement/index.d.ts +5 -0
  57. package/dist-server/service/bank-statement/index.js +9 -0
  58. package/dist-server/service/bank-statement/index.js.map +1 -0
  59. package/dist-server/service/cash-flow-type.d.ts +5 -0
  60. package/dist-server/service/cash-flow-type.js +15 -0
  61. package/dist-server/service/cash-flow-type.js.map +1 -0
  62. package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
  63. package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
  64. package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
  65. package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
  66. package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
  67. package/dist-server/service/financial-statement/financial-statement-history.js +44 -33
  68. package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
  69. package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
  70. package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
  71. package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
  72. package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
  73. package/dist-server/service/financial-statement/financial-statement-mutation.js +11 -136
  74. package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
  75. package/dist-server/service/financial-statement/financial-statement-query.d.ts +8 -7
  76. package/dist-server/service/financial-statement/financial-statement-query.js +42 -32
  77. package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
  78. package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
  79. package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
  80. package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
  81. package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
  82. package/dist-server/service/financial-statement/financial-statement.js +70 -62
  83. package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
  84. package/dist-server/service/financial-statement/index.d.ts +4 -3
  85. package/dist-server/service/financial-statement/index.js +2 -2
  86. package/dist-server/service/financial-statement/index.js.map +1 -1
  87. package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -6
  88. package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
  89. package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -2
  90. package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
  91. package/dist-server/service/fiscal-month/index.d.ts +1 -1
  92. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -6
  93. package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
  94. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -2
  95. package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
  96. package/dist-server/service/fiscal-quarter/index.d.ts +1 -1
  97. package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -6
  98. package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
  99. package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -2
  100. package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
  101. package/dist-server/service/fiscal-year/index.d.ts +1 -1
  102. package/dist-server/service/index.d.ts +15 -3
  103. package/dist-server/service/index.js +30 -13
  104. package/dist-server/service/index.js.map +1 -1
  105. package/dist-server/service/payment/index.d.ts +2 -1
  106. package/dist-server/service/payment/index.js +1 -0
  107. package/dist-server/service/payment/index.js.map +1 -1
  108. package/dist-server/service/payment/payment-history.d.ts +9 -16
  109. package/dist-server/service/payment/payment-history.js +36 -70
  110. package/dist-server/service/payment/payment-history.js.map +1 -1
  111. package/dist-server/service/payment/payment-mutation.d.ts +0 -1
  112. package/dist-server/service/payment/payment-mutation.js +19 -84
  113. package/dist-server/service/payment/payment-mutation.js.map +1 -1
  114. package/dist-server/service/payment/payment-query.d.ts +3 -0
  115. package/dist-server/service/payment/payment-query.js +32 -3
  116. package/dist-server/service/payment/payment-query.js.map +1 -1
  117. package/dist-server/service/payment/payment-service.d.ts +16 -0
  118. package/dist-server/service/payment/payment-service.js +140 -0
  119. package/dist-server/service/payment/payment-service.js.map +1 -0
  120. package/dist-server/service/payment/payment-targets.d.ts +31 -0
  121. package/dist-server/service/payment/payment-targets.js +19 -0
  122. package/dist-server/service/payment/payment-targets.js.map +1 -0
  123. package/dist-server/service/payment/payment-type.d.ts +13 -17
  124. package/dist-server/service/payment/payment-type.js +35 -51
  125. package/dist-server/service/payment/payment-type.js.map +1 -1
  126. package/dist-server/service/payment/payment.d.ts +23 -22
  127. package/dist-server/service/payment/payment.js +65 -95
  128. package/dist-server/service/payment/payment.js.map +1 -1
  129. package/dist-server/service/payment/transfer-target.d.ts +1 -0
  130. package/dist-server/service/payment/transfer-target.js +43 -0
  131. package/dist-server/service/payment/transfer-target.js.map +1 -0
  132. package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
  133. package/dist-server/service/recurring-cash-item/index.js +10 -0
  134. package/dist-server/service/recurring-cash-item/index.js.map +1 -0
  135. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
  136. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
  137. package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
  138. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
  139. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
  140. package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
  141. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
  142. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
  143. package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
  144. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
  145. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
  146. package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
  147. package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
  148. package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
  149. package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
  150. package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
  151. package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
  152. package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
  153. package/dist-server/service/transaction/index.d.ts +2 -2
  154. package/dist-server/service/transaction/transaction-history.d.ts +42 -15
  155. package/dist-server/service/transaction/transaction-history.js +160 -54
  156. package/dist-server/service/transaction/transaction-history.js.map +1 -1
  157. package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
  158. package/dist-server/service/transaction/transaction-mutation.js +18 -83
  159. package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
  160. package/dist-server/service/transaction/transaction-period.d.ts +16 -0
  161. package/dist-server/service/transaction/transaction-period.js +49 -0
  162. package/dist-server/service/transaction/transaction-period.js.map +1 -0
  163. package/dist-server/service/transaction/transaction-query.d.ts +12 -0
  164. package/dist-server/service/transaction/transaction-query.js +86 -4
  165. package/dist-server/service/transaction/transaction-query.js.map +1 -1
  166. package/dist-server/service/transaction/transaction-service.d.ts +30 -0
  167. package/dist-server/service/transaction/transaction-service.js +130 -0
  168. package/dist-server/service/transaction/transaction-service.js.map +1 -0
  169. package/dist-server/service/transaction/transaction-type.d.ts +39 -7
  170. package/dist-server/service/transaction/transaction-type.js +145 -23
  171. package/dist-server/service/transaction/transaction-type.js.map +1 -1
  172. package/dist-server/service/transaction/transaction.d.ts +58 -31
  173. package/dist-server/service/transaction/transaction.js +213 -111
  174. package/dist-server/service/transaction/transaction.js.map +1 -1
  175. package/dist-server/tsconfig.tsbuildinfo +1 -1
  176. package/package.json +8 -4
  177. package/things-factory.config.js +0 -4
  178. package/translations/en.json +34 -2
  179. package/translations/ja.json +0 -1
  180. package/translations/ko.json +34 -2
  181. package/translations/ms.json +0 -1
  182. package/translations/zh.json +0 -1
  183. package/dist-client/pages/account/account-importer.d.ts +0 -22
  184. package/dist-client/pages/account/account-importer.js +0 -99
  185. package/dist-client/pages/account/account-importer.js.map +0 -1
  186. package/dist-client/pages/account/account-list-page.d.ts +0 -57
  187. package/dist-client/pages/account/account-list-page.js +0 -306
  188. package/dist-client/pages/account/account-list-page.js.map +0 -1
  189. package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
  190. package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
  191. package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
  192. package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
  193. package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
  194. package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
  195. package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
  196. package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
  197. package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
  198. package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
  199. package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
  200. package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
  201. package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
  202. package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
  203. package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
  204. package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
  205. package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
  206. package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
  207. package/dist-client/pages/payment/payment-importer.d.ts +0 -23
  208. package/dist-client/pages/payment/payment-importer.js +0 -92
  209. package/dist-client/pages/payment/payment-importer.js.map +0 -1
  210. package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
  211. package/dist-client/pages/payment/payment-list-page.js +0 -317
  212. package/dist-client/pages/payment/payment-list-page.js.map +0 -1
  213. package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
  214. package/dist-client/pages/transaction/transaction-importer.js +0 -99
  215. package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
  216. package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
  217. package/dist-client/pages/transaction/transaction-list-page.js +0 -280
  218. package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
  219. package/dist-server/controllers/index.d.ts +0 -1
  220. package/dist-server/controllers/index.js +0 -5
  221. package/dist-server/controllers/index.js.map +0 -1
  222. package/dist-server/controllers/summary-statements.d.ts +0 -4
  223. package/dist-server/controllers/summary-statements.js +0 -149
  224. package/dist-server/controllers/summary-statements.js.map +0 -1
  225. package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
  226. package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
  227. package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
  228. package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
  229. package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -94
  230. package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
  231. package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
  232. package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
  233. package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
  234. package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
  235. package/dist-server/service/income-statement/event-subscriber.js +0 -21
  236. package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
  237. package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
  238. package/dist-server/service/income-statement/income-statement-history.js +0 -146
  239. package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
  240. package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
  241. package/dist-server/service/income-statement/income-statement-line-item.js +0 -96
  242. package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
  243. package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
  244. package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
  245. package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
  246. package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
  247. package/dist-server/service/income-statement/income-statement-query.js +0 -81
  248. package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
  249. package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
  250. package/dist-server/service/income-statement/income-statement-type.js +0 -77
  251. package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
  252. package/dist-server/service/income-statement/income-statement.d.ts +0 -28
  253. package/dist-server/service/income-statement/income-statement.js +0 -137
  254. package/dist-server/service/income-statement/income-statement.js.map +0 -1
  255. package/dist-server/service/income-statement/index.d.ts +0 -8
  256. package/dist-server/service/income-statement/index.js +0 -13
  257. package/dist-server/service/income-statement/index.js.map +0 -1
@@ -1,4 +1,3 @@
1
- export * from './controllers';
2
1
  export * from './migrations';
3
2
  export * from './middlewares';
4
3
  export * from './service';
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./controllers"), exports);
5
4
  tslib_1.__exportStar(require("./migrations"), exports);
6
5
  tslib_1.__exportStar(require("./middlewares"), exports);
7
6
  tslib_1.__exportStar(require("./service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,uDAA4B;AAC5B,wDAA6B;AAC7B,oDAAyB;AAEzB,oBAAiB","sourcesContent":["export * from './controllers'\nexport * from './migrations'\nexport * from './middlewares'\nexport * from './service'\n\nimport './routes'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,wDAA6B;AAC7B,oDAAyB;AAEzB,oBAAiB","sourcesContent":["export * from './migrations'\nexport * from './middlewares'\nexport * from './service'\n\nimport './routes'\n"]}
@@ -1,19 +1,26 @@
1
1
  import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
2
2
  import { User } from '@things-factory/auth-base';
3
3
  import { Domain } from '@things-factory/shell';
4
- import { Account } from './account';
5
4
  import { AccountingCategory } from '../accounting-category/accounting-category';
5
+ import { CashFlowType } from '../cash-flow-type';
6
+ import { Account } from './account';
7
+ /** Each version of a account subject, written when it changes. */
6
8
  export declare class AccountHistory implements HistoryEntityInterface<Account> {
7
9
  readonly id: string;
8
10
  version?: number;
9
11
  domain?: Domain;
10
12
  domainId?: string;
11
- code?: string;
12
- name?: string;
13
- description?: string;
14
- active?: boolean;
15
- category?: AccountingCategory;
13
+ code: string;
14
+ name: string;
15
+ description: string;
16
+ type: CashFlowType;
17
+ category: AccountingCategory;
16
18
  categoryId?: string;
19
+ statementLine: string;
20
+ profitAndLoss: boolean;
21
+ forExpense: boolean;
22
+ aliases: string;
23
+ active: boolean;
17
24
  createdAt?: Date;
18
25
  updatedAt?: Date;
19
26
  deletedAt?: Date;
@@ -9,8 +9,10 @@ const auth_base_1 = require("@things-factory/auth-base");
9
9
  const env_1 = require("@things-factory/env");
10
10
  const shell_1 = require("@things-factory/shell");
11
11
  const accounting_category_1 = require("../accounting-category/accounting-category");
12
+ const cash_flow_type_1 = require("../cash-flow-type");
12
13
  const ORMCONFIG = env_1.config.get('ormconfig', {});
13
14
  const DATABASE_TYPE = ORMCONFIG.type;
15
+ /** Each version of a account subject, written when it changes. */
14
16
  let AccountHistory = class AccountHistory {
15
17
  constructor() {
16
18
  this.version = 1;
@@ -19,17 +21,17 @@ let AccountHistory = class AccountHistory {
19
21
  exports.AccountHistory = AccountHistory;
20
22
  tslib_1.__decorate([
21
23
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
22
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
24
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier of the version' }),
23
25
  tslib_1.__metadata("design:type", String)
24
26
  ], AccountHistory.prototype, "id", void 0);
25
27
  tslib_1.__decorate([
26
28
  (0, typeorm_1.Column)({ nullable: true, default: 1 }),
27
- (0, type_graphql_1.Field)({ nullable: true }),
29
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Version number' }),
28
30
  tslib_1.__metadata("design:type", Number)
29
31
  ], AccountHistory.prototype, "version", void 0);
30
32
  tslib_1.__decorate([
31
33
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
32
- (0, type_graphql_1.Field)({ nullable: true }),
34
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
33
35
  tslib_1.__metadata("design:type", shell_1.Domain)
34
36
  ], AccountHistory.prototype, "domain", void 0);
35
37
  tslib_1.__decorate([
@@ -38,27 +40,27 @@ tslib_1.__decorate([
38
40
  ], AccountHistory.prototype, "domainId", void 0);
39
41
  tslib_1.__decorate([
40
42
  (0, typeorm_1.Column)({ nullable: true }),
41
- (0, type_graphql_1.Field)({ nullable: true }),
43
+ (0, type_graphql_1.Field)({ nullable: true, description: 'code at this version' }),
42
44
  tslib_1.__metadata("design:type", String)
43
45
  ], AccountHistory.prototype, "code", void 0);
44
46
  tslib_1.__decorate([
45
47
  (0, typeorm_1.Column)({ nullable: true }),
46
- (0, type_graphql_1.Field)({ nullable: true }),
48
+ (0, type_graphql_1.Field)({ nullable: true, description: 'name at this version' }),
47
49
  tslib_1.__metadata("design:type", String)
48
50
  ], AccountHistory.prototype, "name", void 0);
49
51
  tslib_1.__decorate([
50
- (0, typeorm_1.Column)({ nullable: true }),
51
- (0, type_graphql_1.Field)({ nullable: true }),
52
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
53
+ (0, type_graphql_1.Field)({ nullable: true, description: 'description at this version' }),
52
54
  tslib_1.__metadata("design:type", String)
53
55
  ], AccountHistory.prototype, "description", void 0);
54
56
  tslib_1.__decorate([
55
57
  (0, typeorm_1.Column)({ nullable: true }),
56
- (0, type_graphql_1.Field)({ nullable: true }),
57
- tslib_1.__metadata("design:type", Boolean)
58
- ], AccountHistory.prototype, "active", void 0);
58
+ (0, type_graphql_1.Field)(type => cash_flow_type_1.CashFlowType, { nullable: true, description: 'type at this version' }),
59
+ tslib_1.__metadata("design:type", String)
60
+ ], AccountHistory.prototype, "type", void 0);
59
61
  tslib_1.__decorate([
60
- (0, typeorm_1.ManyToOne)(type => accounting_category_1.AccountingCategory),
61
- (0, type_graphql_1.Field)(type => accounting_category_1.AccountingCategory, { nullable: true }),
62
+ (0, typeorm_1.ManyToOne)(type => accounting_category_1.AccountingCategory, { nullable: true, createForeignKeyConstraints: false }),
63
+ (0, type_graphql_1.Field)(type => accounting_category_1.AccountingCategory, { nullable: true, description: 'category at this version' }),
62
64
  tslib_1.__metadata("design:type", accounting_category_1.AccountingCategory)
63
65
  ], AccountHistory.prototype, "category", void 0);
64
66
  tslib_1.__decorate([
@@ -67,22 +69,47 @@ tslib_1.__decorate([
67
69
  ], AccountHistory.prototype, "categoryId", void 0);
68
70
  tslib_1.__decorate([
69
71
  (0, typeorm_1.Column)({ nullable: true }),
70
- (0, type_graphql_1.Field)({ nullable: true }),
72
+ (0, type_graphql_1.Field)({ nullable: true, description: 'statementLine at this version' }),
73
+ tslib_1.__metadata("design:type", String)
74
+ ], AccountHistory.prototype, "statementLine", void 0);
75
+ tslib_1.__decorate([
76
+ (0, typeorm_1.Column)({ nullable: true }),
77
+ (0, type_graphql_1.Field)({ nullable: true, description: 'profitAndLoss at this version' }),
78
+ tslib_1.__metadata("design:type", Boolean)
79
+ ], AccountHistory.prototype, "profitAndLoss", void 0);
80
+ tslib_1.__decorate([
81
+ (0, typeorm_1.Column)({ nullable: true }),
82
+ (0, type_graphql_1.Field)({ nullable: true, description: 'forExpense at this version' }),
83
+ tslib_1.__metadata("design:type", Boolean)
84
+ ], AccountHistory.prototype, "forExpense", void 0);
85
+ tslib_1.__decorate([
86
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
87
+ (0, type_graphql_1.Field)({ nullable: true, description: 'aliases at this version' }),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], AccountHistory.prototype, "aliases", void 0);
90
+ tslib_1.__decorate([
91
+ (0, typeorm_1.Column)({ nullable: true }),
92
+ (0, type_graphql_1.Field)({ nullable: true, description: 'active at this version' }),
93
+ tslib_1.__metadata("design:type", Boolean)
94
+ ], AccountHistory.prototype, "active", void 0);
95
+ tslib_1.__decorate([
96
+ (0, typeorm_1.Column)({ nullable: true }),
97
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was created' }),
71
98
  tslib_1.__metadata("design:type", Date)
72
99
  ], AccountHistory.prototype, "createdAt", void 0);
73
100
  tslib_1.__decorate([
74
101
  (0, typeorm_1.Column)({ nullable: true }),
75
- (0, type_graphql_1.Field)({ nullable: true }),
102
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When this version was written' }),
76
103
  tslib_1.__metadata("design:type", Date)
77
104
  ], AccountHistory.prototype, "updatedAt", void 0);
78
105
  tslib_1.__decorate([
79
106
  (0, typeorm_1.Column)({ nullable: true }),
80
- (0, type_graphql_1.Field)({ nullable: true }),
107
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it was deleted' }),
81
108
  tslib_1.__metadata("design:type", Date)
82
109
  ], AccountHistory.prototype, "deletedAt", void 0);
83
110
  tslib_1.__decorate([
84
111
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
85
- (0, type_graphql_1.Field)({ nullable: true }),
112
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who created it' }),
86
113
  tslib_1.__metadata("design:type", auth_base_1.User)
87
114
  ], AccountHistory.prototype, "creator", void 0);
88
115
  tslib_1.__decorate([
@@ -91,7 +118,7 @@ tslib_1.__decorate([
91
118
  ], AccountHistory.prototype, "creatorId", void 0);
92
119
  tslib_1.__decorate([
93
120
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
94
- (0, type_graphql_1.Field)({ nullable: true }),
121
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who wrote this version' }),
95
122
  tslib_1.__metadata("design:type", auth_base_1.User)
96
123
  ], AccountHistory.prototype, "updater", void 0);
97
124
  tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"account-history.js","sourceRoot":"","sources":["../../../server/service/account/account-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAG9C,oFAA+E;AAE/E,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAA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qF1B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Account } from './account'\nimport { AccountingCategory } from '../accounting-category/accounting-category'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_account_history_0',\n (accountHistory: AccountHistory) => [accountHistory.originalId, accountHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_account_history_1',\n (accountHistory: AccountHistory) => [accountHistory.domain, accountHistory.originalId, accountHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Account' })\nexport class AccountHistory implements HistoryEntityInterface<Account> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n code?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @ManyToOne(type => AccountingCategory)\n @Field(type => AccountingCategory, { nullable: true })\n category?: AccountingCategory\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.category)\n categoryId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.updater)\n updaterId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
1
+ {"version":3,"file":"account-history.js","sourceRoot":"","sources":["../../../server/service/account/account-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAgD;AAChD,6CAA4C;AAC5C,iDAA2D;AAE3D,oFAA+E;AAC/E,sDAAgD;AAGhD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,kEAAkE;AAa3D,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QAOL,YAAO,GAAY,CAAC,CAAA;IAkGtB,CAAC;CAAA,CAAA;AAzGY,wCAAc;AAGhB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,kC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, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain, moneyColumn } from '@things-factory/shell'\n\nimport { AccountingCategory } from '../accounting-category/accounting-category'\nimport { CashFlowType } from '../cash-flow-type'\nimport { Account } from './account'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n/** Each version of a account subject, written when it changes. */\n@Entity()\n@Index(\n 'ix_account_history_0',\n (accountHistory: AccountHistory) => [accountHistory.originalId, accountHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_account_history_1',\n (accountHistory: AccountHistory) => [accountHistory.domain, accountHistory.originalId, accountHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Account' })\nexport class AccountHistory implements HistoryEntityInterface<Account> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier of the version' })\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true, description: 'Version number' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain' })\n domain?: Domain\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'code at this version' })\n code: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'name at this version' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'description at this version' })\n description: string\n\n @Column({ nullable: true })\n @Field(type => CashFlowType, { nullable: true, description: 'type at this version' })\n type: CashFlowType\n\n @ManyToOne(type => AccountingCategory, { nullable: true, createForeignKeyConstraints: false })\n @Field(type => AccountingCategory, { nullable: true, description: 'category at this version' })\n category: AccountingCategory\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.category)\n categoryId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'statementLine at this version' })\n statementLine: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'profitAndLoss at this version' })\n profitAndLoss: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'forExpense at this version' })\n forExpense: boolean\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'aliases at this version' })\n aliases: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'active at this version' })\n active: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When it was created' })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When this version was written' })\n updatedAt?: Date\n\n @Column({ nullable: true })\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 created it' })\n creator?: User\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who wrote this version' })\n updater?: User\n\n @RelationId((accountHistory: AccountHistory) => accountHistory.updater)\n updaterId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
@@ -70,12 +70,12 @@ let AccountMutation = class AccountMutation {
70
70
  }
71
71
  async deleteAccount(id, context) {
72
72
  const { domain, tx } = context.state;
73
- await (0, shell_1.getRepository)(account_1.Account, tx).delete({ domain: { id: domain.id }, id });
73
+ await (0, shell_1.getRepository)(account_1.Account, tx).softDelete({ domain: { id: domain.id }, id });
74
74
  return true;
75
75
  }
76
76
  async deleteAccounts(ids, context) {
77
77
  const { domain, tx } = context.state;
78
- await (0, shell_1.getRepository)(account_1.Account, tx).delete({
78
+ await (0, shell_1.getRepository)(account_1.Account, tx).softDelete({
79
79
  domain: { id: domain.id },
80
80
  id: (0, typeorm_1.In)(ids)
81
81
  });
@@ -92,7 +92,7 @@ let AccountMutation = class AccountMutation {
92
92
  exports.AccountMutation = AccountMutation;
93
93
  tslib_1.__decorate([
94
94
  (0, type_graphql_1.Directive)('@transaction'),
95
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
95
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
96
96
  (0, type_graphql_1.Mutation)(returns => account_1.Account, { description: 'To create new Account' }),
97
97
  tslib_1.__param(0, (0, type_graphql_1.Arg)('account')),
98
98
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -102,7 +102,7 @@ tslib_1.__decorate([
102
102
  ], AccountMutation.prototype, "createAccount", null);
103
103
  tslib_1.__decorate([
104
104
  (0, type_graphql_1.Directive)('@transaction'),
105
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
105
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
106
106
  (0, type_graphql_1.Mutation)(returns => account_1.Account, { description: 'To modify Account information' }),
107
107
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
108
108
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -113,7 +113,7 @@ tslib_1.__decorate([
113
113
  ], AccountMutation.prototype, "updateAccount", null);
114
114
  tslib_1.__decorate([
115
115
  (0, type_graphql_1.Directive)('@transaction'),
116
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
116
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
117
117
  (0, type_graphql_1.Mutation)(returns => [account_1.Account], { description: "To modify multiple Accounts' information" }),
118
118
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [account_type_1.AccountPatch])),
119
119
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -123,7 +123,7 @@ tslib_1.__decorate([
123
123
  ], AccountMutation.prototype, "updateMultipleAccount", null);
124
124
  tslib_1.__decorate([
125
125
  (0, type_graphql_1.Directive)('@transaction'),
126
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
126
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
127
127
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Account' }),
128
128
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
129
129
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -133,7 +133,7 @@ tslib_1.__decorate([
133
133
  ], AccountMutation.prototype, "deleteAccount", null);
134
134
  tslib_1.__decorate([
135
135
  (0, type_graphql_1.Directive)('@transaction'),
136
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
136
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
137
137
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Accounts' }),
138
138
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
139
139
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -143,7 +143,7 @@ tslib_1.__decorate([
143
143
  ], AccountMutation.prototype, "deleteAccounts", null);
144
144
  tslib_1.__decorate([
145
145
  (0, type_graphql_1.Directive)('@transaction'),
146
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
146
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
147
147
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Accounts' }),
148
148
  tslib_1.__param(0, (0, type_graphql_1.Arg)('accounts', type => [account_type_1.AccountPatch])),
149
149
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"account-mutation.js","sourceRoot":"","sources":["../../../server/service/account/account-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,uCAAmC;AACnC,iDAAyD;AAGlD,IAAM,eAAe,GAArB,MAAM,eAAe;IAIpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,iBAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YACnD,GAAG,OAAO;YACV,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,aAAa,CACN,EAAU,EACP,KAAmB,EAC1B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,iBAAO,EAAE,EAAE,CAAC,CAAA;QAC7C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,MA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,6BAA6B,EAAE,CAAC;IAE1E,mBAAA,IAAA,kBAAG,EAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,2BAAY,CAAC,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAWP;0BAvIU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,eAAe,CAwI3B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { Account } from './account'\nimport { NewAccount, AccountPatch } from './account-type'\n\n@Resolver(Account)\nexport class AccountMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Account, { description: 'To create new Account' })\n async createAccount(@Arg('account') account: NewAccount, @Ctx() context: ResolverContext): Promise<Account> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(Account, tx).save({\n ...account,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Account, { description: 'To modify Account information' })\n async updateAccount(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountPatch,\n @Ctx() context: ResolverContext\n ): Promise<Account> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Account, tx)\n const account = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...account,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => [Account], { description: \"To modify multiple Accounts' information\" })\n async updateMultipleAccount(\n @Arg('patches', type => [AccountPatch]) patches: AccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Account[]> {\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 accountRepo = getRepository(Account, 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 accountRepo.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 account = await accountRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!account) {\n throw new Error(`failed to find account to update: ${updateRecord.id}`)\n }\n\n const result = await accountRepo.save({\n ...account,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete Account' })\n async deleteAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Account, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete multiple Accounts' })\n async deleteAccounts(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Account, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To import multiple Accounts' })\n async importAccounts(\n @Arg('accounts', type => [AccountPatch]) accounts: AccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accounts.map(async (account: AccountPatch) => {\n const createdAccount: Account = await getRepository(Account, tx).save({ domain, ...account })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"account-mutation.js","sourceRoot":"","sources":["../../../server/service/account/account-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,uCAAmC;AACnC,iDAAyD;AAGlD,IAAM,eAAe,GAArB,MAAM,eAAe;IAIpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,iBAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YACnD,GAAG,OAAO;YACV,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,aAAa,CACN,EAAU,EACP,KAAmB,EAC1B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,iBAAO,EAAE,EAAE,CAAC,CAAA;QAC7C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACvC,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,CAAC;YACnC,GAAG,OAAO;YACV,GAAG,KAAK;YACR,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,qBAAqB,CACe,OAAuB,EACxD,OAAwB;QAE/B,MAAM,EAAE,M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eAAe,CAwI3B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { Account } from './account'\nimport { NewAccount, AccountPatch } from './account-type'\n\n@Resolver(Account)\nexport class AccountMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Account, { description: 'To create new Account' })\n async createAccount(@Arg('account') account: NewAccount, @Ctx() context: ResolverContext): Promise<Account> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(Account, tx).save({\n ...account,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Account, { description: 'To modify Account information' })\n async updateAccount(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountPatch,\n @Ctx() context: ResolverContext\n ): Promise<Account> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Account, tx)\n const account = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...account,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Account], { description: \"To modify multiple Accounts' information\" })\n async updateMultipleAccount(\n @Arg('patches', type => [AccountPatch]) patches: AccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Account[]> {\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 accountRepo = getRepository(Account, 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 accountRepo.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 account = await accountRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!account) {\n throw new Error(`failed to find account to update: ${updateRecord.id}`)\n }\n\n const result = await accountRepo.save({\n ...account,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Account' })\n async deleteAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Account, tx).softDelete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Accounts' })\n async deleteAccounts(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Account, tx).softDelete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Accounts' })\n async importAccounts(\n @Arg('accounts', type => [AccountPatch]) accounts: AccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accounts.map(async (account: AccountPatch) => {\n const createdAccount: Account = await getRepository(Account, tx).save({ domain, ...account })\n })\n )\n\n return true\n }\n}\n"]}
@@ -37,7 +37,7 @@ let AccountQuery = class AccountQuery {
37
37
  };
38
38
  exports.AccountQuery = AccountQuery;
39
39
  tslib_1.__decorate([
40
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
40
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
41
41
  (0, type_graphql_1.Query)(returns => account_1.Account, { nullable: true, description: 'To fetch a Account' }),
42
42
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
43
43
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -46,7 +46,7 @@ tslib_1.__decorate([
46
46
  tslib_1.__metadata("design:returntype", Promise)
47
47
  ], AccountQuery.prototype, "account", null);
48
48
  tslib_1.__decorate([
49
- (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
49
+ (0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
50
50
  (0, type_graphql_1.Query)(returns => account_type_1.AccountList, { description: 'To fetch multiple Accounts' }),
51
51
  tslib_1.__param(0, (0, type_graphql_1.Args)()),
52
52
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -1 +1 @@
1
- {"version":3,"file":"account-query.js","sourceRoot":"","sources":["../../../server/service/account/account-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAE9F,iDAAuG;AACvG,yDAAgD;AAChD,uCAAmC;AACnC,iDAA4C;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAGjB,AAAN,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAwB;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,QAAQ,CAAS,MAAiB,EAAS,OAAwB;QACvE,MAAM,EAAE,MAAM,EAA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C,wDAAwD,CAAC;IACnE,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,0BAAW,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IAC7D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;4CAavC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;0CAEpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;2CAErC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;2CAErC;uBAzCU,YAAY;IADxB,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,YAAY,CA0CxB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from './account'\nimport { AccountList } from './account-type'\n\n@Resolver(Account)\nexport class AccountQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => Account!, { nullable: true, description: 'To fetch a Account' })\n async account(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Account> {\n const { domain } = context.state\n\n return await getRepository(Account).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => AccountList, { description: 'To fetch multiple Accounts' })\n async accounts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<AccountList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Account),\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() account: Account): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: account.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() account: Account): Promise<User> {\n return await getRepository(User).findOneBy({ id: account.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() account: Account): Promise<User> {\n return await getRepository(User).findOneBy({ id: account.creatorId })\n }\n}\n"]}
1
+ {"version":3,"file":"account-query.js","sourceRoot":"","sources":["../../../server/service/account/account-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAE9F,iDAAuG;AACvG,yDAAgD;AAChD,uCAAmC;AACnC,iDAA4C;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAGjB,AAAN,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAwB;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,QAAQ,CAAS,MAAiB,EAAS,OAAwB;QACvE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC;YACxC,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC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AC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;0CAEpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;2CAErC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAU,iBAAO;;2CAErC;uBAzCU,YAAY;IADxB,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,YAAY,CA0CxB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from './account'\nimport { AccountList } from './account-type'\n\n@Resolver(Account)\nexport class AccountQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Account!, { nullable: true, description: 'To fetch a Account' })\n async account(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Account> {\n const { domain } = context.state\n\n return await getRepository(Account).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => AccountList, { description: 'To fetch multiple Accounts' })\n async accounts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<AccountList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Account),\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() account: Account): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: account.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() account: Account): Promise<User> {\n return await getRepository(User).findOneBy({ id: account.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() account: Account): Promise<User> {\n return await getRepository(User).findOneBy({ id: account.creatorId })\n }\n}\n"]}
@@ -1,13 +1,29 @@
1
+ import { ObjectRef } from '@things-factory/shell';
2
+ import { CashFlowType } from '../cash-flow-type';
1
3
  import { Account } from './account';
2
4
  export declare class NewAccount {
5
+ code: string;
3
6
  name: string;
4
7
  description?: string;
8
+ type: CashFlowType;
9
+ category?: ObjectRef;
10
+ statementLine?: string;
11
+ profitAndLoss?: boolean;
12
+ forExpense?: boolean;
13
+ aliases?: string;
5
14
  active?: boolean;
6
15
  }
7
16
  export declare class AccountPatch {
8
17
  id?: string;
18
+ code?: string;
9
19
  name?: string;
10
20
  description?: string;
21
+ type?: CashFlowType;
22
+ category?: ObjectRef;
23
+ statementLine?: string;
24
+ profitAndLoss?: boolean;
25
+ forExpense?: boolean;
26
+ aliases?: string;
11
27
  active?: boolean;
12
28
  cuFlag?: string;
13
29
  }
@@ -3,63 +3,121 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AccountList = exports.AccountPatch = exports.NewAccount = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const cash_flow_type_1 = require("../cash-flow-type");
6
8
  const account_1 = require("./account");
7
9
  let NewAccount = class NewAccount {
8
10
  };
9
11
  exports.NewAccount = NewAccount;
10
12
  tslib_1.__decorate([
11
- (0, type_graphql_1.Field)(),
13
+ (0, type_graphql_1.Field)({ description: 'Account code, unique in the domain' }),
14
+ tslib_1.__metadata("design:type", String)
15
+ ], NewAccount.prototype, "code", void 0);
16
+ tslib_1.__decorate([
17
+ (0, type_graphql_1.Field)({ description: 'Account name, unique in the domain' }),
12
18
  tslib_1.__metadata("design:type", String)
13
19
  ], NewAccount.prototype, "name", void 0);
14
20
  tslib_1.__decorate([
15
- (0, type_graphql_1.Field)({ nullable: true }),
21
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Description' }),
16
22
  tslib_1.__metadata("design:type", String)
17
23
  ], NewAccount.prototype, "description", void 0);
18
24
  tslib_1.__decorate([
19
- (0, type_graphql_1.Field)({ nullable: true }),
25
+ (0, type_graphql_1.Field)(type => cash_flow_type_1.CashFlowType, { description: 'Whether money booked to it comes in or goes out' }),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], NewAccount.prototype, "type", void 0);
28
+ tslib_1.__decorate([
29
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The group it belongs to' }),
30
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
31
+ ], NewAccount.prototype, "category", void 0);
32
+ tslib_1.__decorate([
33
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The line code of the filed financial statements' }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], NewAccount.prototype, "statementLine", void 0);
36
+ tslib_1.__decorate([
37
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it counts in profit and loss' }),
38
+ tslib_1.__metadata("design:type", Boolean)
39
+ ], NewAccount.prototype, "profitAndLoss", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it is offered for expense claims' }),
42
+ tslib_1.__metadata("design:type", Boolean)
43
+ ], NewAccount.prototype, "forExpense", void 0);
44
+ tslib_1.__decorate([
45
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Other names it appears under in old ledgers' }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], NewAccount.prototype, "aliases", void 0);
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it is offered for new rows' }),
20
50
  tslib_1.__metadata("design:type", Boolean)
21
51
  ], NewAccount.prototype, "active", void 0);
22
52
  exports.NewAccount = NewAccount = tslib_1.__decorate([
23
- (0, type_graphql_1.InputType)()
53
+ (0, type_graphql_1.InputType)({ description: 'A new account subject' })
24
54
  ], NewAccount);
25
55
  let AccountPatch = class AccountPatch {
26
56
  };
27
57
  exports.AccountPatch = AccountPatch;
28
58
  tslib_1.__decorate([
29
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
59
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The account to change' }),
30
60
  tslib_1.__metadata("design:type", String)
31
61
  ], AccountPatch.prototype, "id", void 0);
32
62
  tslib_1.__decorate([
33
- (0, type_graphql_1.Field)({ nullable: true }),
63
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Account code, unique in the domain' }),
64
+ tslib_1.__metadata("design:type", String)
65
+ ], AccountPatch.prototype, "code", void 0);
66
+ tslib_1.__decorate([
67
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Account name, unique in the domain' }),
34
68
  tslib_1.__metadata("design:type", String)
35
69
  ], AccountPatch.prototype, "name", void 0);
36
70
  tslib_1.__decorate([
37
- (0, type_graphql_1.Field)({ nullable: true }),
71
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Description' }),
38
72
  tslib_1.__metadata("design:type", String)
39
73
  ], AccountPatch.prototype, "description", void 0);
40
74
  tslib_1.__decorate([
41
- (0, type_graphql_1.Field)({ nullable: true }),
75
+ (0, type_graphql_1.Field)(type => cash_flow_type_1.CashFlowType, { nullable: true, description: 'Whether money booked to it comes in or goes out' }),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], AccountPatch.prototype, "type", void 0);
78
+ tslib_1.__decorate([
79
+ (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The group it belongs to' }),
80
+ tslib_1.__metadata("design:type", shell_1.ObjectRef)
81
+ ], AccountPatch.prototype, "category", void 0);
82
+ tslib_1.__decorate([
83
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The line code of the filed financial statements' }),
84
+ tslib_1.__metadata("design:type", String)
85
+ ], AccountPatch.prototype, "statementLine", void 0);
86
+ tslib_1.__decorate([
87
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it counts in profit and loss' }),
88
+ tslib_1.__metadata("design:type", Boolean)
89
+ ], AccountPatch.prototype, "profitAndLoss", void 0);
90
+ tslib_1.__decorate([
91
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it is offered for expense claims' }),
92
+ tslib_1.__metadata("design:type", Boolean)
93
+ ], AccountPatch.prototype, "forExpense", void 0);
94
+ tslib_1.__decorate([
95
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Other names it appears under in old ledgers' }),
96
+ tslib_1.__metadata("design:type", String)
97
+ ], AccountPatch.prototype, "aliases", void 0);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether it is offered for new rows' }),
42
100
  tslib_1.__metadata("design:type", Boolean)
43
101
  ], AccountPatch.prototype, "active", void 0);
44
102
  tslib_1.__decorate([
45
- (0, type_graphql_1.Field)({ nullable: true }),
103
+ (0, type_graphql_1.Field)({ nullable: true, description: '+ adds, M changes' }),
46
104
  tslib_1.__metadata("design:type", String)
47
105
  ], AccountPatch.prototype, "cuFlag", void 0);
48
106
  exports.AccountPatch = AccountPatch = tslib_1.__decorate([
49
- (0, type_graphql_1.InputType)()
107
+ (0, type_graphql_1.InputType)({ description: 'A change to an account subject, or a grid row: cuFlag + adds, M changes' })
50
108
  ], AccountPatch);
51
109
  let AccountList = class AccountList {
52
110
  };
53
111
  exports.AccountList = AccountList;
54
112
  tslib_1.__decorate([
55
- (0, type_graphql_1.Field)(type => [account_1.Account]),
113
+ (0, type_graphql_1.Field)(type => [account_1.Account], { description: 'The accounts on this page' }),
56
114
  tslib_1.__metadata("design:type", Array)
57
115
  ], AccountList.prototype, "items", void 0);
58
116
  tslib_1.__decorate([
59
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
117
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many there are in all' }),
60
118
  tslib_1.__metadata("design:type", Number)
61
119
  ], AccountList.prototype, "total", void 0);
62
120
  exports.AccountList = AccountList = tslib_1.__decorate([
63
- (0, type_graphql_1.ObjectType)()
121
+ (0, type_graphql_1.ObjectType)({ description: 'A page of account subjects' })
64
122
  ], AccountList);
65
123
  //# sourceMappingURL=account-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-type.js","sourceRoot":"","sources":["../../../server/service/account/account-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AAItF,uCAAmC;AAG5B,IAAM,UAAU,GAAhB,MAAM,UAAU;CAStB,CAAA;AATY,gCAAU;AAErB;IADC,IAAA,oBAAK,GAAE;;wCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;qBARL,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAStB;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAexB,CAAA;AAfY,oCAAY;AAEvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACX;uBAdJ,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAexB;AAGM,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,CAAC;;0CACT;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;0CACN;sBALF,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Account } from './account'\n\n@InputType()\nexport class NewAccount {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class AccountPatch {\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 })\n active?: boolean\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AccountList {\n @Field(type => [Account])\n items: Account[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"account-type.js","sourceRoot":"","sources":["../../../server/service/account/account-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAiD;AAEjD,sDAAgD;AAChD,uCAAmC;AAG5B,IAAM,UAAU,GAAhB,MAAM,UAAU;CA8BtB,CAAA;AA9BY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;wCACjD;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;wCACjD;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;;+CAClC;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,6BAAY,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;wCAC9E;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAA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C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;0CACpD;sBALF,WAAW;IADvB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;GAC7C,WAAW,CAMvB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { CashFlowType } from '../cash-flow-type'\nimport { Account } from './account'\n\n@InputType({ description: 'A new account subject' })\nexport class NewAccount {\n @Field({ description: 'Account code, unique in the domain' })\n code: string\n\n @Field({ description: 'Account name, unique in the domain' })\n name: string\n\n @Field({ nullable: true, description: 'Description' })\n description?: string\n\n @Field(type => CashFlowType, { description: 'Whether money booked to it comes in or goes out' })\n type: CashFlowType\n\n @Field(type => ObjectRef, { nullable: true, description: 'The group it belongs to' })\n category?: ObjectRef\n\n @Field({ nullable: true, description: 'The line code of the filed financial statements' })\n statementLine?: string\n\n @Field({ nullable: true, description: 'Whether it counts in profit and loss' })\n profitAndLoss?: boolean\n\n @Field({ nullable: true, description: 'Whether it is offered for expense claims' })\n forExpense?: boolean\n\n @Field({ nullable: true, description: 'Other names it appears under in old ledgers' })\n aliases?: string\n\n @Field({ nullable: true, description: 'Whether it is offered for new rows' })\n active?: boolean\n}\n\n@InputType({ description: 'A change to an account subject, or a grid row: cuFlag + adds, M changes' })\nexport class AccountPatch {\n @Field(type => ID, { nullable: true, description: 'The account to change' })\n id?: string\n\n @Field({ nullable: true, description: 'Account code, unique in the domain' })\n code?: string\n\n @Field({ nullable: true, description: 'Account name, unique in the domain' })\n name?: string\n\n @Field({ nullable: true, description: 'Description' })\n description?: string\n\n @Field(type => CashFlowType, { nullable: true, description: 'Whether money booked to it comes in or goes out' })\n type?: CashFlowType\n\n @Field(type => ObjectRef, { nullable: true, description: 'The group it belongs to' })\n category?: ObjectRef\n\n @Field({ nullable: true, description: 'The line code of the filed financial statements' })\n statementLine?: string\n\n @Field({ nullable: true, description: 'Whether it counts in profit and loss' })\n profitAndLoss?: boolean\n\n @Field({ nullable: true, description: 'Whether it is offered for expense claims' })\n forExpense?: boolean\n\n @Field({ nullable: true, description: 'Other names it appears under in old ledgers' })\n aliases?: string\n\n @Field({ nullable: true, description: 'Whether it is offered for new rows' })\n active?: boolean\n\n @Field({ nullable: true, description: '+ adds, M changes' })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A page of account subjects' })\nexport class AccountList {\n @Field(type => [Account], { description: 'The accounts on this page' })\n items: Account[]\n\n @Field(type => Int, { description: 'How many there are in all' })\n total: number\n}\n"]}
@@ -1,15 +1,21 @@
1
1
  import { Domain } from '@things-factory/shell';
2
2
  import { User } from '@things-factory/auth-base';
3
3
  import { AccountingCategory } from '../accounting-category/accounting-category';
4
+ import { CashFlowType } from '../cash-flow-type';
4
5
  export declare class Account {
5
6
  readonly id: string;
6
7
  version?: number;
7
8
  domain?: Domain;
8
9
  domainId?: string;
9
- code?: string;
10
- name?: string;
10
+ code: string;
11
+ name: string;
11
12
  description?: string;
12
- active?: boolean;
13
+ type: CashFlowType;
14
+ statementLine?: string;
15
+ profitAndLoss: boolean;
16
+ forExpense: boolean;
17
+ aliases?: string;
18
+ active: boolean;
13
19
  category?: AccountingCategory;
14
20
  categoryId?: string;
15
21
  createdAt?: Date;