@things-factory/accounting 7.0.6 → 7.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/activities/activity-book-edit.ts +1 -1
- package/client/activities/activity-book-view.ts +1 -1
- package/client/activities/activity-expense-edit.ts +1 -1
- package/client/activities/activity-expense-view.ts +1 -1
- 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-importer.ts +19 -8
- package/client/pages/account/account-list-page.ts +38 -8
- package/client/pages/accounting-category/accounting-category-importer.ts +19 -8
- package/client/pages/accounting-category/accounting-category-list-page.ts +36 -6
- 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/financial-statement/financial-statement-importer.ts +19 -8
- package/client/pages/financial-statement/financial-statement-list-page.ts +5 -6
- package/client/pages/fiscal-month/fiscal-month-importer.ts +90 -0
- package/client/pages/fiscal-month/fiscal-month-list-page.ts +398 -0
- package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +90 -0
- package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +398 -0
- package/client/pages/fiscal-year/fiscal-year-importer.ts +90 -0
- package/client/pages/fiscal-year/fiscal-year-list-page.ts +398 -0
- package/client/pages/income-statement/income-statement-importer.ts +19 -8
- package/client/pages/income-statement/income-statement-list-page.ts +5 -6
- package/client/pages/{ledger/ledger-importer.ts → payment/payment-importer.ts} +13 -9
- package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -58
- package/client/pages/transaction/transaction-importer.ts +19 -8
- package/client/pages/transaction/transaction-list-page.ts +5 -6
- package/client/route.ts +16 -8
- package/client/types/accounting-category.ts +23 -0
- package/client/types/index.ts +1 -0
- package/dist-client/activities/activity-book-edit.js +1 -1
- package/dist-client/activities/activity-book-edit.js.map +1 -1
- package/dist-client/activities/activity-book-view.js +1 -1
- package/dist-client/activities/activity-book-view.js.map +1 -1
- package/dist-client/activities/activity-expense-edit.js +1 -1
- package/dist-client/activities/activity-expense-edit.js.map +1 -1
- package/dist-client/activities/activity-expense-view.js +1 -1
- package/dist-client/activities/activity-expense-view.js.map +1 -1
- 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-importer.d.ts +0 -1
- package/dist-client/pages/account/account-importer.js +12 -5
- package/dist-client/pages/account/account-importer.js.map +1 -1
- package/dist-client/pages/account/account-list-page.js +38 -8
- package/dist-client/pages/account/account-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +0 -1
- package/dist-client/pages/accounting-category/accounting-category-importer.js +12 -5
- package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +36 -6
- 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/financial-statement/financial-statement-importer.d.ts +0 -1
- package/dist-client/pages/financial-statement/financial-statement-importer.js +12 -5
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -1
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +5 -6
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -1
- package/dist-client/pages/fiscal-month/fiscal-month-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-month/fiscal-month-importer.js +93 -0
- package/dist-client/pages/fiscal-month/fiscal-month-importer.js.map +1 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.js +370 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.js.map +1 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js +93 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js.map +1 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js +370 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js.map +1 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.js +93 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.js.map +1 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.js +370 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -1
- package/dist-client/pages/income-statement/income-statement-importer.js +12 -5
- package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -1
- package/dist-client/pages/income-statement/income-statement-list-page.js +5 -6
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -1
- package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +2 -2
- package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +11 -11
- 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 -68
- package/dist-client/pages/payment/payment-list-page.js.map +1 -0
- package/dist-client/pages/transaction/transaction-importer.d.ts +0 -1
- package/dist-client/pages/transaction/transaction-importer.js +12 -5
- package/dist-client/pages/transaction/transaction-importer.js.map +1 -1
- package/dist-client/pages/transaction/transaction-list-page.js +5 -6
- package/dist-client/pages/transaction/transaction-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +9 -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/index.d.ts +1 -0
- package/dist-server/controllers/index.js +4 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/summary-statements.d.ts +4 -0
- package/dist-server/controllers/summary-statements.js +149 -0
- package/dist-server/controllers/summary-statements.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +2 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.d.ts +5 -0
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +95 -0
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -0
- package/dist-server/migrations/1725201467183-seed-accounts.d.ts +5 -0
- package/dist-server/migrations/1725201467183-seed-accounts.js +318 -0
- package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -0
- package/dist-server/service/account/account-history.d.ts +4 -1
- package/dist-server/service/account/account-history.js +17 -7
- 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 +3 -1
- 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 +16 -5
- 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 +24 -1
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-type.d.ts +2 -0
- package/dist-server/service/accounting-category/accounting-category-type.js +8 -0
- package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category.d.ts +2 -0
- package/dist-server/service/accounting-category/accounting-category.js +20 -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/common-type.d.ts +5 -0
- package/dist-server/service/common-type.js +15 -0
- package/dist-server/service/common-type.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 +33 -23
- 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 +3 -1
- 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.d.ts +10 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js +134 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.d.ts +11 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js +83 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.d.ts +26 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.js +98 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month.d.ts +22 -0
- package/dist-server/service/fiscal-month/fiscal-month.js +99 -0
- package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -0
- package/dist-server/service/fiscal-month/index.d.ts +6 -0
- package/dist-server/service/fiscal-month/index.js +10 -0
- package/dist-server/service/fiscal-month/index.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.d.ts +10 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +134 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.d.ts +11 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +85 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.d.ts +24 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js +90 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.d.ts +21 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js +94 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -0
- package/dist-server/service/fiscal-quarter/index.d.ts +6 -0
- package/dist-server/service/fiscal-quarter/index.js +10 -0
- package/dist-server/service/fiscal-quarter/index.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.d.ts +10 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js +134 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.d.ts +11 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js +81 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.d.ts +22 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.js +82 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year.d.ts +20 -0
- package/dist-server/service/fiscal-year/fiscal-year.js +89 -0
- package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -0
- package/dist-server/service/fiscal-year/index.d.ts +6 -0
- package/dist-server/service/fiscal-year/index.js +10 -0
- package/dist-server/service/fiscal-year/index.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
- package/dist-server/service/income-statement/income-statement-history.js +38 -23
- 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 +3 -1
- 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 +7 -2
- package/dist-server/service/index.js +29 -3
- 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/transaction-history.d.ts +15 -3
- package/dist-server/service/transaction/transaction-history.js +64 -8
- 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 +3 -1
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +31 -6
- package/dist-server/service/transaction/transaction.js +138 -27
- 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/fiscal-month.md +160 -0
- package/helps/accounting/fiscal-quarter.md +160 -0
- package/helps/accounting/fiscal-year.md +160 -0
- package/helps/accounting/payment.md +160 -0
- package/package.json +9 -8
- package/server/activities/activity-book.ts +31 -19
- package/server/controllers/index.ts +1 -0
- package/server/controllers/summary-statements.ts +166 -0
- package/server/index.ts +2 -0
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +106 -0
- package/server/migrations/1725201467183-seed-accounts.ts +339 -0
- package/server/service/account/account-history.ts +15 -7
- package/server/service/account/account-mutation.ts +13 -10
- package/server/service/account/account-query.ts +3 -1
- package/server/service/account/account.ts +16 -5
- 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 +24 -1
- package/server/service/accounting-category/accounting-category-type.ts +6 -0
- package/server/service/accounting-category/accounting-category.ts +23 -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/common-type.ts +12 -0
- package/server/service/financial-statement/financial-statement-history.ts +28 -19
- 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 +3 -1
- 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 +145 -0
- package/server/service/fiscal-month/fiscal-month-query.ts +58 -0
- package/server/service/fiscal-month/fiscal-month-type.ts +66 -0
- package/server/service/fiscal-month/fiscal-month.ts +84 -0
- package/server/service/fiscal-month/index.ts +7 -0
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +148 -0
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +60 -0
- package/server/service/fiscal-quarter/fiscal-quarter-type.ts +60 -0
- package/server/service/fiscal-quarter/fiscal-quarter.ts +80 -0
- package/server/service/fiscal-quarter/index.ts +7 -0
- package/server/service/fiscal-year/fiscal-year-mutation.ts +145 -0
- package/server/service/fiscal-year/fiscal-year-query.ts +53 -0
- package/server/service/fiscal-year/fiscal-year-type.ts +54 -0
- package/server/service/fiscal-year/fiscal-year.ts +76 -0
- package/server/service/fiscal-year/index.ts +7 -0
- package/server/service/income-statement/income-statement-history.ts +31 -18
- 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 +3 -4
- package/server/service/income-statement/income-statement.ts +54 -39
- package/server/service/income-statement/index.ts +2 -1
- package/server/service/index.ts +49 -3
- 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 +54 -10
- package/server/service/transaction/transaction-mutation.ts +13 -10
- package/server/service/transaction/transaction-query.ts +3 -4
- package/server/service/transaction/transaction.ts +144 -29
- package/things-factory.config.js +3 -2
- 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
|
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AAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC3F,gBAAI,CAAC,0BAA0B;;wCAA3B;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;kBA/EP,OAAO;IAdnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;QAClG,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,eAAK,EACJ,cAAc,EACd,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EACpG;QACE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CACF;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC,CAAC,0BAA0B;GAChG,OAAO,CAgFnB","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,17 +1,29 @@
|
|
|
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
|
+
import { Account } from '../account/account';
|
|
5
6
|
export declare class TransactionHistory implements HistoryEntityInterface<Transaction> {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
version?: number;
|
|
8
9
|
domain?: Domain;
|
|
9
10
|
domainId?: string;
|
|
10
|
-
name
|
|
11
|
+
name?: string;
|
|
11
12
|
description?: string;
|
|
13
|
+
currency?: string;
|
|
14
|
+
amount?: number;
|
|
12
15
|
active?: boolean;
|
|
13
16
|
type?: TransactionType;
|
|
14
|
-
|
|
17
|
+
category: TransactionCategory;
|
|
18
|
+
status: TransactionStatus;
|
|
19
|
+
probability?: number;
|
|
20
|
+
forecastNotes?: string;
|
|
21
|
+
account?: Account;
|
|
22
|
+
accountId?: string;
|
|
23
|
+
year?: number;
|
|
24
|
+
quarter?: number;
|
|
25
|
+
month?: number;
|
|
26
|
+
transactionDate: string;
|
|
15
27
|
createdAt?: Date;
|
|
16
28
|
updatedAt?: Date;
|
|
17
29
|
deletedAt?: Date;
|
|
@@ -9,11 +9,13 @@ const auth_base_1 = require("@things-factory/auth-base");
|
|
|
9
9
|
const env_1 = require("@things-factory/env");
|
|
10
10
|
const shell_1 = require("@things-factory/shell");
|
|
11
11
|
const transaction_1 = require("./transaction");
|
|
12
|
+
const account_1 = require("../account/account");
|
|
12
13
|
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
14
|
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
15
|
let TransactionHistory = class TransactionHistory {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.version = 1;
|
|
18
|
+
this.amount = 0;
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
exports.TransactionHistory = TransactionHistory;
|
|
@@ -29,16 +31,16 @@ tslib_1.__decorate([
|
|
|
29
31
|
], TransactionHistory.prototype, "version", void 0);
|
|
30
32
|
tslib_1.__decorate([
|
|
31
33
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
32
|
-
(0, type_graphql_1.Field)(
|
|
34
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
35
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
34
36
|
], TransactionHistory.prototype, "domain", void 0);
|
|
35
37
|
tslib_1.__decorate([
|
|
36
|
-
(0, typeorm_1.RelationId)((
|
|
38
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.domain),
|
|
37
39
|
tslib_1.__metadata("design:type", String)
|
|
38
40
|
], TransactionHistory.prototype, "domainId", void 0);
|
|
39
41
|
tslib_1.__decorate([
|
|
40
42
|
(0, typeorm_1.Column)(),
|
|
41
|
-
(0, type_graphql_1.Field)(),
|
|
43
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
42
44
|
tslib_1.__metadata("design:type", String)
|
|
43
45
|
], TransactionHistory.prototype, "name", void 0);
|
|
44
46
|
tslib_1.__decorate([
|
|
@@ -46,6 +48,16 @@ tslib_1.__decorate([
|
|
|
46
48
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
47
49
|
tslib_1.__metadata("design:type", String)
|
|
48
50
|
], TransactionHistory.prototype, "description", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], TransactionHistory.prototype, "currency", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
59
|
+
tslib_1.__metadata("design:type", Number)
|
|
60
|
+
], TransactionHistory.prototype, "amount", void 0);
|
|
49
61
|
tslib_1.__decorate([
|
|
50
62
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
63
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
@@ -56,23 +68,67 @@ tslib_1.__decorate([
|
|
|
56
68
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
69
|
tslib_1.__metadata("design:type", Number)
|
|
58
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);
|
|
59
81
|
tslib_1.__decorate([
|
|
60
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);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, typeorm_1.ManyToOne)(type => account_1.Account),
|
|
61
93
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
94
|
+
tslib_1.__metadata("design:type", account_1.Account)
|
|
95
|
+
], TransactionHistory.prototype, "account", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.account),
|
|
62
98
|
tslib_1.__metadata("design:type", String)
|
|
63
|
-
], TransactionHistory.prototype, "
|
|
99
|
+
], TransactionHistory.prototype, "accountId", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
102
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'fiscal year' }),
|
|
103
|
+
tslib_1.__metadata("design:type", Number)
|
|
104
|
+
], TransactionHistory.prototype, "year", void 0);
|
|
64
105
|
tslib_1.__decorate([
|
|
65
106
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
107
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'fiscal quarter' }),
|
|
108
|
+
tslib_1.__metadata("design:type", Number)
|
|
109
|
+
], TransactionHistory.prototype, "quarter", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
112
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'fiscal month' }),
|
|
113
|
+
tslib_1.__metadata("design:type", Number)
|
|
114
|
+
], TransactionHistory.prototype, "month", void 0);
|
|
115
|
+
tslib_1.__decorate([
|
|
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);
|
|
120
|
+
tslib_1.__decorate([
|
|
121
|
+
(0, typeorm_1.Column)(),
|
|
66
122
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
67
123
|
tslib_1.__metadata("design:type", Date)
|
|
68
124
|
], TransactionHistory.prototype, "createdAt", void 0);
|
|
69
125
|
tslib_1.__decorate([
|
|
70
|
-
(0, typeorm_1.Column)(
|
|
126
|
+
(0, typeorm_1.Column)(),
|
|
71
127
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
72
128
|
tslib_1.__metadata("design:type", Date)
|
|
73
129
|
], TransactionHistory.prototype, "updatedAt", void 0);
|
|
74
130
|
tslib_1.__decorate([
|
|
75
|
-
(0, typeorm_1.Column)(
|
|
131
|
+
(0, typeorm_1.Column)(),
|
|
76
132
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
77
133
|
tslib_1.__metadata("design:type", Date)
|
|
78
134
|
], TransactionHistory.prototype, "deletedAt", void 0);
|
|
@@ -82,7 +138,7 @@ tslib_1.__decorate([
|
|
|
82
138
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
83
139
|
], TransactionHistory.prototype, "creator", void 0);
|
|
84
140
|
tslib_1.__decorate([
|
|
85
|
-
(0, typeorm_1.RelationId)((
|
|
141
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.creator),
|
|
86
142
|
tslib_1.__metadata("design:type", String)
|
|
87
143
|
], TransactionHistory.prototype, "creatorId", void 0);
|
|
88
144
|
tslib_1.__decorate([
|
|
@@ -91,7 +147,7 @@ tslib_1.__decorate([
|
|
|
91
147
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
92
148
|
], TransactionHistory.prototype, "updater", void 0);
|
|
93
149
|
tslib_1.__decorate([
|
|
94
|
-
(0, typeorm_1.RelationId)((
|
|
150
|
+
(0, typeorm_1.RelationId)((transactionHistory) => transactionHistory.updater),
|
|
95
151
|
tslib_1.__metadata("design:type", String)
|
|
96
152
|
], TransactionHistory.prototype, "updaterId", void 0);
|
|
97
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;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,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":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+CAA2C;AAC3C,yDAAqE;AAG9D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAIxB,AAAN,KAAK,CAAC,iBAAiB,CACD,WAA2B,EACxC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,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,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,8 +46,9 @@ 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
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)(
|
|
51
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
50
52
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
51
53
|
tslib_1.__metadata("design:type", Function),
|
|
52
54
|
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
@@ -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,EAAE,CAAA;QAE3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK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AA,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"]}
|