@things-factory/accounting 8.0.0-alpha.1 → 8.0.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/client/bootstrap.ts +10 -1
- package/client/components/accounting-category-selector.ts +136 -0
- package/client/components/accounting-category-view.ts +75 -0
- package/client/grist-editors/grist-editor-accounting-category-object.ts +83 -0
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +13 -0
- package/client/pages/account/account-list-page.ts +33 -2
- package/client/pages/accounting-category/accounting-category-list-page.ts +31 -1
- package/client/pages/accounting-category/accounting-category-tree-page.ts +338 -0
- package/client/pages/accounting-document/accounting-document-importer.ts +90 -0
- package/client/pages/accounting-document/accounting-document-list-page.ts +398 -0
- package/client/pages/{ledger/ledger-importer.ts → payment/payment-importer.ts} +10 -17
- package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -57
- package/client/route.ts +0 -4
- package/client/types/accounting-category.ts +23 -0
- package/client/types/index.ts +1 -0
- package/dist-client/bootstrap.js +7 -1
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/components/accounting-category-selector.d.ts +16 -0
- package/dist-client/components/accounting-category-selector.js +134 -0
- package/dist-client/components/accounting-category-selector.js.map +1 -0
- package/dist-client/components/accounting-category-view.d.ts +14 -0
- package/dist-client/components/accounting-category-view.js +81 -0
- package/dist-client/components/accounting-category-view.js.map +1 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
- package/dist-client/pages/account/account-list-page.js +33 -2
- package/dist-client/pages/account/account-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +31 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +3 -2
- package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +14 -21
- package/dist-client/pages/payment/payment-importer.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-list-page.d.ts → payment/payment-list-page.d.ts} +12 -8
- package/dist-client/pages/{ledger/ledger-list-page.js → payment/payment-list-page.js} +114 -67
- package/dist-client/pages/payment/payment-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -3
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types/accounting-category.d.ts +16 -0
- package/dist-client/types/accounting-category.js +3 -0
- package/dist-client/types/accounting-category.js.map +1 -0
- package/dist-client/types/index.d.ts +1 -0
- package/dist-client/types/index.js +2 -0
- package/dist-client/types/index.js.map +1 -0
- package/dist-server/activities/activity-book.js +31 -19
- package/dist-server/activities/activity-book.js.map +1 -1
- package/dist-server/controllers/summary-statements.js +13 -7
- package/dist-server/controllers/summary-statements.js.map +1 -1
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +3 -3
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -1
- package/dist-server/migrations/1725201467183-seed-accounts.js +31 -31
- package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -1
- package/dist-server/routes.d.ts +0 -1
- package/dist-server/routes.js +0 -1
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/account/account-history.d.ts +4 -1
- package/dist-server/service/account/account-history.js +14 -4
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +13 -9
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-query.js +2 -0
- package/dist-server/service/account/account-query.js.map +1 -1
- package/dist-server/service/account/account.d.ts +1 -1
- package/dist-server/service/account/account.js +15 -4
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/account/index.d.ts +1 -2
- package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
- package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
- package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +23 -0
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category.js +14 -3
- package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
- package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-category/event-subscriber.js +21 -0
- package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-category/index.d.ts +2 -1
- package/dist-server/service/accounting-category/index.js +4 -2
- package/dist-server/service/accounting-category/index.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
- package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
- package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
- package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
- package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
- package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
- package/dist-server/service/accounting-document/accounting-document.js +104 -0
- package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
- package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-document/event-subscriber.js +21 -0
- package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-document/index.d.ts +7 -0
- package/dist-server/service/accounting-document/index.js +12 -0
- package/dist-server/service/accounting-document/index.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
- package/dist-server/service/financial-statement/financial-statement-history.js +30 -20
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.js +2 -0
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
- package/dist-server/service/financial-statement/financial-statement.js +45 -24
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +2 -2
- package/dist-server/service/financial-statement/index.js +2 -1
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month.js +1 -1
- package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year.js +1 -1
- package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
- package/dist-server/service/income-statement/income-statement-history.js +35 -20
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
- package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
- package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
- package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-query.js +2 -0
- package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
- package/dist-server/service/income-statement/income-statement.d.ts +2 -0
- package/dist-server/service/income-statement/income-statement.js +46 -26
- package/dist-server/service/income-statement/income-statement.js.map +1 -1
- package/dist-server/service/income-statement/index.d.ts +2 -2
- package/dist-server/service/income-statement/index.js +2 -1
- package/dist-server/service/income-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +4 -2
- package/dist-server/service/index.js +10 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/event-subscriber.d.ts +7 -0
- package/dist-server/service/payment/event-subscriber.js +21 -0
- package/dist-server/service/payment/event-subscriber.js.map +1 -0
- package/dist-server/service/payment/index.d.ts +8 -0
- package/dist-server/service/payment/index.js +12 -0
- package/dist-server/service/payment/index.js.map +1 -0
- package/dist-server/service/payment/payment-history.d.ts +30 -0
- package/dist-server/service/payment/payment-history.js +143 -0
- package/dist-server/service/payment/payment-history.js.map +1 -0
- package/dist-server/service/payment/payment-mutation.d.ts +10 -0
- package/dist-server/service/payment/payment-mutation.js +134 -0
- package/dist-server/service/payment/payment-mutation.js.map +1 -0
- package/dist-server/service/payment/payment-query.d.ts +11 -0
- package/dist-server/service/payment/payment-query.js +81 -0
- package/dist-server/service/payment/payment-query.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +24 -0
- package/dist-server/service/payment/payment-type.js +90 -0
- package/dist-server/service/payment/payment-type.js.map +1 -0
- package/dist-server/service/payment/payment.d.ts +30 -0
- package/dist-server/service/payment/payment.js +146 -0
- package/dist-server/service/payment/payment.js.map +1 -0
- package/dist-server/service/transaction/index.d.ts +2 -1
- package/dist-server/service/transaction/transaction-history.d.ts +6 -2
- package/dist-server/service/transaction/transaction-history.js +28 -9
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -9
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-query.js +2 -0
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +28 -6
- package/dist-server/service/transaction/transaction.js +119 -31
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/accounting-document.md +160 -0
- package/helps/accounting/contract.md +160 -0
- package/helps/accounting/payment.md +160 -0
- package/package.json +5 -5
- package/server/activities/activity-book.ts +31 -19
- package/server/controllers/summary-statements.ts +13 -7
- package/server/index.ts +1 -0
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +3 -3
- package/server/migrations/1725201467183-seed-accounts.ts +31 -31
- package/server/routes.ts +0 -2
- package/server/service/account/account-history.ts +14 -6
- package/server/service/account/account-mutation.ts +13 -10
- package/server/service/account/account-query.ts +2 -0
- package/server/service/account/account.ts +15 -4
- package/server/service/accounting-category/accounting-category-history.ts +123 -0
- package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
- package/server/service/accounting-category/accounting-category-query.ts +23 -0
- package/server/service/accounting-category/accounting-category.ts +14 -3
- package/server/service/accounting-category/event-subscriber.ts +20 -0
- package/server/service/accounting-category/index.ts +4 -2
- package/server/service/accounting-document/accounting-document-history.ts +117 -0
- package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
- package/server/service/accounting-document/accounting-document-query.ts +48 -0
- package/server/service/accounting-document/accounting-document-type.ts +52 -0
- package/server/service/accounting-document/accounting-document.ts +93 -0
- package/server/service/accounting-document/event-subscriber.ts +17 -0
- package/server/service/accounting-document/index.ts +9 -0
- package/server/service/financial-statement/financial-statement-history.ts +27 -18
- package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
- package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
- package/server/service/financial-statement/financial-statement-query.ts +2 -0
- package/server/service/financial-statement/financial-statement.ts +52 -36
- package/server/service/financial-statement/index.ts +2 -1
- package/server/service/fiscal-month/fiscal-month-mutation.ts +10 -2
- package/server/service/fiscal-month/fiscal-month-query.ts +3 -1
- package/server/service/fiscal-month/fiscal-month.ts +1 -1
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +14 -3
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +2 -0
- package/server/service/fiscal-quarter/fiscal-quarter.ts +1 -1
- package/server/service/fiscal-year/fiscal-year-mutation.ts +10 -2
- package/server/service/fiscal-year/fiscal-year-query.ts +2 -0
- package/server/service/fiscal-year/fiscal-year.ts +1 -1
- package/server/service/income-statement/income-statement-history.ts +30 -17
- package/server/service/income-statement/income-statement-line-item.ts +84 -0
- package/server/service/income-statement/income-statement-mutation.ts +12 -10
- package/server/service/income-statement/income-statement-query.ts +2 -0
- package/server/service/income-statement/income-statement.ts +54 -39
- package/server/service/income-statement/index.ts +2 -1
- package/server/service/index.ts +18 -0
- package/server/service/payment/event-subscriber.ts +17 -0
- package/server/service/payment/index.ts +9 -0
- package/server/service/payment/payment-history.ts +126 -0
- package/server/service/payment/payment-mutation.ts +139 -0
- package/server/service/payment/payment-query.ts +50 -0
- package/server/service/payment/payment-type.ts +64 -0
- package/server/service/payment/payment.ts +123 -0
- package/server/service/transaction/transaction-history.ts +24 -8
- package/server/service/transaction/transaction-mutation.ts +13 -10
- package/server/service/transaction/transaction-query.ts +2 -0
- package/server/service/transaction/transaction.ts +130 -34
- package/things-factory.config.js +0 -1
- package/translations/en.json +9 -1
- package/translations/ja.json +9 -1
- package/translations/ko.json +9 -1
- package/translations/ms.json +9 -1
- package/translations/zh.json +9 -1
- package/client/pages/main.ts +0 -24
- package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
- package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
- package/dist-client/pages/main.d.ts +0 -1
- package/dist-client/pages/main.js +0 -27
- package/dist-client/pages/main.js.map +0 -1
@@ -0,0 +1,146 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Payment = exports.PaymentDirection = 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 transaction_1 = require("../transaction/transaction");
|
10
|
+
var PaymentDirection;
|
11
|
+
(function (PaymentDirection) {
|
12
|
+
PaymentDirection["Incoming"] = "Incoming";
|
13
|
+
PaymentDirection["Outgoing"] = "Outgoing"; // 지출
|
14
|
+
})(PaymentDirection || (exports.PaymentDirection = PaymentDirection = {}));
|
15
|
+
(0, type_graphql_1.registerEnumType)(PaymentDirection, {
|
16
|
+
name: 'PaymentDirection',
|
17
|
+
description: 'Indicates whether the payment is incoming (received) or outgoing (paid)' // 결제 방향을 나타냅니다 (수금 또는 지출)
|
18
|
+
});
|
19
|
+
let Payment = class Payment {
|
20
|
+
constructor() {
|
21
|
+
this.version = 1; // 낙관적 잠금을 위한 버전 관리 필드
|
22
|
+
}
|
23
|
+
};
|
24
|
+
exports.Payment = Payment;
|
25
|
+
tslib_1.__decorate([
|
26
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
27
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the payment record' }),
|
28
|
+
tslib_1.__metadata("design:type", String)
|
29
|
+
], Payment.prototype, "id", void 0);
|
30
|
+
tslib_1.__decorate([
|
31
|
+
(0, typeorm_1.VersionColumn)(),
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Version number used for optimistic locking' }),
|
33
|
+
tslib_1.__metadata("design:type", Number)
|
34
|
+
], Payment.prototype, "version", void 0);
|
35
|
+
tslib_1.__decorate([
|
36
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The domain to which this payment belongs' }),
|
38
|
+
tslib_1.__metadata("design:type", shell_1.Domain // 결제가 속한 도메인
|
39
|
+
)
|
40
|
+
], Payment.prototype, "domain", void 0);
|
41
|
+
tslib_1.__decorate([
|
42
|
+
(0, typeorm_1.RelationId)((payment) => payment.domain),
|
43
|
+
tslib_1.__metadata("design:type", String)
|
44
|
+
], Payment.prototype, "domainId", void 0);
|
45
|
+
tslib_1.__decorate([
|
46
|
+
(0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.payments),
|
47
|
+
(0, type_graphql_1.Field)(type => transaction_1.Transaction, { description: 'The transaction associated with this payment' }),
|
48
|
+
tslib_1.__metadata("design:type", transaction_1.Transaction // 결제와 연결된 트랜잭션
|
49
|
+
)
|
50
|
+
], Payment.prototype, "transaction", void 0);
|
51
|
+
tslib_1.__decorate([
|
52
|
+
(0, typeorm_1.RelationId)((payment) => payment.transaction),
|
53
|
+
tslib_1.__metadata("design:type", String)
|
54
|
+
], Payment.prototype, "transactionId", void 0);
|
55
|
+
tslib_1.__decorate([
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The currency used in the payment' }),
|
58
|
+
tslib_1.__metadata("design:type", String)
|
59
|
+
], Payment.prototype, "currency", void 0);
|
60
|
+
tslib_1.__decorate([
|
61
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
62
|
+
(0, type_graphql_1.Field)({ nullable: false, description: 'The amount of money involved in the payment' }),
|
63
|
+
tslib_1.__metadata("design:type", Number)
|
64
|
+
], Payment.prototype, "amount", void 0);
|
65
|
+
tslib_1.__decorate([
|
66
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
67
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year in which the payment was made' }),
|
68
|
+
tslib_1.__metadata("design:type", Number)
|
69
|
+
], Payment.prototype, "year", void 0);
|
70
|
+
tslib_1.__decorate([
|
71
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
72
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter in which the payment was made' }),
|
73
|
+
tslib_1.__metadata("design:type", Number)
|
74
|
+
], Payment.prototype, "quarter", void 0);
|
75
|
+
tslib_1.__decorate([
|
76
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
77
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month in which the payment was made' }),
|
78
|
+
tslib_1.__metadata("design:type", Number)
|
79
|
+
], Payment.prototype, "month", void 0);
|
80
|
+
tslib_1.__decorate([
|
81
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
82
|
+
(0, type_graphql_1.Field)({ nullable: false, description: 'The date and time when the payment was made' }),
|
83
|
+
tslib_1.__metadata("design:type", Date // 결제가 이루어진 날짜 및 시간
|
84
|
+
)
|
85
|
+
], Payment.prototype, "paidAt", void 0);
|
86
|
+
tslib_1.__decorate([
|
87
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
88
|
+
(0, type_graphql_1.Field)(type => PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' }),
|
89
|
+
tslib_1.__metadata("design:type", String)
|
90
|
+
], Payment.prototype, "direction", void 0);
|
91
|
+
tslib_1.__decorate([
|
92
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
93
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Additional notes or comments about the payment' }),
|
94
|
+
tslib_1.__metadata("design:type", String)
|
95
|
+
], Payment.prototype, "note", void 0);
|
96
|
+
tslib_1.__decorate([
|
97
|
+
(0, typeorm_1.CreateDateColumn)(),
|
98
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was created' }),
|
99
|
+
tslib_1.__metadata("design:type", Date // 결제 레코드가 생성된 날짜 및 시간
|
100
|
+
)
|
101
|
+
], Payment.prototype, "createdAt", void 0);
|
102
|
+
tslib_1.__decorate([
|
103
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
104
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was last updated' }),
|
105
|
+
tslib_1.__metadata("design:type", Date // 결제 레코드가 마지막으로 업데이트된 날짜 및 시간
|
106
|
+
)
|
107
|
+
], Payment.prototype, "updatedAt", void 0);
|
108
|
+
tslib_1.__decorate([
|
109
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
110
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when the payment record was deleted' }),
|
111
|
+
tslib_1.__metadata("design:type", Date // 결제 레코드가 삭제된 날짜 및 시간
|
112
|
+
)
|
113
|
+
], Payment.prototype, "deletedAt", void 0);
|
114
|
+
tslib_1.__decorate([
|
115
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
116
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who created the payment record' }),
|
117
|
+
tslib_1.__metadata("design:type", auth_base_1.User // 결제 레코드를 생성한 사용자
|
118
|
+
)
|
119
|
+
], Payment.prototype, "creator", void 0);
|
120
|
+
tslib_1.__decorate([
|
121
|
+
(0, typeorm_1.RelationId)((payment) => payment.creator),
|
122
|
+
tslib_1.__metadata("design:type", String)
|
123
|
+
], Payment.prototype, "creatorId", void 0);
|
124
|
+
tslib_1.__decorate([
|
125
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
126
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The user who last updated the payment record' }),
|
127
|
+
tslib_1.__metadata("design:type", auth_base_1.User // 결제 레코드를 마지막으로 업데이트한 사용자
|
128
|
+
)
|
129
|
+
], Payment.prototype, "updater", void 0);
|
130
|
+
tslib_1.__decorate([
|
131
|
+
(0, typeorm_1.RelationId)((payment) => payment.updater),
|
132
|
+
tslib_1.__metadata("design:type", String)
|
133
|
+
], Payment.prototype, "updaterId", void 0);
|
134
|
+
exports.Payment = Payment = tslib_1.__decorate([
|
135
|
+
(0, typeorm_1.Entity)(),
|
136
|
+
(0, typeorm_1.Index)('ix_payment_0', (payment) => [payment.domain, payment.transaction, payment.paidAt], {
|
137
|
+
where: '"deleted_at" IS NULL',
|
138
|
+
unique: true
|
139
|
+
}),
|
140
|
+
(0, typeorm_1.Index)('ix_payment_1', (payment) => [payment.domain, payment.year, payment.quarter, payment.month, payment.paidAt], {
|
141
|
+
unique: true,
|
142
|
+
where: '"deleted_at" IS NULL'
|
143
|
+
}),
|
144
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity representing a Payment record in the system' }) // 시스템 내에서 결제 기록을 나타내는 엔티티
|
145
|
+
], Payment);
|
146
|
+
//# sourceMappingURL=payment.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../server/service/payment/payment.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAsE;AAEtE,iDAA8C;AAC9C,yDAAgD;AAChD,4DAAwD;AAExD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,yCAAqB,CAAA;IACrB,yCAAqB,CAAA,CAAC,KAAK;AAC7B,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAA,+BAAgB,EAAC,gBAAgB,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,yEAAyE,CAAC,0BAA0B;CAClH,CAAC,CAAA;AAgBK,IAAM,OAAO,GAAb,MAAM,OAAO;IAAb;QAOL,YAAO,GAAY,CAAC,CAAA,CAAC,sBAAsB;IAyE7C,CAAC;CAAA,CAAA;AAhFY,0BAAO;AAGT;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;;mCAC5D;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;wCACjE;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0CAA0C,EAAE,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","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from '../transaction/transaction'\n\nexport enum PaymentDirection {\n Incoming = 'Incoming', // 수금\n Outgoing = 'Outgoing' // 지출\n}\n\nregisterEnumType(PaymentDirection, {\n name: 'PaymentDirection',\n description: 'Indicates whether the payment is incoming (received) or outgoing (paid)' // 결제 방향을 나타냅니다 (수금 또는 지출)\n})\n\n@Entity()\n@Index('ix_payment_0', (payment: Payment) => [payment.domain, payment.transaction, payment.paidAt], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@Index(\n 'ix_payment_1',\n (payment: Payment) => [payment.domain, payment.year, payment.quarter, payment.month, payment.paidAt],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@ObjectType({ description: 'Entity representing a Payment record in the system' }) // 시스템 내에서 결제 기록을 나타내는 엔티티\nexport class Payment {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the payment record' })\n readonly id: string // 고유 식별자 (UUID)\n\n @VersionColumn()\n @Field({ nullable: true, description: 'Version number used for optimistic locking' })\n version?: number = 1 // 낙관적 잠금을 위한 버전 관리 필드\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'The domain to which this payment belongs' })\n domain?: Domain // 결제가 속한 도메인\n\n @RelationId((payment: Payment) => payment.domain)\n domainId?: string // 도메인의 ID\n\n @ManyToOne(type => Transaction, transaction => transaction.payments)\n @Field(type => Transaction, { description: 'The transaction associated with this payment' })\n transaction: Transaction // 결제와 연결된 트랜잭션\n\n @RelationId((payment: Payment) => payment.transaction)\n transactionId: string // 연결된 트랜잭션의 ID\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The currency used in the payment' })\n currency?: string // 결제에 사용된 통화\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The amount of money involved in the payment' })\n amount: number // 결제된 금액\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal year in which the payment was made' })\n year?: number // 결제가 발생한 회계 연도\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal quarter in which the payment was made' })\n quarter?: number // 결제가 발생한 회계 분기\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fiscal month in which the payment was made' })\n month?: number // 결제가 발생한 회계 월\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The date and time when the payment was made' })\n paidAt: Date // 결제가 이루어진 날짜 및 시간\n\n @Column({ nullable: false })\n @Field(type => PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' })\n direction: PaymentDirection // 결제 방향 (수금 또는 지출)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Additional notes or comments about the payment' })\n note?: string // 결제에 대한 추가 설명 또는 메모\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was created' })\n createdAt?: Date // 결제 레코드가 생성된 날짜 및 시간\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was last updated' })\n updatedAt?: Date // 결제 레코드가 마지막으로 업데이트된 날짜 및 시간\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'The date and time when the payment record was deleted' })\n deletedAt?: Date // 결제 레코드가 삭제된 날짜 및 시간\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the payment record' })\n creator?: User // 결제 레코드를 생성한 사용자\n\n @RelationId((payment: Payment) => payment.creator)\n creatorId?: string // 결제 레코드를 생성한 사용자의 ID\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the payment record' })\n updater?: User // 결제 레코드를 마지막으로 업데이트한 사용자\n\n @RelationId((payment: Payment) => payment.updater)\n updaterId?: string // 결제 레코드를 업데이트한 사용자의 ID\n}\n"]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Transaction } from './transaction';
|
2
|
+
import { TransactionHistory } from './transaction-history';
|
2
3
|
import { TransactionQuery } from './transaction-query';
|
3
4
|
import { TransactionMutation } from './transaction-mutation';
|
4
5
|
import { TransactionHistoryEntitySubscriber } from './event-subscriber';
|
5
|
-
export declare const entities: (typeof Transaction)[];
|
6
|
+
export declare const entities: (typeof Transaction | typeof TransactionHistory)[];
|
6
7
|
export declare const resolvers: (typeof TransactionQuery | typeof TransactionMutation)[];
|
7
8
|
export declare const subscribers: (typeof TransactionHistoryEntitySubscriber)[];
|
@@ -1,7 +1,7 @@
|
|
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 { Transaction, TransactionType } from './transaction';
|
4
|
+
import { Transaction, TransactionCategory, TransactionStatus, TransactionType } from './transaction';
|
5
5
|
import { Account } from '../account/account';
|
6
6
|
export declare class TransactionHistory implements HistoryEntityInterface<Transaction> {
|
7
7
|
readonly id: string;
|
@@ -14,12 +14,16 @@ export declare class TransactionHistory implements HistoryEntityInterface<Transa
|
|
14
14
|
amount?: number;
|
15
15
|
active?: boolean;
|
16
16
|
type?: TransactionType;
|
17
|
+
category: TransactionCategory;
|
18
|
+
status: TransactionStatus;
|
19
|
+
probability?: number;
|
20
|
+
forecastNotes?: string;
|
17
21
|
account?: Account;
|
18
22
|
accountId?: string;
|
19
23
|
year?: number;
|
20
24
|
quarter?: number;
|
21
25
|
month?: number;
|
22
|
-
|
26
|
+
transactionDate: string;
|
23
27
|
createdAt?: Date;
|
24
28
|
updatedAt?: Date;
|
25
29
|
deletedAt?: Date;
|
@@ -35,7 +35,7 @@ tslib_1.__decorate([
|
|
35
35
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
36
36
|
], TransactionHistory.prototype, "domain", void 0);
|
37
37
|
tslib_1.__decorate([
|
38
|
-
(0, typeorm_1.RelationId)((
|
38
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.domain),
|
39
39
|
tslib_1.__metadata("design:type", String)
|
40
40
|
], TransactionHistory.prototype, "domainId", void 0);
|
41
41
|
tslib_1.__decorate([
|
@@ -68,13 +68,33 @@ tslib_1.__decorate([
|
|
68
68
|
(0, type_graphql_1.Field)({ nullable: true }),
|
69
69
|
tslib_1.__metadata("design:type", Number)
|
70
70
|
], TransactionHistory.prototype, "type", void 0);
|
71
|
+
tslib_1.__decorate([
|
72
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
73
|
+
(0, type_graphql_1.Field)(type => transaction_1.TransactionCategory, { nullable: false }),
|
74
|
+
tslib_1.__metadata("design:type", String)
|
75
|
+
], TransactionHistory.prototype, "category", void 0);
|
76
|
+
tslib_1.__decorate([
|
77
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
78
|
+
(0, type_graphql_1.Field)(type => transaction_1.TransactionStatus, { nullable: false }),
|
79
|
+
tslib_1.__metadata("design:type", String)
|
80
|
+
], TransactionHistory.prototype, "status", void 0);
|
81
|
+
tslib_1.__decorate([
|
82
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
83
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The probability of the forecast being realized (0 to 100)' }),
|
84
|
+
tslib_1.__metadata("design:type", Number)
|
85
|
+
], TransactionHistory.prototype, "probability", void 0);
|
86
|
+
tslib_1.__decorate([
|
87
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Additional notes or comments about the forecast' }),
|
89
|
+
tslib_1.__metadata("design:type", String)
|
90
|
+
], TransactionHistory.prototype, "forecastNotes", void 0);
|
71
91
|
tslib_1.__decorate([
|
72
92
|
(0, typeorm_1.ManyToOne)(type => account_1.Account),
|
73
93
|
(0, type_graphql_1.Field)({ nullable: true }),
|
74
94
|
tslib_1.__metadata("design:type", account_1.Account)
|
75
95
|
], TransactionHistory.prototype, "account", void 0);
|
76
96
|
tslib_1.__decorate([
|
77
|
-
(0, typeorm_1.RelationId)((
|
97
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.account),
|
78
98
|
tslib_1.__metadata("design:type", String)
|
79
99
|
], TransactionHistory.prototype, "accountId", void 0);
|
80
100
|
tslib_1.__decorate([
|
@@ -93,11 +113,10 @@ tslib_1.__decorate([
|
|
93
113
|
tslib_1.__metadata("design:type", Number)
|
94
114
|
], TransactionHistory.prototype, "month", void 0);
|
95
115
|
tslib_1.__decorate([
|
96
|
-
(0, typeorm_1.Column)({
|
97
|
-
(0, type_graphql_1.Field)({ nullable: false, description: 'The
|
98
|
-
tslib_1.__metadata("design:type",
|
99
|
-
|
100
|
-
], TransactionHistory.prototype, "occurredAt", void 0);
|
116
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
117
|
+
(0, type_graphql_1.Field)({ nullable: false, description: 'The date the transaction occurs or is scheduled (in string format)' }),
|
118
|
+
tslib_1.__metadata("design:type", String)
|
119
|
+
], TransactionHistory.prototype, "transactionDate", void 0);
|
101
120
|
tslib_1.__decorate([
|
102
121
|
(0, typeorm_1.Column)(),
|
103
122
|
(0, type_graphql_1.Field)({ nullable: true }),
|
@@ -119,7 +138,7 @@ tslib_1.__decorate([
|
|
119
138
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
120
139
|
], TransactionHistory.prototype, "creator", void 0);
|
121
140
|
tslib_1.__decorate([
|
122
|
-
(0, typeorm_1.RelationId)((
|
141
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.creator),
|
123
142
|
tslib_1.__metadata("design:type", String)
|
124
143
|
], TransactionHistory.prototype, "creatorId", void 0);
|
125
144
|
tslib_1.__decorate([
|
@@ -128,7 +147,7 @@ tslib_1.__decorate([
|
|
128
147
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
129
148
|
], TransactionHistory.prototype, "updater", void 0);
|
130
149
|
tslib_1.__decorate([
|
131
|
-
(0, typeorm_1.RelationId)((
|
150
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.updater),
|
132
151
|
tslib_1.__metadata("design:type", String)
|
133
152
|
], TransactionHistory.prototype, "updaterId", void 0);
|
134
153
|
tslib_1.__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-history.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,+
|
1
|
+
{"version":3,"file":"transaction-history.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,+CAAoG;AACpG,gDAA4C;AAE5C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAkB7B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAOL,YAAO,GAAY,CAAC,CAAA;QAuBpB,WAAM,GAAY,CAAC,CAAA;IAyFrB,CAAC;CAAA,CAAA;AAvHY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EA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,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBACzB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAClB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;kDAC+B;6BAtHtB,kBAAkB;IAhB9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACvG,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC;QAC1C,kBAAkB,CAAC,MAAM;QACzB,kBAAkB,CAAC,UAAU;QAC7B,kBAAkB,CAAC,OAAO;KAC3B,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CAuH9B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Transaction, TransactionCategory, TransactionStatus, TransactionType } from './transaction'\nimport { Account } from '../account/account'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_transaction_history_0',\n (transactionHistory: TransactionHistory) => [transactionHistory.originalId, transactionHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_transaction_history_1',\n (transactionHistory: TransactionHistory) => [\n transactionHistory.domain,\n transactionHistory.originalId,\n transactionHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Transaction' })\nexport class TransactionHistory implements HistoryEntityInterface<Transaction> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((transactionHistory: TransactionHistory) => transactionHistory.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n currency?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n amount?: number = 0\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n type?: TransactionType\n\n @Column({ nullable: false })\n @Field(type => TransactionCategory, { nullable: false })\n category: TransactionCategory // 트랜잭션의 카테고리 (확정, 전망)\n\n @Column({ nullable: false })\n @Field(type => TransactionStatus, { nullable: false })\n status: TransactionStatus // 트랜잭션의 상태 (예: Paid, Delayed 등)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The probability of the forecast being realized (0 to 100)' })\n probability?: number // 예측이 실현될 확률 (0 ~ 100)\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Additional notes or comments about the forecast' })\n forecastNotes?: string // 전망에 대한 추가 설명이나 메모\n\n @ManyToOne(type => Account)\n @Field({ nullable: true })\n account?: Account\n\n @RelationId((transactionHistory: TransactionHistory) => transactionHistory.account)\n accountId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal year' })\n year?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal quarter' })\n quarter?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'fiscal month' })\n month?: number\n\n @Column({ nullable: false })\n @Field({ nullable: false, description: 'The date the transaction occurs or is scheduled (in string format)' })\n transactionDate: string // 트랜잭션이 발생하거나 발생할 날짜\n\n @Column()\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((transactionHistory: TransactionHistory) => transactionHistory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((transactionHistory: TransactionHistory) => transactionHistory.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 : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
|
@@ -4,18 +4,18 @@ exports.TransactionMutation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
6
6
|
const typeorm_1 = require("typeorm");
|
7
|
-
const
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
8
8
|
const transaction_1 = require("./transaction");
|
9
9
|
const transaction_type_1 = require("./transaction-type");
|
10
10
|
let TransactionMutation = class TransactionMutation {
|
11
11
|
async createTransaction(transaction, context) {
|
12
12
|
const { domain, user, tx } = context.state;
|
13
|
-
const result = await
|
13
|
+
const result = await (0, shell_1.getRepository)(transaction_1.Transaction, tx).save(Object.assign(Object.assign({}, transaction), { domain, creator: user, updater: user }));
|
14
14
|
return result;
|
15
15
|
}
|
16
16
|
async updateTransaction(id, patch, context) {
|
17
17
|
const { domain, user, tx } = context.state;
|
18
|
-
const repository =
|
18
|
+
const repository = (0, shell_1.getRepository)(transaction_1.Transaction, tx);
|
19
19
|
const transaction = await repository.findOne({
|
20
20
|
where: { domain: { id: domain.id }, id }
|
21
21
|
});
|
@@ -27,7 +27,7 @@ let TransactionMutation = class TransactionMutation {
|
|
27
27
|
let results = [];
|
28
28
|
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
29
29
|
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
30
|
-
const transactionRepo =
|
30
|
+
const transactionRepo = (0, shell_1.getRepository)(transaction_1.Transaction, tx);
|
31
31
|
if (_createRecords.length > 0) {
|
32
32
|
for (let i = 0; i < _createRecords.length; i++) {
|
33
33
|
const newRecord = _createRecords[i];
|
@@ -47,23 +47,21 @@ let TransactionMutation = class TransactionMutation {
|
|
47
47
|
}
|
48
48
|
async deleteTransaction(id, context) {
|
49
49
|
const { domain, tx } = context.state;
|
50
|
-
await
|
51
|
-
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
|
50
|
+
await (0, shell_1.getRepository)(transaction_1.Transaction, tx).delete({ domain: { id: domain.id }, id });
|
52
51
|
return true;
|
53
52
|
}
|
54
53
|
async deleteTransactions(ids, context) {
|
55
54
|
const { domain, tx } = context.state;
|
56
|
-
await
|
55
|
+
await (0, shell_1.getRepository)(transaction_1.Transaction, tx).delete({
|
57
56
|
domain: { id: domain.id },
|
58
57
|
id: (0, typeorm_1.In)(ids)
|
59
58
|
});
|
60
|
-
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
|
61
59
|
return true;
|
62
60
|
}
|
63
61
|
async importTransactions(transactions, context) {
|
64
62
|
const { domain, tx } = context.state;
|
65
63
|
await Promise.all(transactions.map(async (transaction) => {
|
66
|
-
const createdTransaction = await
|
64
|
+
const createdTransaction = await (0, shell_1.getRepository)(transaction_1.Transaction, tx).save(Object.assign({ domain }, transaction));
|
67
65
|
}));
|
68
66
|
return true;
|
69
67
|
}
|
@@ -71,6 +69,7 @@ let TransactionMutation = class TransactionMutation {
|
|
71
69
|
exports.TransactionMutation = TransactionMutation;
|
72
70
|
tslib_1.__decorate([
|
73
71
|
(0, type_graphql_1.Directive)('@transaction'),
|
72
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
74
73
|
(0, type_graphql_1.Mutation)(returns => transaction_1.Transaction, { description: 'To create new Transaction' }),
|
75
74
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('transaction')),
|
76
75
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -80,6 +79,7 @@ tslib_1.__decorate([
|
|
80
79
|
], TransactionMutation.prototype, "createTransaction", null);
|
81
80
|
tslib_1.__decorate([
|
82
81
|
(0, type_graphql_1.Directive)('@transaction'),
|
82
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
83
83
|
(0, type_graphql_1.Mutation)(returns => transaction_1.Transaction, { description: 'To modify Transaction information' }),
|
84
84
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
85
85
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
@@ -90,6 +90,7 @@ tslib_1.__decorate([
|
|
90
90
|
], TransactionMutation.prototype, "updateTransaction", null);
|
91
91
|
tslib_1.__decorate([
|
92
92
|
(0, type_graphql_1.Directive)('@transaction'),
|
93
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
93
94
|
(0, type_graphql_1.Mutation)(returns => [transaction_1.Transaction], { description: "To modify multiple Transactions' information" }),
|
94
95
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [transaction_type_1.TransactionPatch])),
|
95
96
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -99,6 +100,7 @@ tslib_1.__decorate([
|
|
99
100
|
], TransactionMutation.prototype, "updateMultipleTransaction", null);
|
100
101
|
tslib_1.__decorate([
|
101
102
|
(0, type_graphql_1.Directive)('@transaction'),
|
103
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
102
104
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Transaction' }),
|
103
105
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
104
106
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -108,6 +110,7 @@ tslib_1.__decorate([
|
|
108
110
|
], TransactionMutation.prototype, "deleteTransaction", null);
|
109
111
|
tslib_1.__decorate([
|
110
112
|
(0, type_graphql_1.Directive)('@transaction'),
|
113
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
111
114
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Transactions' }),
|
112
115
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
113
116
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -117,6 +120,7 @@ tslib_1.__decorate([
|
|
117
120
|
], TransactionMutation.prototype, "deleteTransactions", null);
|
118
121
|
tslib_1.__decorate([
|
119
122
|
(0, type_graphql_1.Directive)('@transaction'),
|
123
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
120
124
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Transactions' }),
|
121
125
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('transactions', type => [transaction_type_1.TransactionPatch])),
|
122
126
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-mutation.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,
|
1
|
+
{"version":3,"file":"transaction-mutation.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-mutation.ts"],"names":[],"mappings":";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,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAMpD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,2DAA2D,CAAC;IACtE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,2DAA2D,CAAC;IACtE,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BAvIU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAwI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { Transaction } from './transaction'\nimport { NewTransaction, TransactionPatch } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Transaction, { description: 'To create new Transaction' })\n async createTransaction(\n @Arg('transaction') transaction: NewTransaction,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(Transaction, tx).save({\n ...transaction,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Transaction, { description: 'To modify Transaction information' })\n async updateTransaction(\n @Arg('id') id: string,\n @Arg('patch') patch: TransactionPatch,\n @Ctx() context: ResolverContext\n ): Promise<Transaction> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Transaction, tx)\n const transaction = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...transaction,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => [Transaction], { description: \"To modify multiple Transactions' information\" })\n async updateMultipleTransaction(\n @Arg('patches', type => [TransactionPatch]) patches: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Transaction[]> {\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 transactionRepo = getRepository(Transaction, 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 transactionRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const transaction = await transactionRepo.findOneBy({ id: updateRecord.id })\n\n const result = await transactionRepo.save({\n ...transaction,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete Transaction' })\n async deleteTransaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Transaction, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To delete multiple Transactions' })\n async deleteTransactions(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Transaction, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Boolean, { description: 'To import multiple Transactions' })\n async importTransactions(\n @Arg('transactions', type => [TransactionPatch]) transactions: TransactionPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n transactions.map(async (transaction: TransactionPatch) => {\n const createdTransaction: Transaction = await getRepository(Transaction, tx).save({ domain, ...transaction })\n })\n )\n\n return true\n }\n}\n"]}
|
@@ -37,6 +37,7 @@ let TransactionQuery = class TransactionQuery {
|
|
37
37
|
};
|
38
38
|
exports.TransactionQuery = TransactionQuery;
|
39
39
|
tslib_1.__decorate([
|
40
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
40
41
|
(0, type_graphql_1.Query)(returns => transaction_1.Transaction, { nullable: true, description: 'To fetch a Transaction' }),
|
41
42
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
42
43
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -45,6 +46,7 @@ tslib_1.__decorate([
|
|
45
46
|
tslib_1.__metadata("design:returntype", Promise)
|
46
47
|
], TransactionQuery.prototype, "transaction", null);
|
47
48
|
tslib_1.__decorate([
|
49
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
48
50
|
(0, type_graphql_1.Query)(returns => transaction_type_1.TransactionList, { description: 'To fetch multiple Transactions' }),
|
49
51
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
50
52
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-query.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;
|
1
|
+
{"version":3,"file":"transaction-query.js","sourceRoot":"","sources":["../../../server/service/transaction/transaction-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAwB;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,YAAY,CAAS,MAAiB,EAAS,OAAwB;QAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC;YAC5C,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAA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ChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;2BAzCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,gBAAgB,CA0C5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Transaction } from './transaction'\nimport { TransactionList } from './transaction-type'\n\n@Resolver(Transaction)\nexport class TransactionQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => Transaction!, { nullable: true, description: 'To fetch a Transaction' })\n async transaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Transaction> {\n const { domain } = context.state\n\n return await getRepository(Transaction).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\")')\n @Query(returns => TransactionList, { description: 'To fetch multiple Transactions' })\n async transactions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TransactionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Transaction),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() transaction: Transaction): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: transaction.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() transaction: Transaction): Promise<User> {\n return await getRepository(User).findOneBy({ id: transaction.creatorId })\n }\n}\n"]}
|
@@ -1,12 +1,28 @@
|
|
1
1
|
import { Domain } from '@things-factory/shell';
|
2
2
|
import { User } from '@things-factory/auth-base';
|
3
3
|
import { Account } from '../account/account';
|
4
|
+
import { Payment } from '../payment/payment';
|
5
|
+
import { AccountingDocument } from '../accounting-document/accounting-document';
|
4
6
|
export declare enum TransactionType {
|
5
|
-
|
6
|
-
|
7
|
-
Asset = 2
|
8
|
-
Liability = 3
|
9
|
-
Equity = 4
|
7
|
+
SalesIncome = 0,// 매출
|
8
|
+
PurchaseExpense = 1,// 매입
|
9
|
+
Asset = 2,// 자산
|
10
|
+
Liability = 3,// 부채
|
11
|
+
Equity = 4,// 자본
|
12
|
+
OtherIncome = 5,// 기타 수익
|
13
|
+
OtherExpense = 6
|
14
|
+
}
|
15
|
+
export declare enum TransactionCategory {
|
16
|
+
Confirmed = "Confirmed",// 확정된 건
|
17
|
+
Forecast = "Forecast"
|
18
|
+
}
|
19
|
+
export declare enum TransactionStatus {
|
20
|
+
Pending = "Pending",// 처리 대기 중
|
21
|
+
Paid = "Paid",// 전액 결제됨
|
22
|
+
PartiallyPaid = "PartiallyPaid",// 일부만 결제됨
|
23
|
+
Cancelled = "Cancelled",// 취소됨
|
24
|
+
Delayed = "Delayed",// 지연됨
|
25
|
+
ForecastFailed = "ForecastFailed"
|
10
26
|
}
|
11
27
|
export declare class Transaction {
|
12
28
|
readonly id: string;
|
@@ -19,12 +35,18 @@ export declare class Transaction {
|
|
19
35
|
amount?: number;
|
20
36
|
active?: boolean;
|
21
37
|
type?: TransactionType;
|
38
|
+
category: TransactionCategory;
|
39
|
+
status: TransactionStatus;
|
40
|
+
probability?: number;
|
41
|
+
forecastNotes?: string;
|
22
42
|
account?: Account;
|
23
43
|
accountId?: string;
|
24
44
|
year?: number;
|
25
45
|
quarter?: number;
|
26
46
|
month?: number;
|
27
|
-
|
47
|
+
transactionDate: string;
|
48
|
+
payments?: Payment[];
|
49
|
+
documents?: AccountingDocument[];
|
28
50
|
createdAt?: Date;
|
29
51
|
updatedAt?: Date;
|
30
52
|
deletedAt?: Date;
|