@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.
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -12
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +0 -1
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/account/account-history.d.ts +13 -6
- package/dist-server/service/account/account-history.js +44 -17
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +2 -2
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-type.d.ts +16 -0
- package/dist-server/service/account/account-type.js +71 -13
- package/dist-server/service/account/account-type.js.map +1 -1
- package/dist-server/service/account/account.d.ts +9 -3
- package/dist-server/service/account/account.js +34 -8
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-mutation.js +2 -2
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
- package/dist-server/service/bank-account/bank-account-history.js +46 -59
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
- package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-query.js +2 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
- package/dist-server/service/bank-account/bank-account-service.js +21 -0
- package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
- package/dist-server/service/bank-account/bank-account-type.js +45 -69
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
- package/dist-server/service/bank-account/bank-account.d.ts +14 -17
- package/dist-server/service/bank-account/bank-account.js +45 -57
- package/dist-server/service/bank-account/bank-account.js.map +1 -1
- package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
- package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
- package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
- package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
- package/dist-server/service/bank-statement/bank-statement.js +109 -0
- package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
- package/dist-server/service/bank-statement/index.d.ts +5 -0
- package/dist-server/service/bank-statement/index.js +9 -0
- package/dist-server/service/bank-statement/index.js.map +1 -0
- package/dist-server/service/cash-flow-type.d.ts +5 -0
- package/dist-server/service/cash-flow-type.js +15 -0
- package/dist-server/service/cash-flow-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
- package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
- package/dist-server/service/financial-institution/index.d.ts +1 -1
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
- package/dist-server/service/financial-statement/financial-statement-history.js +47 -36
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
- package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
- package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js +10 -135
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.d.ts +8 -7
- package/dist-server/service/financial-statement/financial-statement-query.js +40 -30
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
- package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
- package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
- package/dist-server/service/financial-statement/financial-statement.js +73 -65
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +3 -2
- package/dist-server/service/financial-statement/index.js +2 -2
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +15 -3
- package/dist-server/service/index.js +30 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -0
- package/dist-server/service/payment/index.js +1 -0
- package/dist-server/service/payment/index.js.map +1 -1
- package/dist-server/service/payment/payment-history.d.ts +9 -16
- package/dist-server/service/payment/payment-history.js +36 -70
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-mutation.d.ts +0 -1
- package/dist-server/service/payment/payment-mutation.js +14 -79
- package/dist-server/service/payment/payment-mutation.js.map +1 -1
- package/dist-server/service/payment/payment-query.d.ts +3 -0
- package/dist-server/service/payment/payment-query.js +30 -1
- package/dist-server/service/payment/payment-query.js.map +1 -1
- package/dist-server/service/payment/payment-service.d.ts +16 -0
- package/dist-server/service/payment/payment-service.js +140 -0
- package/dist-server/service/payment/payment-service.js.map +1 -0
- package/dist-server/service/payment/payment-targets.d.ts +31 -0
- package/dist-server/service/payment/payment-targets.js +19 -0
- package/dist-server/service/payment/payment-targets.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +13 -17
- package/dist-server/service/payment/payment-type.js +35 -51
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +23 -22
- package/dist-server/service/payment/payment.js +66 -94
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/service/payment/transfer-target.d.ts +1 -0
- package/dist-server/service/payment/transfer-target.js +43 -0
- package/dist-server/service/payment/transfer-target.js.map +1 -0
- package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
- package/dist-server/service/recurring-cash-item/index.js +10 -0
- package/dist-server/service/recurring-cash-item/index.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.d.ts +42 -15
- package/dist-server/service/transaction/transaction-history.js +160 -54
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -78
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-period.d.ts +16 -0
- package/dist-server/service/transaction/transaction-period.js +49 -0
- package/dist-server/service/transaction/transaction-period.js.map +1 -0
- package/dist-server/service/transaction/transaction-query.d.ts +12 -0
- package/dist-server/service/transaction/transaction-query.js +84 -2
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction-service.d.ts +30 -0
- package/dist-server/service/transaction/transaction-service.js +130 -0
- package/dist-server/service/transaction/transaction-service.js.map +1 -0
- package/dist-server/service/transaction/transaction-type.d.ts +39 -7
- package/dist-server/service/transaction/transaction-type.js +145 -23
- package/dist-server/service/transaction/transaction-type.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +58 -31
- package/dist-server/service/transaction/transaction.js +216 -102
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/things-factory.config.js +0 -4
- package/translations/en.json +34 -2
- package/translations/ja.json +0 -1
- package/translations/ko.json +34 -2
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
- package/dist-client/pages/account/account-importer.d.ts +0 -22
- package/dist-client/pages/account/account-importer.js +0 -99
- package/dist-client/pages/account/account-importer.js.map +0 -1
- package/dist-client/pages/account/account-list-page.d.ts +0 -57
- package/dist-client/pages/account/account-list-page.js +0 -306
- package/dist-client/pages/account/account-list-page.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
- package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
- package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
- package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
- package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
- package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
- package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
- package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
- package/dist-client/pages/payment/payment-importer.d.ts +0 -23
- package/dist-client/pages/payment/payment-importer.js +0 -92
- package/dist-client/pages/payment/payment-importer.js.map +0 -1
- package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
- package/dist-client/pages/payment/payment-list-page.js +0 -317
- package/dist-client/pages/payment/payment-list-page.js.map +0 -1
- package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
- package/dist-client/pages/transaction/transaction-importer.js +0 -99
- package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
- package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
- package/dist-client/pages/transaction/transaction-list-page.js +0 -280
- package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
- package/dist-server/controllers/index.d.ts +0 -1
- package/dist-server/controllers/index.js +0 -5
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/controllers/summary-statements.d.ts +0 -4
- package/dist-server/controllers/summary-statements.js +0 -149
- package/dist-server/controllers/summary-statements.js.map +0 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
- package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
- package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -95
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
- package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
- package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
- package/dist-server/service/income-statement/event-subscriber.js +0 -21
- package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement-history.js +0 -146
- package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
- package/dist-server/service/income-statement/income-statement-line-item.js +0 -97
- package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
- package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
- package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
- package/dist-server/service/income-statement/income-statement-query.js +0 -81
- package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
- package/dist-server/service/income-statement/income-statement-type.js +0 -77
- package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/income-statement.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement.js +0 -137
- package/dist-server/service/income-statement/income-statement.js.map +0 -1
- package/dist-server/service/income-statement/index.d.ts +0 -8
- package/dist-server/service/income-statement/index.js +0 -13
- package/dist-server/service/income-statement/index.js.map +0 -1
|
@@ -125,7 +125,10 @@ let FinancialInstitutionMutation = class FinancialInstitutionMutation {
|
|
|
125
125
|
async importFinancialInstitutions(financialInstitutions, context) {
|
|
126
126
|
const { domain, tx } = context.state;
|
|
127
127
|
await Promise.all(financialInstitutions.map(async (financialInstitution) => {
|
|
128
|
-
const createdFinancialInstitution = await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution, tx).save({
|
|
128
|
+
const createdFinancialInstitution = await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution, tx).save({
|
|
129
|
+
domain,
|
|
130
|
+
...financialInstitution
|
|
131
|
+
});
|
|
129
132
|
}));
|
|
130
133
|
return true;
|
|
131
134
|
}
|
|
@@ -133,6 +136,7 @@ let FinancialInstitutionMutation = class FinancialInstitutionMutation {
|
|
|
133
136
|
exports.FinancialInstitutionMutation = FinancialInstitutionMutation;
|
|
134
137
|
tslib_1.__decorate([
|
|
135
138
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
139
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
136
140
|
(0, type_graphql_1.Mutation)(returns => financial_institution_1.FinancialInstitution, { description: 'To create new FinancialInstitution' }),
|
|
137
141
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('financialInstitution')),
|
|
138
142
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -142,6 +146,7 @@ tslib_1.__decorate([
|
|
|
142
146
|
], FinancialInstitutionMutation.prototype, "createFinancialInstitution", null);
|
|
143
147
|
tslib_1.__decorate([
|
|
144
148
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
149
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
145
150
|
(0, type_graphql_1.Mutation)(returns => financial_institution_1.FinancialInstitution, { description: 'To modify FinancialInstitution information' }),
|
|
146
151
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
147
152
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -152,6 +157,7 @@ tslib_1.__decorate([
|
|
|
152
157
|
], FinancialInstitutionMutation.prototype, "updateFinancialInstitution", null);
|
|
153
158
|
tslib_1.__decorate([
|
|
154
159
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
160
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
155
161
|
(0, type_graphql_1.Mutation)(returns => [financial_institution_1.FinancialInstitution], { description: "To modify multiple FinancialInstitutions' information" }),
|
|
156
162
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [financial_institution_type_1.FinancialInstitutionPatch])),
|
|
157
163
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -161,6 +167,7 @@ tslib_1.__decorate([
|
|
|
161
167
|
], FinancialInstitutionMutation.prototype, "updateMultipleFinancialInstitution", null);
|
|
162
168
|
tslib_1.__decorate([
|
|
163
169
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
170
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
164
171
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete FinancialInstitution' }),
|
|
165
172
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
166
173
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -170,6 +177,7 @@ tslib_1.__decorate([
|
|
|
170
177
|
], FinancialInstitutionMutation.prototype, "deleteFinancialInstitution", null);
|
|
171
178
|
tslib_1.__decorate([
|
|
172
179
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
180
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
173
181
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple FinancialInstitutions' }),
|
|
174
182
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
175
183
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -179,6 +187,7 @@ tslib_1.__decorate([
|
|
|
179
187
|
], FinancialInstitutionMutation.prototype, "deleteFinancialInstitutions", null);
|
|
180
188
|
tslib_1.__decorate([
|
|
181
189
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
190
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
182
191
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple FinancialInstitutions' }),
|
|
183
192
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('financialInstitutions', type => [financial_institution_type_1.FinancialInstitutionPatch])),
|
|
184
193
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-institution-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,qEAA0F;AAC1F,mEAA8D;AAC9D,6EAAiG;AAG1F,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAGjC,AAAN,KAAK,CAAC,0BAA0B,CAA8B,oBAA6C,EAAS,OAAwB;QAC1I,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,4CAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YAChE,GAAG,oBAAoB;YACvB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,IAAI,oBAAoB,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,kCAAgB,EACpB,IAAI,EACJ;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,oBAAoB,CAAC,SAAS;oBACpC,OAAO,EAAE,4CAAoB,CAAC,IAAI;oBAClC,KAAK,EAAE,MAAM,CAAC,EAAE;iBACjB;aACF,EACD,OAAO,CACR,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,C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AE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+EAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAEvF,mBAAA,IAAA,kBAAG,EAAC,uBAAuB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sDAAyB,CAAC,CAAC,CAAA;IACjE,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+EAWP;uCAjMU,4BAA4B;IADxC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,4BAA4B,CAkMxC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { NewFinancialInstitution, FinancialInstitutionPatch } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionMutation {\n @Directive('@transaction')\n @Mutation(returns => FinancialInstitution, { description: 'To create new FinancialInstitution' })\n async createFinancialInstitution(@Arg('financialInstitution') financialInstitution: NewFinancialInstitution, @Ctx() context: ResolverContext): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FinancialInstitution, tx).save({\n ...financialInstitution,\n domain,\n creator: user,\n updater: user\n })\n\n if (financialInstitution.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: financialInstitution.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => FinancialInstitution, { description: 'To modify FinancialInstitution information' })\n async updateFinancialInstitution(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialInstitutionPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FinancialInstitution, tx)\n const financialInstitution = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialInstitution,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [FinancialInstitution], { description: \"To modify multiple FinancialInstitutions' information\" })\n async updateMultipleFinancialInstitution(\n @Arg('patches', type => [FinancialInstitutionPatch]) patches: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution[]> {\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 financialInstitutionRepo = getRepository(FinancialInstitution, 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 financialInstitutionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 financialInstitution = await financialInstitutionRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!financialInstitution) {\n throw new Error(`failed to find financialInstitution to update: ${updateRecord.id}`)\n }\n\n const result = await financialInstitutionRepo.save({\n ...financialInstitution,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete FinancialInstitution' })\n async deleteFinancialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple FinancialInstitutions' })\n async deleteFinancialInstitutions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple FinancialInstitutions' })\n async importFinancialInstitutions(\n @Arg('financialInstitutions', type => [FinancialInstitutionPatch]) financialInstitutions: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialInstitutions.map(async (financialInstitution: FinancialInstitutionPatch) => {\n const createdFinancialInstitution: FinancialInstitution = await getRepository(FinancialInstitution, tx).save({ domain, ...financialInstitution })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"financial-institution-mutation.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD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;IAEvF,mBAAA,IAAA,kBAAG,EAAC,uBAAuB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sDAAyB,CAAC,CAAC,CAAA;IAEjE,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+EAcP;uCA9MU,4BAA4B;IADxC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,4BAA4B,CA+MxC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { NewFinancialInstitution, FinancialInstitutionPatch } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => FinancialInstitution, { description: 'To create new FinancialInstitution' })\n async createFinancialInstitution(\n @Arg('financialInstitution') financialInstitution: NewFinancialInstitution,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(FinancialInstitution, tx).save({\n ...financialInstitution,\n domain,\n creator: user,\n updater: user\n })\n\n if (financialInstitution.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: financialInstitution.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => FinancialInstitution, { description: 'To modify FinancialInstitution information' })\n async updateFinancialInstitution(\n @Arg('id') id: string,\n @Arg('patch') patch: FinancialInstitutionPatch,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(FinancialInstitution, tx)\n const financialInstitution = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...financialInstitution,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [FinancialInstitution], { description: \"To modify multiple FinancialInstitutions' information\" })\n async updateMultipleFinancialInstitution(\n @Arg('patches', type => [FinancialInstitutionPatch]) patches: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitution[]> {\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 financialInstitutionRepo = getRepository(FinancialInstitution, 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 financialInstitutionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 financialInstitution = await financialInstitutionRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!financialInstitution) {\n throw new Error(`failed to find financialInstitution to update: ${updateRecord.id}`)\n }\n\n const result = await financialInstitutionRepo.save({\n ...financialInstitution,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: FinancialInstitution.name,\n refBy: result.id\n }\n },\n context\n )\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 FinancialInstitution' })\n async deleteFinancialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\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 FinancialInstitutions' })\n async deleteFinancialInstitutions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(FinancialInstitution, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple FinancialInstitutions' })\n async importFinancialInstitutions(\n @Arg('financialInstitutions', type => [FinancialInstitutionPatch])\n financialInstitutions: FinancialInstitutionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n financialInstitutions.map(async (financialInstitution: FinancialInstitutionPatch) => {\n const createdFinancialInstitution: FinancialInstitution = await getRepository(FinancialInstitution, tx).save({\n domain,\n ...financialInstitution\n })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FinancialInstitutionQuery = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
6
7
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
8
|
const shell_1 = require("@things-factory/shell");
|
|
8
9
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
@@ -11,18 +12,23 @@ const financial_institution_type_1 = require("./financial-institution-type");
|
|
|
11
12
|
let FinancialInstitutionQuery = class FinancialInstitutionQuery {
|
|
12
13
|
async financialInstitution(id, context) {
|
|
13
14
|
const { domain } = context.state;
|
|
15
|
+
/* The seeded institutions belong to no domain - every domain reads them beside its own. */
|
|
14
16
|
return await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution).findOne({
|
|
15
|
-
where:
|
|
17
|
+
where: [
|
|
18
|
+
{ domain: (0, typeorm_1.IsNull)(), id },
|
|
19
|
+
{ domain: { id: domain.id }, id }
|
|
20
|
+
]
|
|
16
21
|
});
|
|
17
22
|
}
|
|
18
23
|
async financialInstitutions(params, context) {
|
|
19
24
|
const { domain } = context.state;
|
|
25
|
+
/* The seeded institutions belong to no domain - every domain reads them beside its own. */
|
|
20
26
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
21
|
-
domain,
|
|
22
27
|
params,
|
|
28
|
+
alias: 'institution',
|
|
23
29
|
repository: await (0, shell_1.getRepository)(financial_institution_1.FinancialInstitution),
|
|
24
30
|
searchables: ['name', 'description']
|
|
25
|
-
});
|
|
31
|
+
}).andWhere('(institution.domain IS NULL OR institution.domain = :domain)', { domain: domain.id });
|
|
26
32
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
33
|
return { items, total };
|
|
28
34
|
}
|
|
@@ -37,17 +43,18 @@ let FinancialInstitutionQuery = class FinancialInstitutionQuery {
|
|
|
37
43
|
return attachment?.fullpath;
|
|
38
44
|
}
|
|
39
45
|
async domain(financialInstitution) {
|
|
40
|
-
return financialInstitution.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: financialInstitution.domainId }));
|
|
46
|
+
return (financialInstitution.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: financialInstitution.domainId })));
|
|
41
47
|
}
|
|
42
48
|
async updater(financialInstitution) {
|
|
43
|
-
return financialInstitution.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.updaterId }));
|
|
49
|
+
return (financialInstitution.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.updaterId })));
|
|
44
50
|
}
|
|
45
51
|
async creator(financialInstitution) {
|
|
46
|
-
return financialInstitution.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.creatorId }));
|
|
52
|
+
return (financialInstitution.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: financialInstitution.creatorId })));
|
|
47
53
|
}
|
|
48
54
|
};
|
|
49
55
|
exports.FinancialInstitutionQuery = FinancialInstitutionQuery;
|
|
50
56
|
tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
51
58
|
(0, type_graphql_1.Query)(returns => financial_institution_1.FinancialInstitution, { nullable: true, description: 'To fetch a FinancialInstitution' }),
|
|
52
59
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
53
60
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -56,6 +63,7 @@ tslib_1.__decorate([
|
|
|
56
63
|
tslib_1.__metadata("design:returntype", Promise)
|
|
57
64
|
], FinancialInstitutionQuery.prototype, "financialInstitution", null);
|
|
58
65
|
tslib_1.__decorate([
|
|
66
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
59
67
|
(0, type_graphql_1.Query)(returns => financial_institution_type_1.FinancialInstitutionList, { description: 'To fetch multiple FinancialInstitutions' }),
|
|
60
68
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
61
69
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-institution-query.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,mEAA8D;AAC9D,6EAAuE;AAGhE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;
|
|
1
|
+
{"version":3,"file":"financial-institution-query.js","sourceRoot":"","sources":["../../../server/service/financial-institution/financial-institution-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAgC;AAChC,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,mEAA8D;AAC9D,6EAAuE;AAGhE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAG9B,AAAN,KAAK,CAAC,oBAAoB,CAAY,EAAU,EAAS,OAAwB;QAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,2FAA2F;QAC3F,OAAO,MAAM,IAAA,qBAAa,EAAC,4CAAoB,CAAC,CAAC,OAAO,CAAC;YACvD,KAAK,EAAE;gBACL,EAAE,MAAM,EAAE,IAAA,gBAAM,GAAE,EAAE,EAAE,EAAE;gBACxB,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;aAClC;SACF,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,qBAAqB,CACA,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,2FAA2F;QAC3F,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;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AAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAuB,4CAAoB;;wDAI/D;oCApEU,yBAAyB;IADrC,IAAA,uBAAQ,EAAC,4CAAoB,CAAC;GAClB,yBAAyB,CAqErC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { IsNull } from 'typeorm'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { FinancialInstitution } from './financial-institution'\nimport { FinancialInstitutionList } from './financial-institution-type'\n\n@Resolver(FinancialInstitution)\nexport class FinancialInstitutionQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => FinancialInstitution!, { nullable: true, description: 'To fetch a FinancialInstitution' })\n async financialInstitution(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialInstitution> {\n const { domain } = context.state\n\n /* The seeded institutions belong to no domain - every domain reads them beside its own. */\n return await getRepository(FinancialInstitution).findOne({\n where: [\n { domain: IsNull(), id },\n { domain: { id: domain.id }, id }\n ]\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => FinancialInstitutionList, { description: 'To fetch multiple FinancialInstitutions' })\n async financialInstitutions(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<FinancialInstitutionList> {\n const { domain } = context.state\n\n /* The seeded institutions belong to no domain - every domain reads them beside its own. */\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n alias: 'institution',\n repository: await getRepository(FinancialInstitution),\n searchables: ['name', 'description']\n }).andWhere('(institution.domain IS NULL OR institution.domain = :domain)', { domain: domain.id })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() financialInstitution: FinancialInstitution): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: financialInstitution.domainId },\n refType: FinancialInstitution.name,\n refBy: financialInstitution.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() financialInstitution: FinancialInstitution): Promise<Domain> {\n return (\n financialInstitution.domainId && (await getRepository(Domain).findOneBy({ id: financialInstitution.domainId }))\n )\n }\n\n @FieldResolver(type => User)\n async updater(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return (\n financialInstitution.updaterId && (await getRepository(User).findOneBy({ id: financialInstitution.updaterId }))\n )\n }\n\n @FieldResolver(type => User)\n async creator(@Root() financialInstitution: FinancialInstitution): Promise<User> {\n return (\n financialInstitution.creatorId && (await getRepository(User).findOneBy({ id: financialInstitution.creatorId }))\n )\n }\n}\n"]}
|
|
@@ -2,5 +2,5 @@ import { FinancialInstitution } from './financial-institution';
|
|
|
2
2
|
import { FinancialInstitutionQuery } from './financial-institution-query';
|
|
3
3
|
import { FinancialInstitutionMutation } from './financial-institution-mutation';
|
|
4
4
|
export declare const entities: (typeof FinancialInstitution)[];
|
|
5
|
-
export declare const resolvers: (typeof
|
|
5
|
+
export declare const resolvers: (typeof FinancialInstitutionQuery | typeof FinancialInstitutionMutation)[];
|
|
6
6
|
export declare const subscribers: any[];
|
|
@@ -1,20 +1,22 @@
|
|
|
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 { FinancialStatement } from './financial-statement';
|
|
5
|
-
|
|
4
|
+
import { FinancialStatement, FinancialStatementKind } from './financial-statement';
|
|
5
|
+
/** Each version of a financial statement, written when it changes. */
|
|
6
6
|
export declare class FinancialStatementHistory implements HistoryEntityInterface<FinancialStatement> {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
version?: number;
|
|
9
9
|
domain?: Domain;
|
|
10
10
|
domainId?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
fiscalYear: number;
|
|
12
|
+
kind: FinancialStatementKind;
|
|
13
|
+
periodFrom: string;
|
|
14
|
+
periodTo: string;
|
|
15
|
+
filingKind: string;
|
|
16
|
+
filedOn: string;
|
|
17
|
+
issueNo: string;
|
|
18
|
+
source: string;
|
|
19
|
+
notes: string;
|
|
18
20
|
createdAt?: Date;
|
|
19
21
|
updatedAt?: Date;
|
|
20
22
|
deletedAt?: Date;
|
|
@@ -8,9 +8,10 @@ const typeorm_history_1 = require("@operato/typeorm-history");
|
|
|
8
8
|
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
|
-
const
|
|
11
|
+
const financial_statement_1 = require("./financial-statement");
|
|
12
12
|
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
13
|
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
+
/** Each version of a financial statement, written when it changes. */
|
|
14
15
|
let FinancialStatementHistory = class FinancialStatementHistory {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.version = 1;
|
|
@@ -19,17 +20,17 @@ let FinancialStatementHistory = class FinancialStatementHistory {
|
|
|
19
20
|
exports.FinancialStatementHistory = FinancialStatementHistory;
|
|
20
21
|
tslib_1.__decorate([
|
|
21
22
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
23
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier of the version' }),
|
|
23
24
|
tslib_1.__metadata("design:type", String)
|
|
24
25
|
], FinancialStatementHistory.prototype, "id", void 0);
|
|
25
26
|
tslib_1.__decorate([
|
|
26
27
|
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Version number' }),
|
|
28
29
|
tslib_1.__metadata("design:type", Number)
|
|
29
30
|
], FinancialStatementHistory.prototype, "version", void 0);
|
|
30
31
|
tslib_1.__decorate([
|
|
31
32
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
32
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
33
34
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
34
35
|
], FinancialStatementHistory.prototype, "domain", void 0);
|
|
35
36
|
tslib_1.__decorate([
|
|
@@ -37,58 +38,68 @@ tslib_1.__decorate([
|
|
|
37
38
|
tslib_1.__metadata("design:type", String)
|
|
38
39
|
], FinancialStatementHistory.prototype, "domainId", void 0);
|
|
39
40
|
tslib_1.__decorate([
|
|
40
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
41
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
41
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
42
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'fiscalYear at this version' }),
|
|
42
43
|
tslib_1.__metadata("design:type", Number)
|
|
43
|
-
], FinancialStatementHistory.prototype, "
|
|
44
|
+
], FinancialStatementHistory.prototype, "fiscalYear", void 0);
|
|
44
45
|
tslib_1.__decorate([
|
|
45
46
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
47
|
-
tslib_1.__metadata("design:type",
|
|
48
|
-
], FinancialStatementHistory.prototype, "
|
|
47
|
+
(0, type_graphql_1.Field)(type => financial_statement_1.FinancialStatementKind, { nullable: true, description: 'kind at this version' }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], FinancialStatementHistory.prototype, "kind", void 0);
|
|
49
50
|
tslib_1.__decorate([
|
|
50
51
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
52
|
-
tslib_1.__metadata("design:type",
|
|
53
|
-
], FinancialStatementHistory.prototype, "
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'periodFrom at this version' }),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], FinancialStatementHistory.prototype, "periodFrom", void 0);
|
|
54
55
|
tslib_1.__decorate([
|
|
55
|
-
(0, typeorm_1.Column)(
|
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
57
|
-
tslib_1.__metadata("design:type",
|
|
58
|
-
], FinancialStatementHistory.prototype, "
|
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'periodTo at this version' }),
|
|
58
|
+
tslib_1.__metadata("design:type", String)
|
|
59
|
+
], FinancialStatementHistory.prototype, "periodTo", void 0);
|
|
59
60
|
tslib_1.__decorate([
|
|
60
|
-
(0, typeorm_1.Column)(
|
|
61
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
62
|
-
tslib_1.__metadata("design:type",
|
|
63
|
-
], FinancialStatementHistory.prototype, "
|
|
61
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
62
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'filingKind at this version' }),
|
|
63
|
+
tslib_1.__metadata("design:type", String)
|
|
64
|
+
], FinancialStatementHistory.prototype, "filingKind", void 0);
|
|
64
65
|
tslib_1.__decorate([
|
|
65
|
-
(0, typeorm_1.Column)(
|
|
66
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
67
|
-
tslib_1.__metadata("design:type",
|
|
68
|
-
], FinancialStatementHistory.prototype, "
|
|
66
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
67
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'filedOn at this version' }),
|
|
68
|
+
tslib_1.__metadata("design:type", String)
|
|
69
|
+
], FinancialStatementHistory.prototype, "filedOn", void 0);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
72
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'issueNo at this version' }),
|
|
73
|
+
tslib_1.__metadata("design:type", String)
|
|
74
|
+
], FinancialStatementHistory.prototype, "issueNo", void 0);
|
|
69
75
|
tslib_1.__decorate([
|
|
70
|
-
(0, typeorm_1.
|
|
71
|
-
(0, type_graphql_1.Field)(
|
|
72
|
-
tslib_1.__metadata("design:type",
|
|
73
|
-
], FinancialStatementHistory.prototype, "
|
|
76
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
77
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'source at this version' }),
|
|
78
|
+
tslib_1.__metadata("design:type", String)
|
|
79
|
+
], FinancialStatementHistory.prototype, "source", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
82
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'notes at this version' }),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], FinancialStatementHistory.prototype, "notes", void 0);
|
|
74
85
|
tslib_1.__decorate([
|
|
75
86
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
76
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
87
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was created' }),
|
|
77
88
|
tslib_1.__metadata("design:type", Date)
|
|
78
89
|
], FinancialStatementHistory.prototype, "createdAt", void 0);
|
|
79
90
|
tslib_1.__decorate([
|
|
80
91
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
92
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When this version was written' }),
|
|
82
93
|
tslib_1.__metadata("design:type", Date)
|
|
83
94
|
], FinancialStatementHistory.prototype, "updatedAt", void 0);
|
|
84
95
|
tslib_1.__decorate([
|
|
85
96
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
86
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
97
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was deleted' }),
|
|
87
98
|
tslib_1.__metadata("design:type", Date)
|
|
88
99
|
], FinancialStatementHistory.prototype, "deletedAt", void 0);
|
|
89
100
|
tslib_1.__decorate([
|
|
90
101
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
91
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
102
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who created it' }),
|
|
92
103
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
93
104
|
], FinancialStatementHistory.prototype, "creator", void 0);
|
|
94
105
|
tslib_1.__decorate([
|
|
@@ -97,7 +108,7 @@ tslib_1.__decorate([
|
|
|
97
108
|
], FinancialStatementHistory.prototype, "creatorId", void 0);
|
|
98
109
|
tslib_1.__decorate([
|
|
99
110
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
100
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
111
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who wrote this version' }),
|
|
101
112
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
102
113
|
], FinancialStatementHistory.prototype, "updater", void 0);
|
|
103
114
|
tslib_1.__decorate([
|
|
@@ -127,11 +138,11 @@ tslib_1.__decorate([
|
|
|
127
138
|
], FinancialStatementHistory.prototype, "action", void 0);
|
|
128
139
|
exports.FinancialStatementHistory = FinancialStatementHistory = tslib_1.__decorate([
|
|
129
140
|
(0, typeorm_1.Entity)(),
|
|
130
|
-
(0, typeorm_1.Index)('
|
|
141
|
+
(0, typeorm_1.Index)('ix_financial_statement_history_0', (financialStatementHistory) => [
|
|
131
142
|
financialStatementHistory.originalId,
|
|
132
143
|
financialStatementHistory.version
|
|
133
144
|
], { unique: true }),
|
|
134
|
-
(0, typeorm_1.Index)('
|
|
145
|
+
(0, typeorm_1.Index)('ix_financial_statement_history_1', (financialStatementHistory) => [
|
|
135
146
|
financialStatementHistory.domain,
|
|
136
147
|
financialStatementHistory.originalId,
|
|
137
148
|
financialStatementHistory.version
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-statement-history.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-history.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"financial-statement-history.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAgD;AAChD,6CAA4C;AAC5C,iDAA2D;AAE3D,+DAAkF;AAElF,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,sEAAsE;AAoB/D,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAOL,YAAO,GAAY,CAAC,CAAA;IA2FtB,CAAC;CAAA,CAAA;AAlGY,8DAAyB;AAG3B;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;qDACpD;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,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B,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;KAC/G,CAAC;;yDAC+B;oCAjGtB,yBAAyB;IAnBrC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,kCAAkC,EAClC,CAAC,yBAAoD,EAAE,EAAE,CAAC;QACxD,yBAAyB,CAAC,UAAU;QACpC,yBAAyB,CAAC,OAAO;KAClC,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,kCAAkC,EAClC,CAAC,yBAAoD,EAAE,EAAE,CAAC;QACxD,yBAAyB,CAAC,MAAM;QAChC,yBAAyB,CAAC,UAAU;QACpC,yBAAyB,CAAC,OAAO;KAClC,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,yBAAyB,CAkGrC","sourcesContent":["import { Field, Float, ID, Int, 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 { User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain, moneyColumn } from '@things-factory/shell'\n\nimport { FinancialStatement, FinancialStatementKind } from './financial-statement'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n/** Each version of a financial statement, written when it changes. */\n@Entity()\n@Index(\n 'ix_financial_statement_history_0',\n (financialStatementHistory: FinancialStatementHistory) => [\n financialStatementHistory.originalId,\n financialStatementHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_financial_statement_history_1',\n (financialStatementHistory: FinancialStatementHistory) => [\n financialStatementHistory.domain,\n financialStatementHistory.originalId,\n financialStatementHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of FinancialStatement' })\nexport class FinancialStatementHistory implements HistoryEntityInterface<FinancialStatement> {\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((financialStatementHistory: FinancialStatementHistory) => financialStatementHistory.domain)\n domainId?: string\n\n @Column({ type: 'int', nullable: true })\n @Field(type => Int, { nullable: true, description: 'fiscalYear at this version' })\n fiscalYear: number\n\n @Column({ nullable: true })\n @Field(type => FinancialStatementKind, { nullable: true, description: 'kind at this version' })\n kind: FinancialStatementKind\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'periodFrom at this version' })\n periodFrom: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'periodTo at this version' })\n periodTo: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'filingKind at this version' })\n filingKind: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'filedOn at this version' })\n filedOn: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'issueNo at this version' })\n issueNo: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'source at this version' })\n source: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'notes at this version' })\n notes: string\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((financialStatementHistory: FinancialStatementHistory) => financialStatementHistory.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((financialStatementHistory: FinancialStatementHistory) => financialStatementHistory.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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { FinancialStatement } from './financial-statement';
|
|
4
|
+
/** One line of a filed statement - an account or a total, under the code of the standard it was filed in. */
|
|
5
|
+
export declare class FinancialStatementLine {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
domain?: Domain;
|
|
8
|
+
domainId?: string;
|
|
9
|
+
statement?: FinancialStatement;
|
|
10
|
+
statementId?: string;
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
amount: number;
|
|
14
|
+
rank: number;
|
|
15
|
+
level: number;
|
|
16
|
+
contra: boolean;
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
updatedAt?: Date;
|
|
19
|
+
deletedAt?: Date;
|
|
20
|
+
creator?: User;
|
|
21
|
+
creatorId?: string;
|
|
22
|
+
updater?: User;
|
|
23
|
+
updaterId?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FinancialStatementLine = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const financial_statement_1 = require("./financial-statement");
|
|
10
|
+
/** One line of a filed statement - an account or a total, under the code of the standard it was filed in. */
|
|
11
|
+
let FinancialStatementLine = class FinancialStatementLine {
|
|
12
|
+
};
|
|
13
|
+
exports.FinancialStatementLine = FinancialStatementLine;
|
|
14
|
+
tslib_1.__decorate([
|
|
15
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
16
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
|
|
17
|
+
tslib_1.__metadata("design:type", String)
|
|
18
|
+
], FinancialStatementLine.prototype, "id", void 0);
|
|
19
|
+
tslib_1.__decorate([
|
|
20
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
21
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
22
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
23
|
+
], FinancialStatementLine.prototype, "domain", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, typeorm_1.RelationId)((line) => line.domain),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], FinancialStatementLine.prototype, "domainId", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, typeorm_1.ManyToOne)(type => financial_statement_1.FinancialStatement, statement => statement.lines, { nullable: false }),
|
|
30
|
+
(0, type_graphql_1.Field)(type => financial_statement_1.FinancialStatement, { nullable: true, description: 'The statement it is a line of' }),
|
|
31
|
+
tslib_1.__metadata("design:type", financial_statement_1.FinancialStatement)
|
|
32
|
+
], FinancialStatementLine.prototype, "statement", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
(0, typeorm_1.RelationId)((line) => line.statement),
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
36
|
+
], FinancialStatementLine.prototype, "statementId", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, typeorm_1.Column)(),
|
|
39
|
+
(0, type_graphql_1.Field)({ description: "The standard's code - the order of the statement" }),
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
|
+
], FinancialStatementLine.prototype, "code", void 0);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, typeorm_1.Column)(),
|
|
44
|
+
(0, type_graphql_1.Field)({ description: 'The account as the statement writes it' }),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], FinancialStatementLine.prototype, "name", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, typeorm_1.Column)((0, shell_1.moneyColumn)()),
|
|
49
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'Amount' }),
|
|
50
|
+
tslib_1.__metadata("design:type", Number)
|
|
51
|
+
], FinancialStatementLine.prototype, "amount", void 0);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ type: 'int', default: 3 }),
|
|
54
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: '0 total, 1 section, 2 group, 3 item, 4 breakdown' }),
|
|
55
|
+
tslib_1.__metadata("design:type", Number)
|
|
56
|
+
], FinancialStatementLine.prototype, "rank", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: 'int', default: 0 }),
|
|
59
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Indentation - how many lines above contain this one' }),
|
|
60
|
+
tslib_1.__metadata("design:type", Number)
|
|
61
|
+
], FinancialStatementLine.prototype, "level", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
64
|
+
(0, type_graphql_1.Field)({ description: 'A contra account - the item above less this' }),
|
|
65
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
66
|
+
], FinancialStatementLine.prototype, "contra", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was recorded' }),
|
|
70
|
+
tslib_1.__metadata("design:type", Date)
|
|
71
|
+
], FinancialStatementLine.prototype, "createdAt", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it last changed' }),
|
|
75
|
+
tslib_1.__metadata("design:type", Date)
|
|
76
|
+
], FinancialStatementLine.prototype, "updatedAt", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
79
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was replaced or deleted' }),
|
|
80
|
+
tslib_1.__metadata("design:type", Date)
|
|
81
|
+
], FinancialStatementLine.prototype, "deletedAt", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
84
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who recorded it' }),
|
|
85
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
86
|
+
], FinancialStatementLine.prototype, "creator", void 0);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.RelationId)((line) => line.creator),
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
90
|
+
], FinancialStatementLine.prototype, "creatorId", void 0);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
93
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who last changed it' }),
|
|
94
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
95
|
+
], FinancialStatementLine.prototype, "updater", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, typeorm_1.RelationId)((line) => line.updater),
|
|
98
|
+
tslib_1.__metadata("design:type", String)
|
|
99
|
+
], FinancialStatementLine.prototype, "updaterId", void 0);
|
|
100
|
+
exports.FinancialStatementLine = FinancialStatementLine = tslib_1.__decorate([
|
|
101
|
+
(0, typeorm_1.Entity)(),
|
|
102
|
+
(0, typeorm_1.Index)('ix_financial_statement_line_0', (line) => [line.statement, line.code], {
|
|
103
|
+
unique: true,
|
|
104
|
+
where: '"deleted_at" IS NULL'
|
|
105
|
+
}),
|
|
106
|
+
(0, type_graphql_1.ObjectType)({ description: 'One line of a filed financial statement' })
|
|
107
|
+
], FinancialStatementLine);
|
|
108
|
+
//# sourceMappingURL=financial-statement-line.js.map
|