@things-factory/accounting 8.0.0-alpha.1 → 8.0.0-alpha.12
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/bank/bank-importer.ts +90 -0
- package/client/pages/{ledger/ledger-list-page.ts → bank/bank-list-page.ts} +118 -57
- package/client/pages/{ledger/ledger-importer.ts → bank-account/bank-account-importer.ts} +10 -17
- package/client/pages/bank-account/bank-account-list-page.ts +398 -0
- package/client/pages/financial-institution/financial-institution-importer.ts +90 -0
- package/client/pages/financial-institution/financial-institution-list-page.ts +398 -0
- package/client/pages/payment/payment-importer.ts +90 -0
- package/client/pages/payment/payment-list-page.ts +398 -0
- 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 → bank/bank-importer.d.ts} +3 -2
- package/dist-client/pages/{ledger/ledger-importer.js → bank/bank-importer.js} +14 -21
- package/dist-client/pages/bank/bank-importer.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-list-page.d.ts → bank/bank-list-page.d.ts} +12 -8
- package/dist-client/pages/{ledger/ledger-list-page.js → bank/bank-list-page.js} +114 -67
- package/dist-client/pages/bank/bank-list-page.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
- package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
- package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
- package/dist-client/pages/payment/payment-importer.d.ts +23 -0
- package/dist-client/pages/payment/payment-importer.js +93 -0
- package/dist-client/pages/payment/payment-importer.js.map +1 -0
- package/dist-client/pages/payment/payment-list-page.d.ts +66 -0
- package/dist-client/pages/payment/payment-list-page.js +370 -0
- 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/migrations/1725201567284-seed-country-codes.d.ts +5 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
- 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/bank-account/bank-account-history.d.ts +34 -0
- package/dist-server/service/bank-account/bank-account-history.js +172 -0
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
- package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
- package/dist-server/service/bank-account/bank-account-query.js +79 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
- package/dist-server/service/bank-account/bank-account-type.js +153 -0
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
- package/dist-server/service/bank-account/bank-account.d.ts +38 -0
- package/dist-server/service/bank-account/bank-account.js +164 -0
- package/dist-server/service/bank-account/bank-account.js.map +1 -0
- package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
- package/dist-server/service/bank-account/event-subscriber.js +21 -0
- package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
- package/dist-server/service/bank-account/index.d.ts +7 -0
- package/dist-server/service/bank-account/index.js +12 -0
- package/dist-server/service/bank-account/index.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
- package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
- package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
- package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
- package/dist-server/service/financial-institution/financial-institution.js +137 -0
- package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
- package/dist-server/service/financial-institution/index.d.ts +6 -0
- package/dist-server/service/financial-institution/index.js +10 -0
- package/dist-server/service/financial-institution/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 +7 -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 +37 -0
- package/dist-server/service/payment/payment-history.js +174 -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 +30 -0
- package/dist-server/service/payment/payment-type.js +114 -0
- package/dist-server/service/payment/payment-type.js.map +1 -0
- package/dist-server/service/payment/payment.d.ts +42 -0
- package/dist-server/service/payment/payment.js +181 -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/bank-account.md +160 -0
- package/helps/accounting/bank.md +160 -0
- package/helps/accounting/contract.md +160 -0
- package/helps/accounting/financial-institution.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/migrations/1725201567284-seed-country-codes.ts +261 -0
- package/server/migrations/1725201667385-seed-financial-institutions.ts +348 -0
- 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/bank-account/bank-account-history.ts +149 -0
- package/server/service/bank-account/bank-account-mutation.ts +137 -0
- package/server/service/bank-account/bank-account-query.ts +48 -0
- package/server/service/bank-account/bank-account-type.ts +112 -0
- package/server/service/bank-account/bank-account.ts +142 -0
- package/server/service/bank-account/event-subscriber.ts +17 -0
- package/server/service/bank-account/index.ts +9 -0
- package/server/service/financial-institution/financial-institution-mutation.ts +198 -0
- package/server/service/financial-institution/financial-institution-query.ts +62 -0
- package/server/service/financial-institution/financial-institution-type.ts +91 -0
- package/server/service/financial-institution/financial-institution.ts +122 -0
- package/server/service/financial-institution/index.ts +7 -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 +149 -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 +82 -0
- package/server/service/payment/payment.ts +154 -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,84 @@
|
|
1
|
+
import {
|
2
|
+
CreateDateColumn,
|
3
|
+
UpdateDateColumn,
|
4
|
+
DeleteDateColumn,
|
5
|
+
Entity,
|
6
|
+
Index,
|
7
|
+
Column,
|
8
|
+
RelationId,
|
9
|
+
ManyToOne,
|
10
|
+
PrimaryGeneratedColumn,
|
11
|
+
VersionColumn
|
12
|
+
} from 'typeorm'
|
13
|
+
import { ObjectType, Field, ID } from 'type-graphql'
|
14
|
+
|
15
|
+
import { Domain } from '@things-factory/shell'
|
16
|
+
import { User } from '@things-factory/auth-base'
|
17
|
+
import { Account } from '../account/account'
|
18
|
+
import { IncomeStatement } from './income-statement'
|
19
|
+
|
20
|
+
@ObjectType({
|
21
|
+
description: 'Line item for an income statement, representing a detailed breakdown of financial accounts'
|
22
|
+
})
|
23
|
+
@Entity()
|
24
|
+
@Index(
|
25
|
+
'ix_income_statement_line_item_0',
|
26
|
+
(lineItem: IncomeStatementLineItem) => [lineItem.statement, lineItem.account],
|
27
|
+
{
|
28
|
+
unique: false,
|
29
|
+
where: '"deleted_at" IS NULL'
|
30
|
+
}
|
31
|
+
)
|
32
|
+
export class IncomeStatementLineItem {
|
33
|
+
@PrimaryGeneratedColumn('uuid')
|
34
|
+
@Field(type => ID)
|
35
|
+
readonly id: string
|
36
|
+
|
37
|
+
@ManyToOne(type => IncomeStatement, statement => statement.lineItems)
|
38
|
+
@Field(type => IncomeStatement, { description: 'The income statement this line item belongs to' })
|
39
|
+
statement: IncomeStatement // 해당 라인 아이템이 속한 손익계산서
|
40
|
+
|
41
|
+
@RelationId((lineItem: IncomeStatementLineItem) => lineItem.statement)
|
42
|
+
statementId: string // 손익계산서의 ID
|
43
|
+
|
44
|
+
@ManyToOne(type => Account)
|
45
|
+
@Field(type => Account, { description: 'The financial account associated with this line item' })
|
46
|
+
account: Account // 라인 아이템에 연결된 계정
|
47
|
+
|
48
|
+
@RelationId((lineItem: IncomeStatementLineItem) => lineItem.account)
|
49
|
+
accountId: string // 계정의 ID
|
50
|
+
|
51
|
+
@Column({ nullable: false })
|
52
|
+
@Field({ nullable: false, description: 'The monetary amount associated with this account for the income statement' })
|
53
|
+
amount: number // 계정과 관련된 금액
|
54
|
+
|
55
|
+
@Column({ nullable: true })
|
56
|
+
@Field({ nullable: true, description: 'Optional description or notes about this line item' })
|
57
|
+
description?: string // 라인 아이템에 대한 선택적 설명 또는 메모
|
58
|
+
|
59
|
+
@CreateDateColumn()
|
60
|
+
@Field({ nullable: true, description: 'The date and time when this line item was created' })
|
61
|
+
createdAt?: Date // 라인 아이템이 생성된 날짜 및 시간
|
62
|
+
|
63
|
+
@UpdateDateColumn()
|
64
|
+
@Field({ nullable: true, description: 'The date and time when this line item was last updated' })
|
65
|
+
updatedAt?: Date // 라인 아이템이 마지막으로 업데이트된 날짜 및 시간
|
66
|
+
|
67
|
+
@DeleteDateColumn()
|
68
|
+
@Field({ nullable: true, description: 'The date and time when this line item was deleted' })
|
69
|
+
deletedAt?: Date // 라인 아이템이 삭제된 날짜 및 시간
|
70
|
+
|
71
|
+
@ManyToOne(type => User, { nullable: true })
|
72
|
+
@Field(type => User, { nullable: true, description: 'The user who created this line item' })
|
73
|
+
creator?: User // 라인 아이템을 생성한 사용자
|
74
|
+
|
75
|
+
@RelationId((lineItem: IncomeStatementLineItem) => lineItem.creator)
|
76
|
+
creatorId?: string // 생성자의 ID
|
77
|
+
|
78
|
+
@ManyToOne(type => User, { nullable: true })
|
79
|
+
@Field(type => User, { nullable: true, description: 'The user who last updated this line item' })
|
80
|
+
updater?: User // 라인 아이템을 마지막으로 업데이트한 사용자
|
81
|
+
|
82
|
+
@RelationId((lineItem: IncomeStatementLineItem) => lineItem.updater)
|
83
|
+
updaterId?: string // 업데이트한 사용자의 ID
|
84
|
+
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
2
|
import { In } from 'typeorm'
|
3
|
-
|
4
|
-
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
3
|
+
import { getRepository } from '@things-factory/shell'
|
5
4
|
|
6
5
|
import { IncomeStatement } from './income-statement'
|
7
6
|
import { NewIncomeStatement, IncomeStatementPatch } from './income-statement-type'
|
@@ -9,6 +8,7 @@ import { NewIncomeStatement, IncomeStatementPatch } from './income-statement-typ
|
|
9
8
|
@Resolver(IncomeStatement)
|
10
9
|
export class IncomeStatementMutation {
|
11
10
|
@Directive('@transaction')
|
11
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
12
|
@Mutation(returns => IncomeStatement, { description: 'To create new IncomeStatement' })
|
13
13
|
async createIncomeStatement(
|
14
14
|
@Arg('incomeStatement') incomeStatement: NewIncomeStatement,
|
@@ -16,7 +16,7 @@ export class IncomeStatementMutation {
|
|
16
16
|
): Promise<IncomeStatement> {
|
17
17
|
const { domain, user, tx } = context.state
|
18
18
|
|
19
|
-
const result = await
|
19
|
+
const result = await getRepository(IncomeStatement, tx).save({
|
20
20
|
...incomeStatement,
|
21
21
|
domain,
|
22
22
|
creator: user,
|
@@ -27,6 +27,7 @@ export class IncomeStatementMutation {
|
|
27
27
|
}
|
28
28
|
|
29
29
|
@Directive('@transaction')
|
30
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
30
31
|
@Mutation(returns => IncomeStatement, { description: 'To modify IncomeStatement information' })
|
31
32
|
async updateIncomeStatement(
|
32
33
|
@Arg('id') id: string,
|
@@ -35,7 +36,7 @@ export class IncomeStatementMutation {
|
|
35
36
|
): Promise<IncomeStatement> {
|
36
37
|
const { domain, user, tx } = context.state
|
37
38
|
|
38
|
-
const repository =
|
39
|
+
const repository = getRepository(IncomeStatement, tx)
|
39
40
|
const incomeStatement = await repository.findOne({
|
40
41
|
where: { domain: { id: domain.id }, id }
|
41
42
|
})
|
@@ -50,6 +51,7 @@ export class IncomeStatementMutation {
|
|
50
51
|
}
|
51
52
|
|
52
53
|
@Directive('@transaction')
|
54
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
53
55
|
@Mutation(returns => [IncomeStatement], { description: "To modify multiple IncomeStatements' information" })
|
54
56
|
async updateMultipleIncomeStatement(
|
55
57
|
@Arg('patches', type => [IncomeStatementPatch]) patches: IncomeStatementPatch[],
|
@@ -60,7 +62,7 @@ export class IncomeStatementMutation {
|
|
60
62
|
let results = []
|
61
63
|
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
62
64
|
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
63
|
-
const incomeStatementRepo =
|
65
|
+
const incomeStatementRepo = getRepository(IncomeStatement, tx)
|
64
66
|
|
65
67
|
if (_createRecords.length > 0) {
|
66
68
|
for (let i = 0; i < _createRecords.length; i++) {
|
@@ -96,17 +98,18 @@ export class IncomeStatementMutation {
|
|
96
98
|
}
|
97
99
|
|
98
100
|
@Directive('@transaction')
|
101
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
99
102
|
@Mutation(returns => Boolean, { description: 'To delete IncomeStatement' })
|
100
103
|
async deleteIncomeStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
101
104
|
const { domain, tx } = context.state
|
102
105
|
|
103
|
-
await
|
104
|
-
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
106
|
+
await getRepository(IncomeStatement, tx).delete({ domain: { id: domain.id }, id })
|
105
107
|
|
106
108
|
return true
|
107
109
|
}
|
108
110
|
|
109
111
|
@Directive('@transaction')
|
112
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
110
113
|
@Mutation(returns => Boolean, { description: 'To delete multiple IncomeStatements' })
|
111
114
|
async deleteIncomeStatements(
|
112
115
|
@Arg('ids', type => [String]) ids: string[],
|
@@ -114,17 +117,16 @@ export class IncomeStatementMutation {
|
|
114
117
|
): Promise<boolean> {
|
115
118
|
const { domain, tx } = context.state
|
116
119
|
|
117
|
-
await
|
120
|
+
await getRepository(IncomeStatement, tx).delete({
|
118
121
|
domain: { id: domain.id },
|
119
122
|
id: In(ids)
|
120
123
|
})
|
121
124
|
|
122
|
-
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
123
|
-
|
124
125
|
return true
|
125
126
|
}
|
126
127
|
|
127
128
|
@Directive('@transaction')
|
129
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
128
130
|
@Mutation(returns => Boolean, { description: 'To import multiple IncomeStatements' })
|
129
131
|
async importIncomeStatements(
|
130
132
|
@Arg('incomeStatements', type => [IncomeStatementPatch]) incomeStatements: IncomeStatementPatch[],
|
@@ -6,6 +6,7 @@ import { IncomeStatementList } from './income-statement-type'
|
|
6
6
|
|
7
7
|
@Resolver(IncomeStatement)
|
8
8
|
export class IncomeStatementQuery {
|
9
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
9
10
|
@Query(returns => IncomeStatement!, { nullable: true, description: 'To fetch a IncomeStatement' })
|
10
11
|
async incomeStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<IncomeStatement> {
|
11
12
|
const { domain } = context.state
|
@@ -15,6 +16,7 @@ export class IncomeStatementQuery {
|
|
15
16
|
})
|
16
17
|
}
|
17
18
|
|
19
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
18
20
|
@Query(returns => IncomeStatementList, { description: 'To fetch multiple IncomeStatements' })
|
19
21
|
async incomeStatements(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<IncomeStatementList> {
|
20
22
|
const { domain } = context.state
|
@@ -7,14 +7,17 @@ import {
|
|
7
7
|
Column,
|
8
8
|
RelationId,
|
9
9
|
ManyToOne,
|
10
|
+
OneToMany,
|
10
11
|
PrimaryGeneratedColumn,
|
11
12
|
VersionColumn
|
12
13
|
} from 'typeorm'
|
13
|
-
import { ObjectType, Field,
|
14
|
+
import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
|
14
15
|
|
15
16
|
import { Domain } from '@things-factory/shell'
|
16
17
|
import { User } from '@things-factory/auth-base'
|
17
18
|
|
19
|
+
import { IncomeStatementLineItem } from './income-statement-line-item'
|
20
|
+
|
18
21
|
export enum IncomeStatementStatus {
|
19
22
|
STATUS_A = 'STATUS_A',
|
20
23
|
STATUS_B = 'STATUS_B'
|
@@ -22,84 +25,96 @@ export enum IncomeStatementStatus {
|
|
22
25
|
|
23
26
|
registerEnumType(IncomeStatementStatus, {
|
24
27
|
name: 'IncomeStatementStatus',
|
25
|
-
description: '
|
28
|
+
description: 'State enumeration of an income statement' // 손익계산서의 상태 열거형
|
26
29
|
})
|
27
30
|
|
28
|
-
// 손익계산서
|
31
|
+
// 손익계산서 (Income Statement)
|
29
32
|
@Entity()
|
30
33
|
@Index(
|
31
34
|
'ix_income_statement_0',
|
32
|
-
(incomeStatement: IncomeStatement) => [
|
33
|
-
|
35
|
+
(incomeStatement: IncomeStatement) => [
|
36
|
+
incomeStatement.domain,
|
37
|
+
incomeStatement.year,
|
38
|
+
incomeStatement.quarter,
|
39
|
+
incomeStatement.month
|
40
|
+
],
|
41
|
+
{
|
42
|
+
unique: true,
|
43
|
+
where: '"deleted_at" IS NULL' // 삭제되지 않은 경우에만 유니크
|
44
|
+
}
|
34
45
|
)
|
35
|
-
@ObjectType({ description: 'Entity for IncomeStatement' })
|
46
|
+
@ObjectType({ description: 'Entity for IncomeStatement, representing the profit and loss report' }) // 손익계산서 엔티티
|
36
47
|
export class IncomeStatement {
|
37
48
|
@PrimaryGeneratedColumn('uuid')
|
38
|
-
@Field(type => ID)
|
39
|
-
readonly id: string
|
49
|
+
@Field(type => ID, { description: 'Unique identifier for the income statement' })
|
50
|
+
readonly id: string // 고유 식별자 (UUID)
|
40
51
|
|
41
52
|
@VersionColumn()
|
42
|
-
@Field({ nullable: true })
|
43
|
-
version?: number = 1
|
53
|
+
@Field({ nullable: true, description: 'Version number for optimistic locking' })
|
54
|
+
version?: number = 1 // 낙관적 잠금을 위한 버전 관리 필드
|
44
55
|
|
45
56
|
@ManyToOne(type => Domain)
|
46
|
-
@Field({ nullable: true })
|
47
|
-
domain?: Domain
|
57
|
+
@Field({ nullable: true, description: 'The domain to which this income statement belongs' })
|
58
|
+
domain?: Domain // 이 손익계산서가 속한 도메인
|
48
59
|
|
49
60
|
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.domain)
|
50
|
-
domainId?: string
|
61
|
+
domainId?: string // 도메인의 ID
|
51
62
|
|
52
63
|
@Column({ nullable: true })
|
53
|
-
@Field({ nullable: true, description: '
|
54
|
-
year?: number
|
64
|
+
@Field({ nullable: true, description: 'Fiscal year of the income statement' })
|
65
|
+
year?: number // 회계 연도
|
55
66
|
|
56
67
|
@Column({ nullable: true })
|
57
|
-
@Field({ nullable: true, description: '
|
58
|
-
quarter?: number
|
68
|
+
@Field({ nullable: true, description: 'Fiscal quarter of the income statement' })
|
69
|
+
quarter?: number // 회계 분기
|
59
70
|
|
60
71
|
@Column({ nullable: true })
|
61
|
-
@Field({ nullable: true, description: '
|
62
|
-
month?: number
|
72
|
+
@Field({ nullable: true, description: 'Fiscal month of the income statement' })
|
73
|
+
month?: number // 회계 월
|
63
74
|
|
64
75
|
@Column({ nullable: true })
|
65
|
-
@Field({ nullable: true })
|
66
|
-
revenue?: number
|
76
|
+
@Field({ nullable: true, description: 'Total revenue recorded in the income statement' })
|
77
|
+
revenue?: number // 손익계산서에 기록된 총수익
|
67
78
|
|
68
79
|
@Column({ nullable: true })
|
69
|
-
@Field({ nullable: true })
|
70
|
-
expense?: number
|
80
|
+
@Field({ nullable: true, description: 'Total expenses recorded in the income statement' })
|
81
|
+
expense?: number // 손익계산서에 기록된 총비용
|
71
82
|
|
72
83
|
@Column({ nullable: true })
|
73
|
-
@Field({ nullable: true })
|
74
|
-
netIncome?: number
|
84
|
+
@Field({ nullable: true, description: 'Net income calculated as revenue minus expenses' })
|
85
|
+
netIncome?: number // 총수익에서 총비용을 뺀 순이익
|
75
86
|
|
76
87
|
@Column({ nullable: true })
|
77
|
-
@Field({ nullable: true })
|
78
|
-
active?: boolean
|
88
|
+
@Field({ nullable: true, description: 'Indicates whether this income statement is active' })
|
89
|
+
active?: boolean // 이 손익계산서가 활성 상태인지 여부
|
90
|
+
|
91
|
+
@OneToMany(type => IncomeStatementLineItem, lineItem => lineItem.statement)
|
92
|
+
@Field(type => [IncomeStatementLineItem], { nullable: true })
|
93
|
+
lineItems?: IncomeStatementLineItem[] // 계정별 브레이크다운
|
79
94
|
|
80
95
|
@CreateDateColumn()
|
81
|
-
@Field({ nullable: true })
|
82
|
-
createdAt?: Date
|
96
|
+
@Field({ nullable: true, description: 'The date and time when the income statement was created' })
|
97
|
+
createdAt?: Date // 손익계산서가 생성된 날짜 및 시간
|
83
98
|
|
84
99
|
@UpdateDateColumn()
|
85
|
-
@Field({ nullable: true })
|
86
|
-
updatedAt?: Date
|
100
|
+
@Field({ nullable: true, description: 'The date and time when the income statement was last updated' })
|
101
|
+
updatedAt?: Date // 손익계산서가 마지막으로 업데이트된 날짜 및 시간
|
87
102
|
|
88
103
|
@DeleteDateColumn()
|
89
|
-
@Field({ nullable: true })
|
90
|
-
deletedAt?: Date
|
104
|
+
@Field({ nullable: true, description: 'The date and time when the income statement was deleted' })
|
105
|
+
deletedAt?: Date // 손익계산서가 삭제된 날짜 및 시간
|
91
106
|
|
92
107
|
@ManyToOne(type => User, { nullable: true })
|
93
|
-
@Field(type => User, { nullable: true })
|
94
|
-
creator?: User
|
108
|
+
@Field(type => User, { nullable: true, description: 'The user who created the income statement' })
|
109
|
+
creator?: User // 손익계산서를 생성한 사용자
|
95
110
|
|
96
111
|
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.creator)
|
97
|
-
creatorId?: string
|
112
|
+
creatorId?: string // 손익계산서를 생성한 사용자의 ID
|
98
113
|
|
99
114
|
@ManyToOne(type => User, { nullable: true })
|
100
|
-
@Field(type => User, { nullable: true })
|
101
|
-
updater?: User
|
115
|
+
@Field(type => User, { nullable: true, description: 'The user who last updated the income statement' })
|
116
|
+
updater?: User // 손익계산서를 마지막으로 업데이트한 사용자
|
102
117
|
|
103
118
|
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.updater)
|
104
|
-
updaterId?: string
|
119
|
+
updaterId?: string // 손익계산서를 업데이트한 사용자의 ID
|
105
120
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { IncomeStatement } from './income-statement'
|
2
|
+
import { IncomeStatementLineItem } from './income-statement-line-item'
|
2
3
|
import { IncomeStatementHistory } from './income-statement-history'
|
3
4
|
import { IncomeStatementQuery } from './income-statement-query'
|
4
5
|
import { IncomeStatementMutation } from './income-statement-mutation'
|
5
6
|
import { IncomeStatementHistoryEntitySubscriber } from './event-subscriber'
|
6
7
|
|
7
|
-
export const entities = [IncomeStatement, IncomeStatementHistory]
|
8
|
+
export const entities = [IncomeStatement, IncomeStatementLineItem, IncomeStatementHistory]
|
8
9
|
export const resolvers = [IncomeStatementQuery, IncomeStatementMutation]
|
9
10
|
export const subscribers = [IncomeStatementHistoryEntitySubscriber]
|
package/server/service/index.ts
CHANGED
@@ -3,7 +3,9 @@ export * from './income-statement/income-statement'
|
|
3
3
|
export * from './financial-statement/financial-statement'
|
4
4
|
export * from './accounting-category/accounting-category'
|
5
5
|
export * from './transaction/transaction'
|
6
|
+
export * from './payment/payment'
|
6
7
|
export * from './account/account'
|
8
|
+
export * from './accounting-document/accounting-document'
|
7
9
|
export * from './fiscal-month/fiscal-month'
|
8
10
|
export * from './fiscal-quarter/fiscal-quarter'
|
9
11
|
export * from './fiscal-year/fiscal-year'
|
@@ -29,11 +31,21 @@ import {
|
|
29
31
|
resolvers as TransactionResolvers,
|
30
32
|
subscribers as TransactionSubscribers
|
31
33
|
} from './transaction'
|
34
|
+
import {
|
35
|
+
entities as PaymentEntities,
|
36
|
+
resolvers as PaymentResolvers,
|
37
|
+
subscribers as PaymentSubscribers
|
38
|
+
} from './payment'
|
32
39
|
import {
|
33
40
|
entities as AccountEntities,
|
34
41
|
resolvers as AccountResolvers,
|
35
42
|
subscribers as AccountSubscribers
|
36
43
|
} from './account'
|
44
|
+
import {
|
45
|
+
entities as AccountingDocumentEntities,
|
46
|
+
resolvers as AccountingDocumentResolvers,
|
47
|
+
subscribers as AccountingDocumentSubscribers
|
48
|
+
} from './accounting-document'
|
37
49
|
import {
|
38
50
|
entities as FiscalMonthEntities,
|
39
51
|
resolvers as FiscalMonthResolvers,
|
@@ -57,6 +69,8 @@ export const entities = [
|
|
57
69
|
...AccountingCategoryEntities,
|
58
70
|
...TransactionEntities,
|
59
71
|
...AccountEntities,
|
72
|
+
...AccountingDocumentEntities,
|
73
|
+
...PaymentEntities,
|
60
74
|
...FiscalMonthEntities,
|
61
75
|
...FiscalQuarterEntities,
|
62
76
|
...FiscalYearEntities
|
@@ -68,7 +82,9 @@ export const subscribers = [
|
|
68
82
|
...FinancialStatementSubscribers,
|
69
83
|
...AccountingCategorySubscribers,
|
70
84
|
...TransactionSubscribers,
|
85
|
+
...PaymentSubscribers,
|
71
86
|
...AccountSubscribers,
|
87
|
+
...AccountingDocumentSubscribers,
|
72
88
|
...FiscalYearSubscribers,
|
73
89
|
...FiscalMonthSubscribers,
|
74
90
|
...FiscalQuarterSubscribers,
|
@@ -82,7 +98,9 @@ export const schema = {
|
|
82
98
|
...FinancialStatementResolvers,
|
83
99
|
...AccountingCategoryResolvers,
|
84
100
|
...TransactionResolvers,
|
101
|
+
...PaymentResolvers,
|
85
102
|
...AccountResolvers,
|
103
|
+
...AccountingDocumentResolvers,
|
86
104
|
...FiscalMonthResolvers,
|
87
105
|
...FiscalQuarterResolvers,
|
88
106
|
...FiscalYearResolvers
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { EventSubscriber } from 'typeorm'
|
2
|
+
|
3
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
4
|
+
|
5
|
+
import { Payment } from './payment'
|
6
|
+
import { PaymentHistory } from './payment-history'
|
7
|
+
|
8
|
+
@EventSubscriber()
|
9
|
+
export class PaymentHistoryEntitySubscriber extends HistoryEntitySubscriber<Payment, PaymentHistory> {
|
10
|
+
public get entity() {
|
11
|
+
return Payment
|
12
|
+
}
|
13
|
+
|
14
|
+
public get historyEntity() {
|
15
|
+
return PaymentHistory
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Payment } from './payment'
|
2
|
+
import { PaymentHistory } from './payment-history'
|
3
|
+
import { PaymentHistoryEntitySubscriber } from './event-subscriber'
|
4
|
+
import { PaymentQuery } from './payment-query'
|
5
|
+
import { PaymentMutation } from './payment-mutation'
|
6
|
+
|
7
|
+
export const entities = [Payment, PaymentHistory]
|
8
|
+
export const resolvers = [PaymentQuery, PaymentMutation]
|
9
|
+
export const subscribers = [PaymentHistoryEntitySubscriber]
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
2
|
+
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
|
3
|
+
|
4
|
+
import {
|
5
|
+
HistoryActionColumn,
|
6
|
+
HistoryActionType,
|
7
|
+
HistoryEntityInterface,
|
8
|
+
HistoryOriginalIdColumn
|
9
|
+
} from '@operato/typeorm-history'
|
10
|
+
import { Role, User } from '@things-factory/auth-base'
|
11
|
+
import { config } from '@things-factory/env'
|
12
|
+
import { Domain } from '@things-factory/shell'
|
13
|
+
|
14
|
+
import { Transaction } from '../transaction/transaction'
|
15
|
+
import { Payment, PaymentDirection, PaymentType } from './payment'
|
16
|
+
import { BankAccount } from 'service/bank-account/bank-account'
|
17
|
+
|
18
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
19
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
20
|
+
|
21
|
+
@Entity()
|
22
|
+
@Index(
|
23
|
+
'ix_payment_history_0',
|
24
|
+
(paymentHistory: PaymentHistory) => [paymentHistory.originalId, paymentHistory.version],
|
25
|
+
{ unique: true }
|
26
|
+
)
|
27
|
+
@Index(
|
28
|
+
'ix_payment_history_1',
|
29
|
+
(paymentHistory: PaymentHistory) => [paymentHistory.domain, paymentHistory.originalId, paymentHistory.version],
|
30
|
+
{ unique: true }
|
31
|
+
)
|
32
|
+
@ObjectType({ description: 'History Entity of Payment' })
|
33
|
+
export class PaymentHistory implements HistoryEntityInterface<Payment> {
|
34
|
+
@PrimaryGeneratedColumn('uuid')
|
35
|
+
@Field(type => ID)
|
36
|
+
readonly id: string
|
37
|
+
|
38
|
+
@Column({ nullable: true, default: 1 })
|
39
|
+
@Field({ nullable: true })
|
40
|
+
version?: number = 1
|
41
|
+
|
42
|
+
@ManyToOne(type => Domain)
|
43
|
+
@Field({ nullable: true })
|
44
|
+
domain?: Domain
|
45
|
+
|
46
|
+
@RelationId((payment: Payment) => payment.domain)
|
47
|
+
domainId?: string
|
48
|
+
|
49
|
+
@ManyToOne(type => Transaction, transaction => transaction.payments)
|
50
|
+
@Field(type => Transaction, { description: 'The transaction associated with this payment' })
|
51
|
+
transaction: Transaction // 결제와 연결된 트랜잭션
|
52
|
+
|
53
|
+
@RelationId((payment: Payment) => payment.transaction)
|
54
|
+
transactionId: string // 연결된 트랜잭션의 ID
|
55
|
+
|
56
|
+
@Column({ nullable: true })
|
57
|
+
@Field({ nullable: true, description: 'The currency used in the payment' })
|
58
|
+
currency?: string // 결제에 사용된 통화
|
59
|
+
|
60
|
+
@Column({ nullable: false })
|
61
|
+
@Field({ nullable: false, description: 'The amount of money involved in the payment' })
|
62
|
+
amount: number // 결제된 금액
|
63
|
+
|
64
|
+
@Column({ type: 'enum', enum: PaymentType, nullable: false })
|
65
|
+
@Field(type => PaymentType, { description: 'Type of the payment' })
|
66
|
+
paymentType: PaymentType // 결제 유형
|
67
|
+
|
68
|
+
@ManyToOne(type => BankAccount, { nullable: true })
|
69
|
+
@Field(type => BankAccount, { nullable: true, description: 'Source bank account for the payment' })
|
70
|
+
sourceBankAccount?: BankAccount
|
71
|
+
|
72
|
+
@RelationId((payment: Payment) => payment.sourceBankAccount)
|
73
|
+
sourceBankAccountId?: string
|
74
|
+
|
75
|
+
@ManyToOne(type => BankAccount, { nullable: true })
|
76
|
+
@Field(type => BankAccount, { nullable: true, description: 'Destination bank account for the payment' })
|
77
|
+
destinationBankAccount?: BankAccount
|
78
|
+
|
79
|
+
@RelationId((payment: Payment) => payment.destinationBankAccount)
|
80
|
+
destinationBankAccountId?: string
|
81
|
+
|
82
|
+
@Column({ nullable: true })
|
83
|
+
@Field({ nullable: true, description: 'Fiscal year in which the payment was made' })
|
84
|
+
year?: number // 결제가 발생한 회계 연도
|
85
|
+
|
86
|
+
@Column({ nullable: true })
|
87
|
+
@Field({ nullable: true, description: 'Fiscal quarter in which the payment was made' })
|
88
|
+
quarter?: number // 결제가 발생한 회계 분기
|
89
|
+
|
90
|
+
@Column({ nullable: true })
|
91
|
+
@Field({ nullable: true, description: 'Fiscal month in which the payment was made' })
|
92
|
+
month?: number // 결제가 발생한 회계 월
|
93
|
+
|
94
|
+
@Column({ nullable: false })
|
95
|
+
@Field({ nullable: false, description: 'The date and time when the payment was made' })
|
96
|
+
paidAt: Date // 결제가 이루어진 날짜 및 시간
|
97
|
+
|
98
|
+
@Column({ nullable: false })
|
99
|
+
@Field(type => PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' })
|
100
|
+
direction: PaymentDirection // 결제 방향 (수금 또는 지출)
|
101
|
+
|
102
|
+
@Column({ nullable: true })
|
103
|
+
@Field({ nullable: true, description: 'Additional notes or comments about the payment' })
|
104
|
+
note?: string // 결제에 대한 추가 설명 또는 메모
|
105
|
+
|
106
|
+
@Column({ nullable: true })
|
107
|
+
@Field({ nullable: true })
|
108
|
+
createdAt?: Date
|
109
|
+
|
110
|
+
@Column({ nullable: true })
|
111
|
+
@Field({ nullable: true })
|
112
|
+
updatedAt?: Date
|
113
|
+
|
114
|
+
@Column({ nullable: true })
|
115
|
+
@Field({ nullable: true })
|
116
|
+
deletedAt?: Date
|
117
|
+
|
118
|
+
@ManyToOne(type => User, { nullable: true })
|
119
|
+
@Field(type => User, { nullable: true })
|
120
|
+
creator?: User
|
121
|
+
|
122
|
+
@RelationId((payment: Payment) => payment.creator)
|
123
|
+
creatorId?: string
|
124
|
+
|
125
|
+
@ManyToOne(type => User, { nullable: true })
|
126
|
+
@Field(type => User, { nullable: true })
|
127
|
+
updater?: User
|
128
|
+
|
129
|
+
@RelationId((payment: Payment) => payment.updater)
|
130
|
+
updaterId?: string
|
131
|
+
|
132
|
+
@Field(type => String, { nullable: true })
|
133
|
+
thumbnail?: string
|
134
|
+
|
135
|
+
@HistoryOriginalIdColumn()
|
136
|
+
public originalId!: string
|
137
|
+
|
138
|
+
@HistoryActionColumn({
|
139
|
+
nullable: false,
|
140
|
+
type:
|
141
|
+
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
142
|
+
? 'enum'
|
143
|
+
: DATABASE_TYPE == 'oracle'
|
144
|
+
? 'varchar2'
|
145
|
+
: 'smallint',
|
146
|
+
enum: HistoryActionType
|
147
|
+
})
|
148
|
+
public action!: HistoryActionType
|
149
|
+
}
|