@things-factory/accounting 8.0.0-alpha.1 → 8.0.0-alpha.11
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
@@ -7,7 +7,9 @@ tslib_1.__exportStar(require("./income-statement/income-statement"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./financial-statement/financial-statement"), exports);
|
8
8
|
tslib_1.__exportStar(require("./accounting-category/accounting-category"), exports);
|
9
9
|
tslib_1.__exportStar(require("./transaction/transaction"), exports);
|
10
|
+
tslib_1.__exportStar(require("./payment/payment"), exports);
|
10
11
|
tslib_1.__exportStar(require("./account/account"), exports);
|
12
|
+
tslib_1.__exportStar(require("./accounting-document/accounting-document"), exports);
|
11
13
|
tslib_1.__exportStar(require("./fiscal-month/fiscal-month"), exports);
|
12
14
|
tslib_1.__exportStar(require("./fiscal-quarter/fiscal-quarter"), exports);
|
13
15
|
tslib_1.__exportStar(require("./fiscal-year/fiscal-year"), exports);
|
@@ -16,7 +18,9 @@ const income_statement_1 = require("./income-statement");
|
|
16
18
|
const financial_statement_1 = require("./financial-statement");
|
17
19
|
const accounting_category_1 = require("./accounting-category");
|
18
20
|
const transaction_1 = require("./transaction");
|
21
|
+
const payment_1 = require("./payment");
|
19
22
|
const account_1 = require("./account");
|
23
|
+
const accounting_document_1 = require("./accounting-document");
|
20
24
|
const fiscal_month_1 = require("./fiscal-month");
|
21
25
|
const fiscal_quarter_1 = require("./fiscal-quarter");
|
22
26
|
const fiscal_year_1 = require("./fiscal-year");
|
@@ -27,6 +31,8 @@ exports.entities = [
|
|
27
31
|
...accounting_category_1.entities,
|
28
32
|
...transaction_1.entities,
|
29
33
|
...account_1.entities,
|
34
|
+
...accounting_document_1.entities,
|
35
|
+
...payment_1.entities,
|
30
36
|
...fiscal_month_1.entities,
|
31
37
|
...fiscal_quarter_1.entities,
|
32
38
|
...fiscal_year_1.entities
|
@@ -37,7 +43,9 @@ exports.subscribers = [
|
|
37
43
|
...financial_statement_1.subscribers,
|
38
44
|
...accounting_category_1.subscribers,
|
39
45
|
...transaction_1.subscribers,
|
46
|
+
...payment_1.subscribers,
|
40
47
|
...account_1.subscribers,
|
48
|
+
...accounting_document_1.subscribers,
|
41
49
|
...fiscal_year_1.subscribers,
|
42
50
|
...fiscal_month_1.subscribers,
|
43
51
|
...fiscal_quarter_1.subscribers,
|
@@ -50,7 +58,9 @@ exports.schema = {
|
|
50
58
|
...financial_statement_1.resolvers,
|
51
59
|
...accounting_category_1.resolvers,
|
52
60
|
...transaction_1.resolvers,
|
61
|
+
...payment_1.resolvers,
|
53
62
|
...account_1.resolvers,
|
63
|
+
...accounting_document_1.resolvers,
|
54
64
|
...fiscal_month_1.resolvers,
|
55
65
|
...fiscal_quarter_1.resolvers,
|
56
66
|
...fiscal_year_1.resolvers
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,8EAAmD;AACnD,oFAAyD;AACzD,oFAAyD;AACzD,oEAAyC;AACzC,4DAAiC;AACjC,sEAA2C;AAC3C,0EAA+C;AAC/C,oEAAyC;AAEzC,mCAAmC;AACnC,yDAI2B;AAC3B,+DAI8B;AAC9B,+DAI8B;AAC9B,+CAIsB;AACtB,uCAIkB;AAClB,iDAIuB;AACvB,qDAIyB;AACzB,+CAIsB;AAET,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,2BAAuB;IAC1B,GAAG,8BAA0B;IAC7B,GAAG,8BAA0B;IAC7B,GAAG,sBAAmB;IACtB,GAAG,kBAAe;IAClB,GAAG,uBAAmB;IACtB,GAAG,yBAAqB;IACxB,GAAG,sBAAkB;CACtB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,8BAA0B;IAC7B,GAAG,iCAA6B;IAChC,GAAG,iCAA6B;IAChC,GAAG,yBAAsB;IACzB,GAAG,qBAAkB;IACrB,GAAG,yBAAqB;IACxB,GAAG,0BAAsB;IACzB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;CACzB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,4BAAwB;QAC3B,GAAG,+BAA2B;QAC9B,GAAG,+BAA2B;QAC9B,GAAG,uBAAoB;QACvB,GAAG,mBAAgB;QACnB,GAAG,wBAAoB;QACvB,GAAG,0BAAsB;QACzB,GAAG,uBAAmB;KACvB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './income-statement/income-statement'\nexport * from './financial-statement/financial-statement'\nexport * from './accounting-category/accounting-category'\nexport * from './transaction/transaction'\nexport * from './account/account'\nexport * from './fiscal-month/fiscal-month'\nexport * from './fiscal-quarter/fiscal-quarter'\nexport * from './fiscal-year/fiscal-year'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport {\n entities as IncomeStatementEntities,\n resolvers as IncomeStatementResolvers,\n subscribers as IncomeStatementSubscribers\n} from './income-statement'\nimport {\n entities as FinancialStatementEntities,\n resolvers as FinancialStatementResolvers,\n subscribers as FinancialStatementSubscribers\n} from './financial-statement'\nimport {\n entities as AccountingCategoryEntities,\n resolvers as AccountingCategoryResolvers,\n subscribers as AccountingCategorySubscribers\n} from './accounting-category'\nimport {\n entities as TransactionEntities,\n resolvers as TransactionResolvers,\n subscribers as TransactionSubscribers\n} from './transaction'\nimport {\n entities as AccountEntities,\n resolvers as AccountResolvers,\n subscribers as AccountSubscribers\n} from './account'\nimport {\n entities as FiscalMonthEntities,\n resolvers as FiscalMonthResolvers,\n subscribers as FiscalMonthSubscribers\n} from './fiscal-month'\nimport {\n entities as FiscalQuarterEntities,\n resolvers as FiscalQuarterResolvers,\n subscribers as FiscalQuarterSubscribers\n} from './fiscal-quarter'\nimport {\n entities as FiscalYearEntities,\n resolvers as FiscalYearResolvers,\n subscribers as FiscalYearSubscribers\n} from './fiscal-year'\n\nexport const entities = [\n /* ENTITIES */\n ...IncomeStatementEntities,\n ...FinancialStatementEntities,\n ...AccountingCategoryEntities,\n ...TransactionEntities,\n ...AccountEntities,\n ...FiscalMonthEntities,\n ...FiscalQuarterEntities,\n ...FiscalYearEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n ...IncomeStatementSubscribers,\n ...FinancialStatementSubscribers,\n ...AccountingCategorySubscribers,\n ...TransactionSubscribers,\n ...AccountSubscribers,\n ...FiscalYearSubscribers,\n ...FiscalMonthSubscribers,\n ...FiscalQuarterSubscribers,\n ...FiscalYearSubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...IncomeStatementResolvers,\n ...FinancialStatementResolvers,\n ...AccountingCategoryResolvers,\n ...TransactionResolvers,\n ...AccountResolvers,\n ...FiscalMonthResolvers,\n ...FiscalQuarterResolvers,\n ...FiscalYearResolvers\n ]\n}\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,8EAAmD;AACnD,oFAAyD;AACzD,oFAAyD;AACzD,oEAAyC;AACzC,4DAAiC;AACjC,4DAAiC;AACjC,oFAAyD;AACzD,sEAA2C;AAC3C,0EAA+C;AAC/C,oEAAyC;AAEzC,mCAAmC;AACnC,yDAI2B;AAC3B,+DAI8B;AAC9B,+DAI8B;AAC9B,+CAIsB;AACtB,uCAIkB;AAClB,uCAIkB;AAClB,+DAI8B;AAC9B,iDAIuB;AACvB,qDAIyB;AACzB,+CAIsB;AAET,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,2BAAuB;IAC1B,GAAG,8BAA0B;IAC7B,GAAG,8BAA0B;IAC7B,GAAG,sBAAmB;IACtB,GAAG,kBAAe;IAClB,GAAG,8BAA0B;IAC7B,GAAG,kBAAe;IAClB,GAAG,uBAAmB;IACtB,GAAG,yBAAqB;IACxB,GAAG,sBAAkB;CACtB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,8BAA0B;IAC7B,GAAG,iCAA6B;IAChC,GAAG,iCAA6B;IAChC,GAAG,yBAAsB;IACzB,GAAG,qBAAkB;IACrB,GAAG,qBAAkB;IACrB,GAAG,iCAA6B;IAChC,GAAG,yBAAqB;IACxB,GAAG,0BAAsB;IACzB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;CACzB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,4BAAwB;QAC3B,GAAG,+BAA2B;QAC9B,GAAG,+BAA2B;QAC9B,GAAG,uBAAoB;QACvB,GAAG,mBAAgB;QACnB,GAAG,mBAAgB;QACnB,GAAG,+BAA2B;QAC9B,GAAG,wBAAoB;QACvB,GAAG,0BAAsB;QACzB,GAAG,uBAAmB;KACvB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './income-statement/income-statement'\nexport * from './financial-statement/financial-statement'\nexport * from './accounting-category/accounting-category'\nexport * from './transaction/transaction'\nexport * from './payment/payment'\nexport * from './account/account'\nexport * from './accounting-document/accounting-document'\nexport * from './fiscal-month/fiscal-month'\nexport * from './fiscal-quarter/fiscal-quarter'\nexport * from './fiscal-year/fiscal-year'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport {\n entities as IncomeStatementEntities,\n resolvers as IncomeStatementResolvers,\n subscribers as IncomeStatementSubscribers\n} from './income-statement'\nimport {\n entities as FinancialStatementEntities,\n resolvers as FinancialStatementResolvers,\n subscribers as FinancialStatementSubscribers\n} from './financial-statement'\nimport {\n entities as AccountingCategoryEntities,\n resolvers as AccountingCategoryResolvers,\n subscribers as AccountingCategorySubscribers\n} from './accounting-category'\nimport {\n entities as TransactionEntities,\n resolvers as TransactionResolvers,\n subscribers as TransactionSubscribers\n} from './transaction'\nimport {\n entities as PaymentEntities,\n resolvers as PaymentResolvers,\n subscribers as PaymentSubscribers\n} from './payment'\nimport {\n entities as AccountEntities,\n resolvers as AccountResolvers,\n subscribers as AccountSubscribers\n} from './account'\nimport {\n entities as AccountingDocumentEntities,\n resolvers as AccountingDocumentResolvers,\n subscribers as AccountingDocumentSubscribers\n} from './accounting-document'\nimport {\n entities as FiscalMonthEntities,\n resolvers as FiscalMonthResolvers,\n subscribers as FiscalMonthSubscribers\n} from './fiscal-month'\nimport {\n entities as FiscalQuarterEntities,\n resolvers as FiscalQuarterResolvers,\n subscribers as FiscalQuarterSubscribers\n} from './fiscal-quarter'\nimport {\n entities as FiscalYearEntities,\n resolvers as FiscalYearResolvers,\n subscribers as FiscalYearSubscribers\n} from './fiscal-year'\n\nexport const entities = [\n /* ENTITIES */\n ...IncomeStatementEntities,\n ...FinancialStatementEntities,\n ...AccountingCategoryEntities,\n ...TransactionEntities,\n ...AccountEntities,\n ...AccountingDocumentEntities,\n ...PaymentEntities,\n ...FiscalMonthEntities,\n ...FiscalQuarterEntities,\n ...FiscalYearEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n ...IncomeStatementSubscribers,\n ...FinancialStatementSubscribers,\n ...AccountingCategorySubscribers,\n ...TransactionSubscribers,\n ...PaymentSubscribers,\n ...AccountSubscribers,\n ...AccountingDocumentSubscribers,\n ...FiscalYearSubscribers,\n ...FiscalMonthSubscribers,\n ...FiscalQuarterSubscribers,\n ...FiscalYearSubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...IncomeStatementResolvers,\n ...FinancialStatementResolvers,\n ...AccountingCategoryResolvers,\n ...TransactionResolvers,\n ...PaymentResolvers,\n ...AccountResolvers,\n ...AccountingDocumentResolvers,\n ...FiscalMonthResolvers,\n ...FiscalQuarterResolvers,\n ...FiscalYearResolvers\n ]\n}\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history';
|
2
|
+
import { Payment } from './payment';
|
3
|
+
import { PaymentHistory } from './payment-history';
|
4
|
+
export declare class PaymentHistoryEntitySubscriber extends HistoryEntitySubscriber<Payment, PaymentHistory> {
|
5
|
+
get entity(): typeof Payment;
|
6
|
+
get historyEntity(): typeof PaymentHistory;
|
7
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PaymentHistoryEntitySubscriber = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const typeorm_1 = require("typeorm");
|
6
|
+
const typeorm_history_1 = require("@operato/typeorm-history");
|
7
|
+
const payment_1 = require("./payment");
|
8
|
+
const payment_history_1 = require("./payment-history");
|
9
|
+
let PaymentHistoryEntitySubscriber = class PaymentHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
|
10
|
+
get entity() {
|
11
|
+
return payment_1.Payment;
|
12
|
+
}
|
13
|
+
get historyEntity() {
|
14
|
+
return payment_history_1.PaymentHistory;
|
15
|
+
}
|
16
|
+
};
|
17
|
+
exports.PaymentHistoryEntitySubscriber = PaymentHistoryEntitySubscriber;
|
18
|
+
exports.PaymentHistoryEntitySubscriber = PaymentHistoryEntitySubscriber = tslib_1.__decorate([
|
19
|
+
(0, typeorm_1.EventSubscriber)()
|
20
|
+
], PaymentHistoryEntitySubscriber);
|
21
|
+
//# sourceMappingURL=event-subscriber.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/payment/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,uCAAmC;AACnC,uDAAkD;AAG3C,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,yCAAgD;IAClG,IAAW,MAAM;QACf,OAAO,iBAAO,CAAA;IAChB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,gCAAc,CAAA;IACvB,CAAC;CACF,CAAA;AARY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,yBAAe,GAAE;GACL,8BAA8B,CAQ1C","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { Payment } from './payment'\nimport { PaymentHistory } from './payment-history'\n\n@EventSubscriber()\nexport class PaymentHistoryEntitySubscriber extends HistoryEntitySubscriber<Payment, PaymentHistory> {\n public get entity() {\n return Payment\n }\n\n public get historyEntity() {\n return PaymentHistory\n }\n}\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Payment } from './payment';
|
2
|
+
import { PaymentHistoryEntitySubscriber } from './event-subscriber';
|
3
|
+
import { PaymentQuery } from './payment-query';
|
4
|
+
import { PaymentMutation } from './payment-mutation';
|
5
|
+
export declare const entities: (typeof Payment)[];
|
6
|
+
export declare const resolvers: (typeof PaymentQuery | typeof PaymentMutation)[];
|
7
|
+
export declare const subscribers: (typeof PaymentHistoryEntitySubscriber)[];
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
4
|
+
const payment_1 = require("./payment");
|
5
|
+
const payment_history_1 = require("./payment-history");
|
6
|
+
const event_subscriber_1 = require("./event-subscriber");
|
7
|
+
const payment_query_1 = require("./payment-query");
|
8
|
+
const payment_mutation_1 = require("./payment-mutation");
|
9
|
+
exports.entities = [payment_1.Payment, payment_history_1.PaymentHistory];
|
10
|
+
exports.resolvers = [payment_query_1.PaymentQuery, payment_mutation_1.PaymentMutation];
|
11
|
+
exports.subscribers = [event_subscriber_1.PaymentHistoryEntitySubscriber];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/payment/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,uDAAkD;AAClD,yDAAmE;AACnE,mDAA8C;AAC9C,yDAAoD;AAEvC,QAAA,QAAQ,GAAG,CAAC,iBAAO,EAAE,gCAAc,CAAC,CAAA;AACpC,QAAA,SAAS,GAAG,CAAC,4BAAY,EAAE,kCAAe,CAAC,CAAA;AAC3C,QAAA,WAAW,GAAG,CAAC,iDAA8B,CAAC,CAAA","sourcesContent":["import { Payment } from './payment'\nimport { PaymentHistory } from './payment-history'\nimport { PaymentHistoryEntitySubscriber } from './event-subscriber'\nimport { PaymentQuery } from './payment-query'\nimport { PaymentMutation } from './payment-mutation'\n\nexport const entities = [Payment, PaymentHistory]\nexport const resolvers = [PaymentQuery, PaymentMutation]\nexport const subscribers = [PaymentHistoryEntitySubscriber]\n"]}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
|
2
|
+
import { User } from '@things-factory/auth-base';
|
3
|
+
import { Domain } from '@things-factory/shell';
|
4
|
+
import { Transaction } from '../transaction/transaction';
|
5
|
+
import { Payment, PaymentDirection, PaymentType } from './payment';
|
6
|
+
import { BankAccount } from 'service/bank-account/bank-account';
|
7
|
+
export declare class PaymentHistory implements HistoryEntityInterface<Payment> {
|
8
|
+
readonly id: string;
|
9
|
+
version?: number;
|
10
|
+
domain?: Domain;
|
11
|
+
domainId?: string;
|
12
|
+
transaction: Transaction;
|
13
|
+
transactionId: string;
|
14
|
+
currency?: string;
|
15
|
+
amount: number;
|
16
|
+
paymentType: PaymentType;
|
17
|
+
sourceBankAccount?: BankAccount;
|
18
|
+
sourceBankAccountId?: string;
|
19
|
+
destinationBankAccount?: BankAccount;
|
20
|
+
destinationBankAccountId?: string;
|
21
|
+
year?: number;
|
22
|
+
quarter?: number;
|
23
|
+
month?: number;
|
24
|
+
paidAt: Date;
|
25
|
+
direction: PaymentDirection;
|
26
|
+
note?: string;
|
27
|
+
createdAt?: Date;
|
28
|
+
updatedAt?: Date;
|
29
|
+
deletedAt?: Date;
|
30
|
+
creator?: User;
|
31
|
+
creatorId?: string;
|
32
|
+
updater?: User;
|
33
|
+
updaterId?: string;
|
34
|
+
thumbnail?: string;
|
35
|
+
originalId: string;
|
36
|
+
action: HistoryActionType;
|
37
|
+
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PaymentHistory = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const typeorm_1 = require("typeorm");
|
7
|
+
const typeorm_history_1 = require("@operato/typeorm-history");
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
9
|
+
const env_1 = require("@things-factory/env");
|
10
|
+
const shell_1 = require("@things-factory/shell");
|
11
|
+
const transaction_1 = require("../transaction/transaction");
|
12
|
+
const payment_1 = require("./payment");
|
13
|
+
const bank_account_1 = require("service/bank-account/bank-account");
|
14
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
15
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
16
|
+
let PaymentHistory = class PaymentHistory {
|
17
|
+
constructor() {
|
18
|
+
this.version = 1;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
exports.PaymentHistory = PaymentHistory;
|
22
|
+
tslib_1.__decorate([
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
24
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
25
|
+
tslib_1.__metadata("design:type", String)
|
26
|
+
], PaymentHistory.prototype, "id", void 0);
|
27
|
+
tslib_1.__decorate([
|
28
|
+
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
30
|
+
tslib_1.__metadata("design:type", Number)
|
31
|
+
], PaymentHistory.prototype, "version", void 0);
|
32
|
+
tslib_1.__decorate([
|
33
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
34
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
35
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
36
|
+
], PaymentHistory.prototype, "domain", void 0);
|
37
|
+
tslib_1.__decorate([
|
38
|
+
(0, typeorm_1.RelationId)((payment) => payment.domain),
|
39
|
+
tslib_1.__metadata("design:type", String)
|
40
|
+
], PaymentHistory.prototype, "domainId", void 0);
|
41
|
+
tslib_1.__decorate([
|
42
|
+
(0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.payments),
|
43
|
+
(0, type_graphql_1.Field)(type => transaction_1.Transaction, { description: 'The transaction associated with this payment' }),
|
44
|
+
tslib_1.__metadata("design:type", transaction_1.Transaction // 결제와 연결된 트랜잭션
|
45
|
+
)
|
46
|
+
], PaymentHistory.prototype, "transaction", void 0);
|
47
|
+
tslib_1.__decorate([
|
48
|
+
(0, typeorm_1.RelationId)((payment) => payment.transaction),
|
49
|
+
tslib_1.__metadata("design:type", String)
|
50
|
+
], PaymentHistory.prototype, "transactionId", void 0);
|
51
|
+
tslib_1.__decorate([
|
52
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The currency used in the payment' }),
|
54
|
+
tslib_1.__metadata("design:type", String)
|
55
|
+
], PaymentHistory.prototype, "currency", void 0);
|
56
|
+
tslib_1.__decorate([
|
57
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
58
|
+
(0, type_graphql_1.Field)({ nullable: false, description: 'The amount of money involved in the payment' }),
|
59
|
+
tslib_1.__metadata("design:type", Number)
|
60
|
+
], PaymentHistory.prototype, "amount", void 0);
|
61
|
+
tslib_1.__decorate([
|
62
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: payment_1.PaymentType, nullable: false }),
|
63
|
+
(0, type_graphql_1.Field)(type => payment_1.PaymentType, { description: 'Type of the payment' }),
|
64
|
+
tslib_1.__metadata("design:type", String)
|
65
|
+
], PaymentHistory.prototype, "paymentType", void 0);
|
66
|
+
tslib_1.__decorate([
|
67
|
+
(0, typeorm_1.ManyToOne)(type => bank_account_1.BankAccount, { nullable: true }),
|
68
|
+
(0, type_graphql_1.Field)(type => bank_account_1.BankAccount, { nullable: true, description: 'Source bank account for the payment' }),
|
69
|
+
tslib_1.__metadata("design:type", bank_account_1.BankAccount)
|
70
|
+
], PaymentHistory.prototype, "sourceBankAccount", void 0);
|
71
|
+
tslib_1.__decorate([
|
72
|
+
(0, typeorm_1.RelationId)((payment) => payment.sourceBankAccount),
|
73
|
+
tslib_1.__metadata("design:type", String)
|
74
|
+
], PaymentHistory.prototype, "sourceBankAccountId", void 0);
|
75
|
+
tslib_1.__decorate([
|
76
|
+
(0, typeorm_1.ManyToOne)(type => bank_account_1.BankAccount, { nullable: true }),
|
77
|
+
(0, type_graphql_1.Field)(type => bank_account_1.BankAccount, { nullable: true, description: 'Destination bank account for the payment' }),
|
78
|
+
tslib_1.__metadata("design:type", bank_account_1.BankAccount)
|
79
|
+
], PaymentHistory.prototype, "destinationBankAccount", void 0);
|
80
|
+
tslib_1.__decorate([
|
81
|
+
(0, typeorm_1.RelationId)((payment) => payment.destinationBankAccount),
|
82
|
+
tslib_1.__metadata("design:type", String)
|
83
|
+
], PaymentHistory.prototype, "destinationBankAccountId", void 0);
|
84
|
+
tslib_1.__decorate([
|
85
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal year in which the payment was made' }),
|
87
|
+
tslib_1.__metadata("design:type", Number)
|
88
|
+
], PaymentHistory.prototype, "year", void 0);
|
89
|
+
tslib_1.__decorate([
|
90
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
91
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal quarter in which the payment was made' }),
|
92
|
+
tslib_1.__metadata("design:type", Number)
|
93
|
+
], PaymentHistory.prototype, "quarter", void 0);
|
94
|
+
tslib_1.__decorate([
|
95
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
96
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fiscal month in which the payment was made' }),
|
97
|
+
tslib_1.__metadata("design:type", Number)
|
98
|
+
], PaymentHistory.prototype, "month", void 0);
|
99
|
+
tslib_1.__decorate([
|
100
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
101
|
+
(0, type_graphql_1.Field)({ nullable: false, description: 'The date and time when the payment was made' }),
|
102
|
+
tslib_1.__metadata("design:type", Date // 결제가 이루어진 날짜 및 시간
|
103
|
+
)
|
104
|
+
], PaymentHistory.prototype, "paidAt", void 0);
|
105
|
+
tslib_1.__decorate([
|
106
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
107
|
+
(0, type_graphql_1.Field)(type => payment_1.PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' }),
|
108
|
+
tslib_1.__metadata("design:type", String)
|
109
|
+
], PaymentHistory.prototype, "direction", void 0);
|
110
|
+
tslib_1.__decorate([
|
111
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
112
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Additional notes or comments about the payment' }),
|
113
|
+
tslib_1.__metadata("design:type", String)
|
114
|
+
], PaymentHistory.prototype, "note", void 0);
|
115
|
+
tslib_1.__decorate([
|
116
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
117
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
118
|
+
tslib_1.__metadata("design:type", Date)
|
119
|
+
], PaymentHistory.prototype, "createdAt", void 0);
|
120
|
+
tslib_1.__decorate([
|
121
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
122
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
123
|
+
tslib_1.__metadata("design:type", Date)
|
124
|
+
], PaymentHistory.prototype, "updatedAt", void 0);
|
125
|
+
tslib_1.__decorate([
|
126
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
127
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
128
|
+
tslib_1.__metadata("design:type", Date)
|
129
|
+
], PaymentHistory.prototype, "deletedAt", void 0);
|
130
|
+
tslib_1.__decorate([
|
131
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
132
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
133
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
134
|
+
], PaymentHistory.prototype, "creator", void 0);
|
135
|
+
tslib_1.__decorate([
|
136
|
+
(0, typeorm_1.RelationId)((payment) => payment.creator),
|
137
|
+
tslib_1.__metadata("design:type", String)
|
138
|
+
], PaymentHistory.prototype, "creatorId", void 0);
|
139
|
+
tslib_1.__decorate([
|
140
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
141
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
142
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
143
|
+
], PaymentHistory.prototype, "updater", void 0);
|
144
|
+
tslib_1.__decorate([
|
145
|
+
(0, typeorm_1.RelationId)((payment) => payment.updater),
|
146
|
+
tslib_1.__metadata("design:type", String)
|
147
|
+
], PaymentHistory.prototype, "updaterId", void 0);
|
148
|
+
tslib_1.__decorate([
|
149
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
150
|
+
tslib_1.__metadata("design:type", String)
|
151
|
+
], PaymentHistory.prototype, "thumbnail", void 0);
|
152
|
+
tslib_1.__decorate([
|
153
|
+
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
154
|
+
tslib_1.__metadata("design:type", String)
|
155
|
+
], PaymentHistory.prototype, "originalId", void 0);
|
156
|
+
tslib_1.__decorate([
|
157
|
+
(0, typeorm_history_1.HistoryActionColumn)({
|
158
|
+
nullable: false,
|
159
|
+
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
160
|
+
? 'enum'
|
161
|
+
: DATABASE_TYPE == 'oracle'
|
162
|
+
? 'varchar2'
|
163
|
+
: 'smallint',
|
164
|
+
enum: typeorm_history_1.HistoryActionType
|
165
|
+
}),
|
166
|
+
tslib_1.__metadata("design:type", String)
|
167
|
+
], PaymentHistory.prototype, "action", void 0);
|
168
|
+
exports.PaymentHistory = PaymentHistory = tslib_1.__decorate([
|
169
|
+
(0, typeorm_1.Entity)(),
|
170
|
+
(0, typeorm_1.Index)('ix_payment_history_0', (paymentHistory) => [paymentHistory.originalId, paymentHistory.version], { unique: true }),
|
171
|
+
(0, typeorm_1.Index)('ix_payment_history_1', (paymentHistory) => [paymentHistory.domain, paymentHistory.originalId, paymentHistory.version], { unique: true }),
|
172
|
+
(0, type_graphql_1.ObjectType)({ description: 'History Entity of Payment' })
|
173
|
+
], PaymentHistory);
|
174
|
+
//# sourceMappingURL=payment-history.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"payment-history.js","sourceRoot":"","sources":["../../../server/service/payment/payment-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,4DAAwD;AACxD,uCAAkE;AAClE,oEAA+D;AAE/D,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAc7B,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QAOL,YAAO,GAAY,CAAC,CAAA;IA6GtB,CAAC;CAAA,CAAA;AApHY,wCAAc;AAGhB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;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AC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9G,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;GAC5C,cAAc,CAoH1B","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 } from '../transaction/transaction'\nimport { Payment, PaymentDirection, PaymentType } from './payment'\nimport { BankAccount } from 'service/bank-account/bank-account'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_payment_history_0',\n (paymentHistory: PaymentHistory) => [paymentHistory.originalId, paymentHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_payment_history_1',\n (paymentHistory: PaymentHistory) => [paymentHistory.domain, paymentHistory.originalId, paymentHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Payment' })\nexport class PaymentHistory implements HistoryEntityInterface<Payment> {\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((payment: Payment) => payment.domain)\n domainId?: string\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({ type: 'enum', enum: PaymentType, nullable: false })\n @Field(type => PaymentType, { description: 'Type of the payment' })\n paymentType: PaymentType // 결제 유형\n\n @ManyToOne(type => BankAccount, { nullable: true })\n @Field(type => BankAccount, { nullable: true, description: 'Source bank account for the payment' })\n sourceBankAccount?: BankAccount\n\n @RelationId((payment: Payment) => payment.sourceBankAccount)\n sourceBankAccountId?: string\n\n @ManyToOne(type => BankAccount, { nullable: true })\n @Field(type => BankAccount, { nullable: true, description: 'Destination bank account for the payment' })\n destinationBankAccount?: BankAccount\n\n @RelationId((payment: Payment) => payment.destinationBankAccount)\n destinationBankAccountId?: string\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 @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\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((payment: Payment) => payment.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((payment: Payment) => payment.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: 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"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Payment } from './payment';
|
2
|
+
import { NewPayment, PaymentPatch } from './payment-type';
|
3
|
+
export declare class PaymentMutation {
|
4
|
+
createPayment(payment: NewPayment, context: ResolverContext): Promise<Payment>;
|
5
|
+
updatePayment(id: string, patch: PaymentPatch, context: ResolverContext): Promise<Payment>;
|
6
|
+
updateMultiplePayment(patches: PaymentPatch[], context: ResolverContext): Promise<Payment[]>;
|
7
|
+
deletePayment(id: string, context: ResolverContext): Promise<boolean>;
|
8
|
+
deletePayments(ids: string[], context: ResolverContext): Promise<boolean>;
|
9
|
+
importPayments(payments: PaymentPatch[], context: ResolverContext): Promise<boolean>;
|
10
|
+
}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PaymentMutation = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const typeorm_1 = require("typeorm");
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
8
|
+
const payment_1 = require("./payment");
|
9
|
+
const payment_type_1 = require("./payment-type");
|
10
|
+
let PaymentMutation = class PaymentMutation {
|
11
|
+
async createPayment(payment, context) {
|
12
|
+
const { domain, user, tx } = context.state;
|
13
|
+
const result = await (0, shell_1.getRepository)(payment_1.Payment, tx).save(Object.assign(Object.assign({}, payment), { domain, creator: user, updater: user }));
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
async updatePayment(id, patch, context) {
|
17
|
+
const { domain, user, tx } = context.state;
|
18
|
+
const repository = (0, shell_1.getRepository)(payment_1.Payment, tx);
|
19
|
+
const payment = await repository.findOne({
|
20
|
+
where: { domain: { id: domain.id }, id }
|
21
|
+
});
|
22
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, payment), patch), { updater: user }));
|
23
|
+
return result;
|
24
|
+
}
|
25
|
+
async updateMultiplePayment(patches, context) {
|
26
|
+
const { domain, user, tx } = context.state;
|
27
|
+
let results = [];
|
28
|
+
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
29
|
+
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
30
|
+
const paymentRepo = (0, shell_1.getRepository)(payment_1.Payment, tx);
|
31
|
+
if (_createRecords.length > 0) {
|
32
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
33
|
+
const newRecord = _createRecords[i];
|
34
|
+
const result = await paymentRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
35
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
36
|
+
}
|
37
|
+
}
|
38
|
+
if (_updateRecords.length > 0) {
|
39
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
40
|
+
const updateRecord = _updateRecords[i];
|
41
|
+
const payment = await paymentRepo.findOneBy({ id: updateRecord.id });
|
42
|
+
const result = await paymentRepo.save(Object.assign(Object.assign(Object.assign({}, payment), updateRecord), { updater: user }));
|
43
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return results;
|
47
|
+
}
|
48
|
+
async deletePayment(id, context) {
|
49
|
+
const { domain, tx } = context.state;
|
50
|
+
await (0, shell_1.getRepository)(payment_1.Payment, tx).delete({ domain: { id: domain.id }, id });
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
async deletePayments(ids, context) {
|
54
|
+
const { domain, tx } = context.state;
|
55
|
+
await (0, shell_1.getRepository)(payment_1.Payment, tx).delete({
|
56
|
+
domain: { id: domain.id },
|
57
|
+
id: (0, typeorm_1.In)(ids)
|
58
|
+
});
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
async importPayments(payments, context) {
|
62
|
+
const { domain, tx } = context.state;
|
63
|
+
await Promise.all(payments.map(async (payment) => {
|
64
|
+
const createdPayment = await (0, shell_1.getRepository)(payment_1.Payment, tx).save(Object.assign({ domain }, payment));
|
65
|
+
}));
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
exports.PaymentMutation = PaymentMutation;
|
70
|
+
tslib_1.__decorate([
|
71
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
72
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
73
|
+
(0, type_graphql_1.Mutation)(returns => payment_1.Payment, { description: 'To create new Payment' }),
|
74
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('payment')),
|
75
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
76
|
+
tslib_1.__metadata("design:type", Function),
|
77
|
+
tslib_1.__metadata("design:paramtypes", [payment_type_1.NewPayment, Object]),
|
78
|
+
tslib_1.__metadata("design:returntype", Promise)
|
79
|
+
], PaymentMutation.prototype, "createPayment", null);
|
80
|
+
tslib_1.__decorate([
|
81
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
82
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
83
|
+
(0, type_graphql_1.Mutation)(returns => payment_1.Payment, { description: 'To modify Payment information' }),
|
84
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
85
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
86
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
87
|
+
tslib_1.__metadata("design:type", Function),
|
88
|
+
tslib_1.__metadata("design:paramtypes", [String, payment_type_1.PaymentPatch, Object]),
|
89
|
+
tslib_1.__metadata("design:returntype", Promise)
|
90
|
+
], PaymentMutation.prototype, "updatePayment", null);
|
91
|
+
tslib_1.__decorate([
|
92
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
93
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
94
|
+
(0, type_graphql_1.Mutation)(returns => [payment_1.Payment], { description: "To modify multiple Payments' information" }),
|
95
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [payment_type_1.PaymentPatch])),
|
96
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
97
|
+
tslib_1.__metadata("design:type", Function),
|
98
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
99
|
+
tslib_1.__metadata("design:returntype", Promise)
|
100
|
+
], PaymentMutation.prototype, "updateMultiplePayment", null);
|
101
|
+
tslib_1.__decorate([
|
102
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
103
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
104
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Payment' }),
|
105
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
106
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
107
|
+
tslib_1.__metadata("design:type", Function),
|
108
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
109
|
+
tslib_1.__metadata("design:returntype", Promise)
|
110
|
+
], PaymentMutation.prototype, "deletePayment", null);
|
111
|
+
tslib_1.__decorate([
|
112
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
113
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
114
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Payments' }),
|
115
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
116
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
117
|
+
tslib_1.__metadata("design:type", Function),
|
118
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
119
|
+
tslib_1.__metadata("design:returntype", Promise)
|
120
|
+
], PaymentMutation.prototype, "deletePayments", null);
|
121
|
+
tslib_1.__decorate([
|
122
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
123
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation")'),
|
124
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Payments' }),
|
125
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('payments', type => [payment_type_1.PaymentPatch])),
|
126
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
127
|
+
tslib_1.__metadata("design:type", Function),
|
128
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
129
|
+
tslib_1.__metadata("design:returntype", Promise)
|
130
|
+
], PaymentMutation.prototype, "importPayments", null);
|
131
|
+
exports.PaymentMutation = PaymentMutation = tslib_1.__decorate([
|
132
|
+
(0, type_graphql_1.Resolver)(payment_1.Payment)
|
133
|
+
], PaymentMutation);
|
134
|
+
//# sourceMappingURL=payment-mutation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"payment-mutation.js","sourceRoot":"","sources":["../../../server/service/payment/payment-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,uCAAmC;AACnC,iDAAyD;AAGlD,IAAM,eAAe,GAArB,MAAM,eAAe;IAIpB,AAAN,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAwB;QACtF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK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EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDASvE;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,6BAA6B,EAAE,CAAC;IAE1E,mBAAA,IAAA,kBAAG,EAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,2BAAY,CAAC,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAWP;0BAjIU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,eAAe,CAkI3B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { Payment } from './payment'\nimport { NewPayment, PaymentPatch } from './payment-type'\n\n@Resolver(Payment)\nexport class PaymentMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\")')\n @Mutation(returns => Payment, { description: 'To create new Payment' })\n async createPayment(@Arg('payment') payment: NewPayment, @Ctx() context: ResolverContext): Promise<Payment> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(Payment, tx).save({\n ...payment,\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 => Payment, { description: 'To modify Payment information' })\n async updatePayment(\n @Arg('id') id: string,\n @Arg('patch') patch: PaymentPatch,\n @Ctx() context: ResolverContext\n ): Promise<Payment> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(Payment, tx)\n const payment = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...payment,\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 => [Payment], { description: \"To modify multiple Payments' information\" })\n async updateMultiplePayment(\n @Arg('patches', type => [PaymentPatch]) patches: PaymentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Payment[]> {\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 paymentRepo = getRepository(Payment, 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 paymentRepo.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 payment = await paymentRepo.findOneBy({ id: updateRecord.id })\n\n const result = await paymentRepo.save({\n ...payment,\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 Payment' })\n async deletePayment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Payment, 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 Payments' })\n async deletePayments(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(Payment, 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 Payments' })\n async importPayments(\n @Arg('payments', type => [PaymentPatch]) payments: PaymentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n payments.map(async (payment: PaymentPatch) => {\n const createdPayment: Payment = await getRepository(Payment, tx).save({ domain, ...payment })\n })\n )\n\n return true\n }\n}\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
2
|
+
import { User } from '@things-factory/auth-base';
|
3
|
+
import { Payment } from './payment';
|
4
|
+
import { PaymentList } from './payment-type';
|
5
|
+
export declare class PaymentQuery {
|
6
|
+
payment(id: string, context: ResolverContext): Promise<Payment>;
|
7
|
+
payments(params: ListParam, context: ResolverContext): Promise<PaymentList>;
|
8
|
+
domain(payment: Payment): Promise<Domain>;
|
9
|
+
updater(payment: Payment): Promise<User>;
|
10
|
+
creator(payment: Payment): Promise<User>;
|
11
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PaymentQuery = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
8
|
+
const payment_1 = require("./payment");
|
9
|
+
const payment_type_1 = require("./payment-type");
|
10
|
+
let PaymentQuery = class PaymentQuery {
|
11
|
+
async payment(id, context) {
|
12
|
+
const { domain } = context.state;
|
13
|
+
return await (0, shell_1.getRepository)(payment_1.Payment).findOne({
|
14
|
+
where: { domain: { id: domain.id }, id }
|
15
|
+
});
|
16
|
+
}
|
17
|
+
async payments(params, context) {
|
18
|
+
const { domain } = context.state;
|
19
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
20
|
+
domain,
|
21
|
+
params,
|
22
|
+
repository: await (0, shell_1.getRepository)(payment_1.Payment),
|
23
|
+
searchables: []
|
24
|
+
});
|
25
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
26
|
+
return { items, total };
|
27
|
+
}
|
28
|
+
async domain(payment) {
|
29
|
+
return payment.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: payment.domainId }));
|
30
|
+
}
|
31
|
+
async updater(payment) {
|
32
|
+
return payment.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: payment.updaterId }));
|
33
|
+
}
|
34
|
+
async creator(payment) {
|
35
|
+
return payment.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: payment.creatorId }));
|
36
|
+
}
|
37
|
+
};
|
38
|
+
exports.PaymentQuery = PaymentQuery;
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
41
|
+
(0, type_graphql_1.Query)(returns => payment_1.Payment, { nullable: true, description: 'To fetch a Payment' }),
|
42
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
43
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
44
|
+
tslib_1.__metadata("design:type", Function),
|
45
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
46
|
+
tslib_1.__metadata("design:returntype", Promise)
|
47
|
+
], PaymentQuery.prototype, "payment", null);
|
48
|
+
tslib_1.__decorate([
|
49
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query")'),
|
50
|
+
(0, type_graphql_1.Query)(returns => payment_type_1.PaymentList, { description: 'To fetch multiple Payments' }),
|
51
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
52
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
53
|
+
tslib_1.__metadata("design:type", Function),
|
54
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
55
|
+
tslib_1.__metadata("design:returntype", Promise)
|
56
|
+
], PaymentQuery.prototype, "payments", null);
|
57
|
+
tslib_1.__decorate([
|
58
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
59
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
60
|
+
tslib_1.__metadata("design:type", Function),
|
61
|
+
tslib_1.__metadata("design:paramtypes", [payment_1.Payment]),
|
62
|
+
tslib_1.__metadata("design:returntype", Promise)
|
63
|
+
], PaymentQuery.prototype, "domain", null);
|
64
|
+
tslib_1.__decorate([
|
65
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
66
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
67
|
+
tslib_1.__metadata("design:type", Function),
|
68
|
+
tslib_1.__metadata("design:paramtypes", [payment_1.Payment]),
|
69
|
+
tslib_1.__metadata("design:returntype", Promise)
|
70
|
+
], PaymentQuery.prototype, "updater", null);
|
71
|
+
tslib_1.__decorate([
|
72
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
73
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
74
|
+
tslib_1.__metadata("design:type", Function),
|
75
|
+
tslib_1.__metadata("design:paramtypes", [payment_1.Payment]),
|
76
|
+
tslib_1.__metadata("design:returntype", Promise)
|
77
|
+
], PaymentQuery.prototype, "creator", null);
|
78
|
+
exports.PaymentQuery = PaymentQuery = tslib_1.__decorate([
|
79
|
+
(0, type_graphql_1.Resolver)(payment_1.Payment)
|
80
|
+
], PaymentQuery);
|
81
|
+
//# sourceMappingURL=payment-query.js.map
|