@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.
- 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 +8 -8
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-query.js +2 -2
- package/dist-server/service/account/account-query.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/account/index.d.ts +1 -1
- package/dist-server/service/accounting-category/accounting-category-mutation.js +8 -8
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-query.js +2 -2
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-category/index.d.ts +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/accounting-document/index.d.ts +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-account/index.d.ts +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-statement/financial-statement-history.d.ts +11 -9
- package/dist-server/service/financial-statement/financial-statement-history.js +44 -33
- 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 +11 -136
- 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 +42 -32
- 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 +70 -62
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +4 -3
- 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/fiscal-month/fiscal-month-mutation.js +6 -6
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -2
- package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
- package/dist-server/service/fiscal-month/index.d.ts +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -6
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -2
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
- package/dist-server/service/fiscal-quarter/index.d.ts +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -6
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -2
- package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
- package/dist-server/service/fiscal-year/index.d.ts +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 +2 -1
- 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 +19 -84
- 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 +32 -3
- 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 +65 -95
- 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/index.d.ts +2 -2
- 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 +18 -83
- 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 +86 -4
- 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 +213 -111
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -4
- 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 -94
- 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 -96
- 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
|
@@ -6,54 +6,64 @@ const type_graphql_1 = require("type-graphql");
|
|
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
|
7
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
8
|
const financial_statement_1 = require("./financial-statement");
|
|
9
|
-
const
|
|
9
|
+
const financial_statement_line_1 = require("./financial-statement-line");
|
|
10
10
|
let FinancialStatementQuery = class FinancialStatementQuery {
|
|
11
|
-
async
|
|
11
|
+
async financialStatementYears(context) {
|
|
12
12
|
const { domain } = context.state;
|
|
13
|
-
|
|
14
|
-
where: { domain: { id: domain.id }
|
|
13
|
+
const rows = await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement).find({
|
|
14
|
+
where: { domain: { id: domain.id } },
|
|
15
|
+
select: ['fiscalYear']
|
|
15
16
|
});
|
|
17
|
+
return [...new Set(rows.map(row => row.fiscalYear))].sort((a, b) => b - a);
|
|
16
18
|
}
|
|
17
|
-
async financialStatements(
|
|
19
|
+
async financialStatements(fiscalYear, context) {
|
|
18
20
|
const { domain } = context.state;
|
|
19
|
-
|
|
20
|
-
domain,
|
|
21
|
-
|
|
22
|
-
repository: await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement),
|
|
23
|
-
searchables: ['name', 'description']
|
|
21
|
+
return await (0, shell_1.getRepository)(financial_statement_1.FinancialStatement).find({
|
|
22
|
+
where: { domain: { id: domain.id }, fiscalYear },
|
|
23
|
+
order: { kind: 'ASC' }
|
|
24
24
|
});
|
|
25
|
-
const [items, total] = await queryBuilder.getManyAndCount();
|
|
26
|
-
return { items, total };
|
|
27
25
|
}
|
|
28
|
-
async
|
|
29
|
-
return await (0, shell_1.getRepository)(
|
|
26
|
+
async lines(statement) {
|
|
27
|
+
return await (0, shell_1.getRepository)(financial_statement_line_1.FinancialStatementLine).find({
|
|
28
|
+
where: { statement: { id: statement.id } },
|
|
29
|
+
order: { code: 'ASC' }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async domain(statement) {
|
|
33
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: statement.domainId });
|
|
30
34
|
}
|
|
31
|
-
async
|
|
32
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id:
|
|
35
|
+
async creator(statement) {
|
|
36
|
+
return statement.creatorId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: statement.creatorId }) : null;
|
|
33
37
|
}
|
|
34
|
-
async
|
|
35
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id:
|
|
38
|
+
async updater(statement) {
|
|
39
|
+
return statement.updaterId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: statement.updaterId }) : null;
|
|
36
40
|
}
|
|
37
41
|
};
|
|
38
42
|
exports.FinancialStatementQuery = FinancialStatementQuery;
|
|
39
43
|
tslib_1.__decorate([
|
|
40
|
-
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
|
41
|
-
(0, type_graphql_1.Query)(returns =>
|
|
42
|
-
tslib_1.__param(0, (0, type_graphql_1.
|
|
43
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
44
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
45
|
+
(0, type_graphql_1.Query)(returns => [type_graphql_1.Int], { description: 'The fiscal years with a filed statement, the latest first' }),
|
|
46
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
44
47
|
tslib_1.__metadata("design:type", Function),
|
|
45
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
48
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
46
49
|
tslib_1.__metadata("design:returntype", Promise)
|
|
47
|
-
], FinancialStatementQuery.prototype, "
|
|
50
|
+
], FinancialStatementQuery.prototype, "financialStatementYears", null);
|
|
48
51
|
tslib_1.__decorate([
|
|
49
|
-
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
|
50
|
-
(0, type_graphql_1.Query)(returns =>
|
|
51
|
-
tslib_1.__param(0, (0, type_graphql_1.
|
|
52
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
53
|
+
(0, type_graphql_1.Query)(returns => [financial_statement_1.FinancialStatement], { description: 'The statements filed for a fiscal year' }),
|
|
54
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('fiscalYear', type => type_graphql_1.Int)),
|
|
52
55
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
53
56
|
tslib_1.__metadata("design:type", Function),
|
|
54
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
57
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
55
58
|
tslib_1.__metadata("design:returntype", Promise)
|
|
56
59
|
], FinancialStatementQuery.prototype, "financialStatements", null);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.FieldResolver)(type => [financial_statement_line_1.FinancialStatementLine]),
|
|
62
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
63
|
+
tslib_1.__metadata("design:type", Function),
|
|
64
|
+
tslib_1.__metadata("design:paramtypes", [financial_statement_1.FinancialStatement]),
|
|
65
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
66
|
+
], FinancialStatementQuery.prototype, "lines", null);
|
|
57
67
|
tslib_1.__decorate([
|
|
58
68
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
59
69
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -62,19 +72,19 @@ tslib_1.__decorate([
|
|
|
62
72
|
tslib_1.__metadata("design:returntype", Promise)
|
|
63
73
|
], FinancialStatementQuery.prototype, "domain", null);
|
|
64
74
|
tslib_1.__decorate([
|
|
65
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
75
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
66
76
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
67
77
|
tslib_1.__metadata("design:type", Function),
|
|
68
78
|
tslib_1.__metadata("design:paramtypes", [financial_statement_1.FinancialStatement]),
|
|
69
79
|
tslib_1.__metadata("design:returntype", Promise)
|
|
70
|
-
], FinancialStatementQuery.prototype, "
|
|
80
|
+
], FinancialStatementQuery.prototype, "creator", null);
|
|
71
81
|
tslib_1.__decorate([
|
|
72
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
82
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
73
83
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
74
84
|
tslib_1.__metadata("design:type", Function),
|
|
75
85
|
tslib_1.__metadata("design:paramtypes", [financial_statement_1.FinancialStatement]),
|
|
76
86
|
tslib_1.__metadata("design:returntype", Promise)
|
|
77
|
-
], FinancialStatementQuery.prototype, "
|
|
87
|
+
], FinancialStatementQuery.prototype, "updater", null);
|
|
78
88
|
exports.FinancialStatementQuery = FinancialStatementQuery = tslib_1.__decorate([
|
|
79
89
|
(0, type_graphql_1.Resolver)(financial_statement_1.FinancialStatement)
|
|
80
90
|
], FinancialStatementQuery);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-statement-query.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"financial-statement-query.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA6F;AAE7F,iDAA6D;AAC7D,yDAAgD;AAEhD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC,uBAAuB,CAAQ,OAAwB;QAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,CAAC;YACxD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE;YACpC,MAAM,EAAE,CAAC,YAAY,CAAC;SACvB,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5E,CAAC;IAIK,AAAN,KAAK,CAAC,mBAAmB,CACS,UAAkB,EAC3C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO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, Arg, Ctx, Directive, Int } from 'type-graphql'\n\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { FinancialStatement } from './financial-statement'\nimport { FinancialStatementLine } from './financial-statement-line'\n\n@Resolver(FinancialStatement)\nexport class FinancialStatementQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => [Int], { description: 'The fiscal years with a filed statement, the latest first' })\n async financialStatementYears(@Ctx() context: ResolverContext): Promise<number[]> {\n const { domain } = context.state\n const rows = await getRepository(FinancialStatement).find({\n where: { domain: { id: domain.id } },\n select: ['fiscalYear']\n })\n\n return [...new Set(rows.map(row => row.fiscalYear))].sort((a, b) => b - a)\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => [FinancialStatement], { description: 'The statements filed for a fiscal year' })\n async financialStatements(\n @Arg('fiscalYear', type => Int) fiscalYear: number,\n @Ctx() context: ResolverContext\n ): Promise<FinancialStatement[]> {\n const { domain } = context.state\n\n return await getRepository(FinancialStatement).find({\n where: { domain: { id: domain.id }, fiscalYear },\n order: { kind: 'ASC' }\n })\n }\n\n @FieldResolver(type => [FinancialStatementLine])\n async lines(@Root() statement: FinancialStatement): Promise<FinancialStatementLine[]> {\n return await getRepository(FinancialStatementLine).find({\n where: { statement: { id: statement.id } },\n order: { code: 'ASC' }\n })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() statement: FinancialStatement): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: statement.domainId })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() statement: FinancialStatement): Promise<User | null> {\n return statement.creatorId ? await getRepository(User).findOneBy({ id: statement.creatorId }) : null\n }\n\n @FieldResolver(type => User, { nullable: true })\n async updater(@Root() statement: FinancialStatement): Promise<User | null> {\n return statement.updaterId ? await getRepository(User).findOneBy({ id: statement.updaterId }) : null\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm';
|
|
2
|
+
import { FinancialStatement, FinancialStatementKind } from './financial-statement';
|
|
3
|
+
export interface FiledStatement {
|
|
4
|
+
fiscalYear: number;
|
|
5
|
+
kind: FinancialStatementKind;
|
|
6
|
+
periodFrom?: string | null;
|
|
7
|
+
periodTo?: string | null;
|
|
8
|
+
filingKind?: string | null;
|
|
9
|
+
filedOn?: string | null;
|
|
10
|
+
issueNo?: string | null;
|
|
11
|
+
source?: string | null;
|
|
12
|
+
notes?: string | null;
|
|
13
|
+
lines: {
|
|
14
|
+
code: string;
|
|
15
|
+
name: string;
|
|
16
|
+
amount: number;
|
|
17
|
+
rank?: number;
|
|
18
|
+
level?: number;
|
|
19
|
+
contra?: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Record a filed statement. The one of the same year and kind it replaces is deleted (softly), lines and all.
|
|
24
|
+
* Returns whether one was replaced.
|
|
25
|
+
*/
|
|
26
|
+
export declare function saveFiledStatement(tx: EntityManager, domain: {
|
|
27
|
+
id: string;
|
|
28
|
+
}, user: any, filed: FiledStatement): Promise<{
|
|
29
|
+
statement: FinancialStatement;
|
|
30
|
+
replaced: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/** Delete statements (softly), lines and all. */
|
|
33
|
+
export declare function deleteStatements(tx: EntityManager, statements: FinancialStatement[]): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveFiledStatement = saveFiledStatement;
|
|
4
|
+
exports.deleteStatements = deleteStatements;
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const financial_statement_1 = require("./financial-statement");
|
|
7
|
+
const financial_statement_line_1 = require("./financial-statement-line");
|
|
8
|
+
/**
|
|
9
|
+
* Record a filed statement. The one of the same year and kind it replaces is deleted (softly), lines and all.
|
|
10
|
+
* Returns whether one was replaced.
|
|
11
|
+
*/
|
|
12
|
+
async function saveFiledStatement(tx, domain, user, filed) {
|
|
13
|
+
if (!Number.isInteger(filed.fiscalYear))
|
|
14
|
+
throw new shell_1.Refusal('statement-year-required', {}, 'fiscalYear: the year it is of');
|
|
15
|
+
if (!Object.values(financial_statement_1.FinancialStatementKind).includes(filed.kind))
|
|
16
|
+
throw new shell_1.Refusal('statement-kind-unknown', { kind: filed.kind ?? '' }, 'kind: which statement');
|
|
17
|
+
const codes = filed.lines.map(line => line.code);
|
|
18
|
+
if (new Set(codes).size !== codes.length)
|
|
19
|
+
throw new shell_1.Refusal('statement-line-code-twice', {}, 'a line code appears twice');
|
|
20
|
+
const statements = tx.getRepository(financial_statement_1.FinancialStatement);
|
|
21
|
+
const lines = tx.getRepository(financial_statement_line_1.FinancialStatementLine);
|
|
22
|
+
const previous = await statements.findOne({
|
|
23
|
+
where: { domain: { id: domain.id }, fiscalYear: filed.fiscalYear, kind: filed.kind }
|
|
24
|
+
});
|
|
25
|
+
if (previous)
|
|
26
|
+
await deleteStatements(tx, [previous]);
|
|
27
|
+
const { lines: filedLines, ...fields } = filed;
|
|
28
|
+
const statement = await statements.save({ ...fields, domain, creator: user, updater: user });
|
|
29
|
+
await lines.save(filedLines.map(line => ({ ...line, domain, statement: { id: statement.id }, creator: user, updater: user })));
|
|
30
|
+
return { statement, replaced: !!previous };
|
|
31
|
+
}
|
|
32
|
+
/** Delete statements (softly), lines and all. */
|
|
33
|
+
async function deleteStatements(tx, statements) {
|
|
34
|
+
if (!statements.length)
|
|
35
|
+
return;
|
|
36
|
+
const lines = tx.getRepository(financial_statement_line_1.FinancialStatementLine);
|
|
37
|
+
for (const statement of statements) {
|
|
38
|
+
const old = await lines.find({ where: { statement: { id: statement.id } }, select: ['id'] });
|
|
39
|
+
if (old.length)
|
|
40
|
+
await lines.softDelete(old.map(line => line.id));
|
|
41
|
+
}
|
|
42
|
+
await tx.getRepository(financial_statement_1.FinancialStatement).softDelete(statements.map(statement => statement.id));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=financial-statement-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"financial-statement-service.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement-service.ts"],"names":[],"mappings":";;AAwBA,gDA+BC;AAGD,4CAQC;AAhED,iDAA+C;AAE/C,+DAAkF;AAClF,yEAAmE;AAenE;;;GAGG;AACI,KAAK,UAAU,kBAAkB,CACtC,EAAiB,EACjB,MAAsB,EACtB,IAAS,EACT,KAAqB;IAErB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;QACrC,MAAM,IAAI,eAAO,CAAC,yBAAyB,EAAE,EAAE,EAAE,+BAA+B,CAAC,CAAA;IACnF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,4CAAsB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAC7D,MAAM,IAAI,eAAO,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,uBAAuB,CAAC,CAAA;IAClG,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChD,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM;QACtC,MAAM,IAAI,eAAO,CAAC,2BAA2B,EAAE,EAAE,EAAE,2BAA2B,CAAC,CAAA;IAEjF,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAA;IACvD,MAAM,KAAK,GAAG,EAAE,CAAC,aAAa,CAAC,iDAAsB,CAAC,CAAA;IACtD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;QACxC,KAAK,EAAE,EAAE,MAAM,EAAE,EA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IAAI,GAAG,CAAC,MAAM;YAAE,MAAM,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAClE,CAAC;IACD,MAAM,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;AAClG,CAAC","sourcesContent":["import { EntityManager } from 'typeorm'\n\nimport { Refusal } from '@things-factory/shell'\n\nimport { FinancialStatement, FinancialStatementKind } from './financial-statement'\nimport { FinancialStatementLine } from './financial-statement-line'\n\nexport interface FiledStatement {\n fiscalYear: number\n kind: FinancialStatementKind\n periodFrom?: string | null\n periodTo?: string | null\n filingKind?: string | null\n filedOn?: string | null\n issueNo?: string | null\n source?: string | null\n notes?: string | null\n lines: { code: string; name: string; amount: number; rank?: number; level?: number; contra?: boolean }[]\n}\n\n/**\n * Record a filed statement. The one of the same year and kind it replaces is deleted (softly), lines and all.\n * Returns whether one was replaced.\n */\nexport async function saveFiledStatement(\n tx: EntityManager,\n domain: { id: string },\n user: any,\n filed: FiledStatement\n): Promise<{ statement: FinancialStatement; replaced: boolean }> {\n if (!Number.isInteger(filed.fiscalYear))\n throw new Refusal('statement-year-required', {}, 'fiscalYear: the year it is of')\n if (!Object.values(FinancialStatementKind).includes(filed.kind))\n throw new Refusal('statement-kind-unknown', { kind: filed.kind ?? '' }, 'kind: which statement')\n const codes = filed.lines.map(line => line.code)\n if (new Set(codes).size !== codes.length)\n throw new Refusal('statement-line-code-twice', {}, 'a line code appears twice')\n\n const statements = tx.getRepository(FinancialStatement)\n const lines = tx.getRepository(FinancialStatementLine)\n const previous = await statements.findOne({\n where: { domain: { id: domain.id }, fiscalYear: filed.fiscalYear, kind: filed.kind }\n })\n if (previous) await deleteStatements(tx, [previous])\n\n const { lines: filedLines, ...fields } = filed\n const statement = await statements.save({ ...fields, domain, creator: user, updater: user } as FinancialStatement)\n await lines.save(\n filedLines.map(\n line =>\n ({ ...line, domain, statement: { id: statement.id }, creator: user, updater: user }) as FinancialStatementLine\n )\n )\n\n return { statement, replaced: !!previous }\n}\n\n/** Delete statements (softly), lines and all. */\nexport async function deleteStatements(tx: EntityManager, statements: FinancialStatement[]): Promise<void> {\n if (!statements.length) return\n const lines = tx.getRepository(FinancialStatementLine)\n for (const statement of statements) {\n const old = await lines.find({ where: { statement: { id: statement.id } }, select: ['id'] })\n if (old.length) await lines.softDelete(old.map(line => line.id))\n }\n await tx.getRepository(FinancialStatement).softDelete(statements.map(statement => statement.id))\n}\n"]}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { Domain } from '@things-factory/shell';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
|
-
import {
|
|
4
|
-
export declare enum
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { FinancialStatementLine } from './financial-statement-line';
|
|
4
|
+
export declare enum FinancialStatementKind {
|
|
5
|
+
BALANCE_SHEET = "BALANCE_SHEET",
|
|
6
|
+
INCOME_STATEMENT = "INCOME_STATEMENT",
|
|
7
|
+
COST_OF_GOODS = "COST_OF_GOODS"
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A financial statement of a fiscal year, line by line, as it was filed. Filing it again replaces it; what the books
|
|
11
|
+
* moved on the same lines is read beside it, not kept.
|
|
12
|
+
*/
|
|
8
13
|
export declare class FinancialStatement {
|
|
9
14
|
readonly id: string;
|
|
10
15
|
version?: number;
|
|
11
16
|
domain?: Domain;
|
|
12
17
|
domainId?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
fiscalYear: number;
|
|
19
|
+
kind: FinancialStatementKind;
|
|
20
|
+
periodFrom?: string;
|
|
21
|
+
periodTo?: string;
|
|
22
|
+
filingKind?: string;
|
|
23
|
+
filedOn?: string;
|
|
24
|
+
issueNo?: string;
|
|
25
|
+
source?: string;
|
|
26
|
+
notes?: string;
|
|
27
|
+
lines?: FinancialStatementLine[];
|
|
20
28
|
createdAt?: Date;
|
|
21
29
|
updatedAt?: Date;
|
|
22
30
|
deletedAt?: Date;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FinancialStatement = exports.
|
|
3
|
+
exports.FinancialStatement = exports.FinancialStatementKind = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
8
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const
|
|
10
|
-
var
|
|
11
|
-
(function (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const financial_statement_line_1 = require("./financial-statement-line");
|
|
10
|
+
var FinancialStatementKind;
|
|
11
|
+
(function (FinancialStatementKind) {
|
|
12
|
+
FinancialStatementKind["BALANCE_SHEET"] = "BALANCE_SHEET";
|
|
13
|
+
FinancialStatementKind["INCOME_STATEMENT"] = "INCOME_STATEMENT";
|
|
14
|
+
FinancialStatementKind["COST_OF_GOODS"] = "COST_OF_GOODS";
|
|
15
|
+
})(FinancialStatementKind || (exports.FinancialStatementKind = FinancialStatementKind = {}));
|
|
16
|
+
(0, type_graphql_1.registerEnumType)(FinancialStatementKind, {
|
|
17
|
+
name: 'FinancialStatementKind',
|
|
18
|
+
description: 'Which statement - balance sheet, income statement, statement of cost of goods manufactured'
|
|
18
19
|
});
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A financial statement of a fiscal year, line by line, as it was filed. Filing it again replaces it; what the books
|
|
22
|
+
* moved on the same lines is read beside it, not kept.
|
|
23
|
+
*/
|
|
20
24
|
let FinancialStatement = class FinancialStatement {
|
|
21
25
|
constructor() {
|
|
22
|
-
this.version = 1;
|
|
26
|
+
this.version = 1;
|
|
23
27
|
}
|
|
24
28
|
};
|
|
25
29
|
exports.FinancialStatement = FinancialStatement;
|
|
@@ -35,98 +39,102 @@ tslib_1.__decorate([
|
|
|
35
39
|
], FinancialStatement.prototype, "version", void 0);
|
|
36
40
|
tslib_1.__decorate([
|
|
37
41
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
38
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'The domain to which this financial statement belongs' }),
|
|
39
|
-
tslib_1.__metadata("design:type", shell_1.Domain
|
|
40
|
-
)
|
|
42
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this financial statement belongs' }),
|
|
43
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
41
44
|
], FinancialStatement.prototype, "domain", void 0);
|
|
42
45
|
tslib_1.__decorate([
|
|
43
|
-
(0, typeorm_1.RelationId)((
|
|
46
|
+
(0, typeorm_1.RelationId)((statement) => statement.domain),
|
|
44
47
|
tslib_1.__metadata("design:type", String)
|
|
45
48
|
], FinancialStatement.prototype, "domainId", void 0);
|
|
46
49
|
tslib_1.__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({
|
|
48
|
-
(0, type_graphql_1.Field)(
|
|
50
|
+
(0, typeorm_1.Column)({ type: 'int' }),
|
|
51
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Fiscal year' }),
|
|
49
52
|
tslib_1.__metadata("design:type", Number)
|
|
50
|
-
], FinancialStatement.prototype, "
|
|
53
|
+
], FinancialStatement.prototype, "fiscalYear", void 0);
|
|
54
|
+
tslib_1.__decorate([
|
|
55
|
+
(0, typeorm_1.Column)(),
|
|
56
|
+
(0, type_graphql_1.Field)(type => FinancialStatementKind, { description: 'Which statement' }),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], FinancialStatement.prototype, "kind", void 0);
|
|
51
59
|
tslib_1.__decorate([
|
|
52
60
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
53
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
54
|
-
tslib_1.__metadata("design:type",
|
|
55
|
-
], FinancialStatement.prototype, "
|
|
61
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the first day of the period' }),
|
|
62
|
+
tslib_1.__metadata("design:type", String)
|
|
63
|
+
], FinancialStatement.prototype, "periodFrom", void 0);
|
|
56
64
|
tslib_1.__decorate([
|
|
57
65
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
58
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
59
|
-
tslib_1.__metadata("design:type",
|
|
60
|
-
], FinancialStatement.prototype, "
|
|
66
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - the last day of the period' }),
|
|
67
|
+
tslib_1.__metadata("design:type", String)
|
|
68
|
+
], FinancialStatement.prototype, "periodTo", void 0);
|
|
61
69
|
tslib_1.__decorate([
|
|
62
70
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
63
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
64
|
-
tslib_1.__metadata("design:type",
|
|
65
|
-
], FinancialStatement.prototype, "
|
|
71
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The kind of filing - regular, amended' }),
|
|
72
|
+
tslib_1.__metadata("design:type", String)
|
|
73
|
+
], FinancialStatement.prototype, "filingKind", void 0);
|
|
66
74
|
tslib_1.__decorate([
|
|
67
75
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
69
|
-
tslib_1.__metadata("design:type",
|
|
70
|
-
], FinancialStatement.prototype, "
|
|
76
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'YYYY-MM-DD - when it was filed' }),
|
|
77
|
+
tslib_1.__metadata("design:type", String)
|
|
78
|
+
], FinancialStatement.prototype, "filedOn", void 0);
|
|
71
79
|
tslib_1.__decorate([
|
|
72
80
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
73
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
74
|
-
tslib_1.__metadata("design:type",
|
|
75
|
-
], FinancialStatement.prototype, "
|
|
81
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The issue number of the certificate it came from' }),
|
|
82
|
+
tslib_1.__metadata("design:type", String)
|
|
83
|
+
], FinancialStatement.prototype, "issueNo", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The document it came from' }),
|
|
87
|
+
tslib_1.__metadata("design:type", String)
|
|
88
|
+
], FinancialStatement.prototype, "source", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
91
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
92
|
+
tslib_1.__metadata("design:type", String)
|
|
93
|
+
], FinancialStatement.prototype, "notes", void 0);
|
|
76
94
|
tslib_1.__decorate([
|
|
77
|
-
(0, typeorm_1.OneToMany)(type =>
|
|
78
|
-
(0, type_graphql_1.Field)(type => [
|
|
95
|
+
(0, typeorm_1.OneToMany)(type => financial_statement_line_1.FinancialStatementLine, line => line.statement),
|
|
96
|
+
(0, type_graphql_1.Field)(type => [financial_statement_line_1.FinancialStatementLine], { nullable: true, description: 'Its lines, in the order of the statement' }),
|
|
79
97
|
tslib_1.__metadata("design:type", Array)
|
|
80
|
-
], FinancialStatement.prototype, "
|
|
98
|
+
], FinancialStatement.prototype, "lines", void 0);
|
|
81
99
|
tslib_1.__decorate([
|
|
82
100
|
(0, typeorm_1.CreateDateColumn)(),
|
|
83
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
84
|
-
tslib_1.__metadata("design:type", Date
|
|
85
|
-
)
|
|
101
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was recorded' }),
|
|
102
|
+
tslib_1.__metadata("design:type", Date)
|
|
86
103
|
], FinancialStatement.prototype, "createdAt", void 0);
|
|
87
104
|
tslib_1.__decorate([
|
|
88
105
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
89
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
90
|
-
tslib_1.__metadata("design:type", Date
|
|
91
|
-
)
|
|
106
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it last changed' }),
|
|
107
|
+
tslib_1.__metadata("design:type", Date)
|
|
92
108
|
], FinancialStatement.prototype, "updatedAt", void 0);
|
|
93
109
|
tslib_1.__decorate([
|
|
94
110
|
(0, typeorm_1.DeleteDateColumn)(),
|
|
95
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
96
|
-
tslib_1.__metadata("design:type", Date
|
|
97
|
-
)
|
|
111
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was replaced or deleted' }),
|
|
112
|
+
tslib_1.__metadata("design:type", Date)
|
|
98
113
|
], FinancialStatement.prototype, "deletedAt", void 0);
|
|
99
114
|
tslib_1.__decorate([
|
|
100
115
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
101
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: '
|
|
102
|
-
tslib_1.__metadata("design:type", auth_base_1.User
|
|
103
|
-
)
|
|
116
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who recorded it' }),
|
|
117
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
104
118
|
], FinancialStatement.prototype, "creator", void 0);
|
|
105
119
|
tslib_1.__decorate([
|
|
106
|
-
(0, typeorm_1.RelationId)((
|
|
120
|
+
(0, typeorm_1.RelationId)((statement) => statement.creator),
|
|
107
121
|
tslib_1.__metadata("design:type", String)
|
|
108
122
|
], FinancialStatement.prototype, "creatorId", void 0);
|
|
109
123
|
tslib_1.__decorate([
|
|
110
124
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
111
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: '
|
|
112
|
-
tslib_1.__metadata("design:type", auth_base_1.User
|
|
113
|
-
)
|
|
125
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who last changed it' }),
|
|
126
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
114
127
|
], FinancialStatement.prototype, "updater", void 0);
|
|
115
128
|
tslib_1.__decorate([
|
|
116
|
-
(0, typeorm_1.RelationId)((
|
|
129
|
+
(0, typeorm_1.RelationId)((statement) => statement.updater),
|
|
117
130
|
tslib_1.__metadata("design:type", String)
|
|
118
131
|
], FinancialStatement.prototype, "updaterId", void 0);
|
|
119
132
|
exports.FinancialStatement = FinancialStatement = tslib_1.__decorate([
|
|
120
133
|
(0, typeorm_1.Entity)(),
|
|
121
|
-
(0, typeorm_1.Index)('ix_financial_statement_0', (
|
|
122
|
-
financialStatement.domain,
|
|
123
|
-
financialStatement.year,
|
|
124
|
-
financialStatement.quarter,
|
|
125
|
-
financialStatement.month
|
|
126
|
-
], {
|
|
134
|
+
(0, typeorm_1.Index)('ix_financial_statement_0', (statement) => [statement.domain, statement.fiscalYear, statement.kind], {
|
|
127
135
|
unique: true,
|
|
128
|
-
where: '"deleted_at" IS NULL'
|
|
136
|
+
where: '"deleted_at" IS NULL'
|
|
129
137
|
}),
|
|
130
|
-
(0, type_graphql_1.ObjectType)({ description: '
|
|
138
|
+
(0, type_graphql_1.ObjectType)({ description: 'A financial statement of a fiscal year, as it was filed' })
|
|
131
139
|
], FinancialStatement);
|
|
132
140
|
//# sourceMappingURL=financial-statement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-statement.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+
|
|
1
|
+
{"version":3,"file":"financial-statement.js","sourceRoot":"","sources":["../../../server/service/financial-statement/financial-statement.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,yEAAmE;AAEnE,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,yDAA+B,CAAA;IAC/B,+DAAqC,CAAA;IACrC,yDAA+B,CAAA;AACjC,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AAED,IAAA,+BAAgB,EAAC,sBAAsB,EAAE;IACvC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,4FAA4F;CAC1G,CAAC,CAAA;AAEF;;;GAGG;AAWI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAOL,YAAO,GAAY,CAAC,CAAA;IA0EtB,CAAC;CAAA,CAAA;AAjFY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;8CACjE;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;mDAC5D;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC;sCACtG,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,SAA6B,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;;oD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AAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAA6B,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;qDAC/C;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;sCAClE,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAA6B,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;qDAC/C;6BAhFP,kBAAkB;IAV9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,SAA6B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,EAC3F;QACE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;GAC1E,kBAAkB,CAiF9B","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID, Int, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { FinancialStatementLine } from './financial-statement-line'\n\nexport enum FinancialStatementKind {\n BALANCE_SHEET = 'BALANCE_SHEET',\n INCOME_STATEMENT = 'INCOME_STATEMENT',\n COST_OF_GOODS = 'COST_OF_GOODS'\n}\n\nregisterEnumType(FinancialStatementKind, {\n name: 'FinancialStatementKind',\n description: 'Which statement - balance sheet, income statement, statement of cost of goods manufactured'\n})\n\n/**\n * A financial statement of a fiscal year, line by line, as it was filed. Filing it again replaces it; what the books\n * moved on the same lines is read beside it, not kept.\n */\n@Entity()\n@Index(\n 'ix_financial_statement_0',\n (statement: FinancialStatement) => [statement.domain, statement.fiscalYear, statement.kind],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@ObjectType({ description: 'A financial statement of a fiscal year, as it was filed' })\nexport class FinancialStatement {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the financial statement' })\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true, description: 'Version number for optimistic locking' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain to which this financial statement belongs' })\n domain?: Domain\n\n @RelationId((statement: FinancialStatement) => statement.domain)\n domainId?: string\n\n @Column({ type: 'int' })\n @Field(type => Int, { description: 'Fiscal year' })\n fiscalYear: number\n\n @Column()\n @Field(type => FinancialStatementKind, { description: 'Which statement' })\n kind: FinancialStatementKind\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the first day of the period' })\n periodFrom?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - the last day of the period' })\n periodTo?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The kind of filing - regular, amended' })\n filingKind?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'YYYY-MM-DD - when it was filed' })\n filedOn?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The issue number of the certificate it came from' })\n issueNo?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The document it came from' })\n source?: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Notes' })\n notes?: string\n\n @OneToMany(type => FinancialStatementLine, line => line.statement)\n @Field(type => [FinancialStatementLine], { nullable: true, description: 'Its lines, in the order of the statement' })\n lines?: FinancialStatementLine[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'When it was recorded' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'When it last changed' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When it was replaced or deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who recorded it' })\n creator?: User\n\n @RelationId((statement: FinancialStatement) => statement.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who last changed it' })\n updater?: User\n\n @RelationId((statement: FinancialStatement) => statement.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FinancialStatement } from './financial-statement';
|
|
2
|
-
import {
|
|
2
|
+
import { FinancialStatementLine } from './financial-statement-line';
|
|
3
|
+
import { FinancialStatementHistory } from './financial-statement-history';
|
|
3
4
|
import { FinancialStatementQuery } from './financial-statement-query';
|
|
4
5
|
import { FinancialStatementMutation } from './financial-statement-mutation';
|
|
5
6
|
import { FinancialStatementHistoryEntitySubscriber } from './event-subscriber';
|
|
6
|
-
export declare const entities: (typeof FinancialStatement | typeof
|
|
7
|
-
export declare const resolvers: (typeof
|
|
7
|
+
export declare const entities: (typeof FinancialStatementLine | typeof FinancialStatement | typeof FinancialStatementHistory)[];
|
|
8
|
+
export declare const resolvers: (typeof FinancialStatementQuery | typeof FinancialStatementMutation)[];
|
|
8
9
|
export declare const subscribers: (typeof FinancialStatementHistoryEntitySubscriber)[];
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
4
|
const financial_statement_1 = require("./financial-statement");
|
|
5
|
-
const
|
|
5
|
+
const financial_statement_line_1 = require("./financial-statement-line");
|
|
6
6
|
const financial_statement_history_1 = require("./financial-statement-history");
|
|
7
7
|
const financial_statement_query_1 = require("./financial-statement-query");
|
|
8
8
|
const financial_statement_mutation_1 = require("./financial-statement-mutation");
|
|
9
9
|
const event_subscriber_1 = require("./event-subscriber");
|
|
10
|
-
exports.entities = [financial_statement_1.FinancialStatement,
|
|
10
|
+
exports.entities = [financial_statement_1.FinancialStatement, financial_statement_line_1.FinancialStatementLine, financial_statement_history_1.FinancialStatementHistory];
|
|
11
11
|
exports.resolvers = [financial_statement_query_1.FinancialStatementQuery, financial_statement_mutation_1.FinancialStatementMutation];
|
|
12
12
|
exports.subscribers = [event_subscriber_1.FinancialStatementHistoryEntitySubscriber];
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/financial-statement/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/financial-statement/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,yEAAmE;AACnE,+EAAyE;AACzE,2EAAqE;AACrE,iFAA2E;AAC3E,yDAA8E;AAEjE,QAAA,QAAQ,GAAG,CAAC,wCAAkB,EAAE,iDAAsB,EAAE,uDAAyB,CAAC,CAAA;AAClF,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,CAAC,4DAAyC,CAAC,CAAA","sourcesContent":["import { FinancialStatement } from './financial-statement'\nimport { FinancialStatementLine } from './financial-statement-line'\nimport { FinancialStatementHistory } from './financial-statement-history'\nimport { FinancialStatementQuery } from './financial-statement-query'\nimport { FinancialStatementMutation } from './financial-statement-mutation'\nimport { FinancialStatementHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [FinancialStatement, FinancialStatementLine, FinancialStatementHistory]\nexport const resolvers = [FinancialStatementQuery, FinancialStatementMutation]\nexport const subscribers = [FinancialStatementHistoryEntitySubscriber]\n"]}
|