@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
@@ -54,7 +54,7 @@ tslib_1.__decorate([
|
|
54
54
|
], AccountingCategory.prototype, "parentId", void 0);
|
55
55
|
tslib_1.__decorate([
|
56
56
|
(0, typeorm_1.OneToMany)(type => AccountingCategory, accountingCategory => accountingCategory.parent),
|
57
|
-
(0, type_graphql_1.Field)(type => [AccountingCategory]),
|
57
|
+
(0, type_graphql_1.Field)(type => [AccountingCategory], { nullable: true }),
|
58
58
|
tslib_1.__metadata("design:type", Array)
|
59
59
|
], AccountingCategory.prototype, "children", void 0);
|
60
60
|
tslib_1.__decorate([
|
@@ -85,10 +85,21 @@ tslib_1.__decorate([
|
|
85
85
|
(0, typeorm_1.RelationId)((accountingCategory) => accountingCategory.updater),
|
86
86
|
tslib_1.__metadata("design:type", String)
|
87
87
|
], AccountingCategory.prototype, "updaterId", void 0);
|
88
|
+
tslib_1.__decorate([
|
89
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
90
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
91
|
+
tslib_1.__metadata("design:type", Date)
|
92
|
+
], AccountingCategory.prototype, "deletedAt", void 0);
|
88
93
|
exports.AccountingCategory = AccountingCategory = tslib_1.__decorate([
|
89
94
|
(0, typeorm_1.Entity)(),
|
90
|
-
(0, typeorm_1.Index)('ix_accounting_category_0', (accountingCategory) => [accountingCategory.domain, accountingCategory.name], {
|
91
|
-
|
95
|
+
(0, typeorm_1.Index)('ix_accounting_category_0', (accountingCategory) => [accountingCategory.domain, accountingCategory.name], {
|
96
|
+
unique: true,
|
97
|
+
where: '"deleted_at" IS NULL'
|
98
|
+
}),
|
99
|
+
(0, typeorm_1.Index)('ix_accounting_category_1', (accountingCategory) => [accountingCategory.domain, accountingCategory.code], {
|
100
|
+
unique: true,
|
101
|
+
where: '"deleted_at" IS NULL'
|
102
|
+
}),
|
92
103
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for AccountingCategory' })
|
93
104
|
], AccountingCategory);
|
94
105
|
//# sourceMappingURL=accounting-category.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accounting-category.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category.ts"],"names":[],"mappings":";;;;AAAA,
|
1
|
+
{"version":3,"file":"accounting-category.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAyD;AAEzD,iDAA8C;AAC9C,yDAAgD;AAoBzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAgE9B,CAAA;AAhEY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;;oDACjE;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;gDACnD;AAIb;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,o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ent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n@Entity()\n@Index(\n 'ix_accounting_category_0',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.name],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@Index(\n 'ix_accounting_category_1',\n (accountingCategory: AccountingCategory) => [accountingCategory.domain, accountingCategory.code],\n {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n }\n)\n@ObjectType({ description: 'Entity for AccountingCategory' })\nexport class AccountingCategory {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Account category code' })\n code?: 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 active?: boolean\n\n @ManyToOne(type => AccountingCategory, accountingCategory => accountingCategory.children, { nullable: true })\n @Field({ nullable: true })\n parent?: AccountingCategory\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.parent)\n parentId?: string\n\n @OneToMany(type => AccountingCategory, accountingCategory => accountingCategory.parent)\n @Field(type => [AccountingCategory], { nullable: true })\n children?: AccountingCategory[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingCategory: AccountingCategory) => accountingCategory.updater)\n updaterId?: string\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n}\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history';
|
2
|
+
import { AccountingCategory } from './accounting-category';
|
3
|
+
import { AccountingCategoryHistory } from './accounting-category-history';
|
4
|
+
export declare class AccountingCategoryHistoryEntitySubscriber extends HistoryEntitySubscriber<AccountingCategory, AccountingCategoryHistory> {
|
5
|
+
get entity(): typeof AccountingCategory;
|
6
|
+
get historyEntity(): typeof AccountingCategoryHistory;
|
7
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountingCategoryHistoryEntitySubscriber = 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 accounting_category_1 = require("./accounting-category");
|
8
|
+
const accounting_category_history_1 = require("./accounting-category-history");
|
9
|
+
let AccountingCategoryHistoryEntitySubscriber = class AccountingCategoryHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
|
10
|
+
get entity() {
|
11
|
+
return accounting_category_1.AccountingCategory;
|
12
|
+
}
|
13
|
+
get historyEntity() {
|
14
|
+
return accounting_category_history_1.AccountingCategoryHistory;
|
15
|
+
}
|
16
|
+
};
|
17
|
+
exports.AccountingCategoryHistoryEntitySubscriber = AccountingCategoryHistoryEntitySubscriber;
|
18
|
+
exports.AccountingCategoryHistoryEntitySubscriber = AccountingCategoryHistoryEntitySubscriber = tslib_1.__decorate([
|
19
|
+
(0, typeorm_1.EventSubscriber)()
|
20
|
+
], AccountingCategoryHistoryEntitySubscriber);
|
21
|
+
//# sourceMappingURL=event-subscriber.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/accounting-category/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,+DAA0D;AAC1D,+EAAyE;AAGlE,IAAM,yCAAyC,GAA/C,MAAM,yCAA0C,SAAQ,yCAG9D;IACC,IAAW,MAAM;QACf,OAAO,wCAAkB,CAAA;IAC3B,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,uDAAyB,CAAA;IAClC,CAAC;CACF,CAAA;AAXY,8FAAyC;oDAAzC,yCAAyC;IADrD,IAAA,yBAAe,GAAE;GACL,yCAAyC,CAWrD","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryHistory } from './accounting-category-history'\n\n@EventSubscriber()\nexport class AccountingCategoryHistoryEntitySubscriber extends HistoryEntitySubscriber<\n AccountingCategory,\n AccountingCategoryHistory\n> {\n public get entity() {\n return AccountingCategory\n }\n\n public get historyEntity() {\n return AccountingCategoryHistory\n }\n}\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { AccountingCategory } from './accounting-category';
|
2
2
|
import { AccountingCategoryQuery } from './accounting-category-query';
|
3
3
|
import { AccountingCategoryMutation } from './accounting-category-mutation';
|
4
|
+
import { AccountingCategoryHistoryEntitySubscriber } from './event-subscriber';
|
4
5
|
export declare const entities: (typeof AccountingCategory)[];
|
5
6
|
export declare const resolvers: (typeof AccountingCategoryQuery | typeof AccountingCategoryMutation)[];
|
6
|
-
export declare const subscribers:
|
7
|
+
export declare const subscribers: (typeof AccountingCategoryHistoryEntitySubscriber)[];
|
@@ -4,7 +4,9 @@ exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
4
|
const accounting_category_1 = require("./accounting-category");
|
5
5
|
const accounting_category_query_1 = require("./accounting-category-query");
|
6
6
|
const accounting_category_mutation_1 = require("./accounting-category-mutation");
|
7
|
-
|
7
|
+
const accounting_category_history_1 = require("./accounting-category-history");
|
8
|
+
const event_subscriber_1 = require("./event-subscriber");
|
9
|
+
exports.entities = [accounting_category_1.AccountingCategory, accounting_category_history_1.AccountingCategoryHistory];
|
8
10
|
exports.resolvers = [accounting_category_query_1.AccountingCategoryQuery, accounting_category_mutation_1.AccountingCategoryMutation];
|
9
|
-
exports.subscribers = [];
|
11
|
+
exports.subscribers = [event_subscriber_1.AccountingCategoryHistoryEntitySubscriber];
|
10
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/accounting-category/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,2EAAqE;AACrE,iFAA2E;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/accounting-category/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,2EAAqE;AACrE,iFAA2E;AAC3E,+EAAyE;AACzE,yDAA8E;AAEjE,QAAA,QAAQ,GAAG,CAAC,wCAAkB,EAAE,uDAAyB,CAAC,CAAA;AAC1D,QAAA,SAAS,GAAG,CAAC,mDAAuB,EAAE,yDAA0B,CAAC,CAAA;AACjE,QAAA,WAAW,GAAG,CAAC,4DAAyC,CAAC,CAAA","sourcesContent":["import { AccountingCategory } from './accounting-category'\nimport { AccountingCategoryQuery } from './accounting-category-query'\nimport { AccountingCategoryMutation } from './accounting-category-mutation'\nimport { AccountingCategoryHistory } from './accounting-category-history'\nimport { AccountingCategoryHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [AccountingCategory, AccountingCategoryHistory]\nexport const resolvers = [AccountingCategoryQuery, AccountingCategoryMutation]\nexport const subscribers = [AccountingCategoryHistoryEntitySubscriber]\n"]}
|
@@ -0,0 +1,26 @@
|
|
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 { AccountingDocument } from './accounting-document';
|
6
|
+
export declare class AccountingDocumentHistory implements HistoryEntityInterface<AccountingDocument> {
|
7
|
+
readonly id: string;
|
8
|
+
version?: number;
|
9
|
+
domain?: Domain;
|
10
|
+
domainId?: string;
|
11
|
+
transaction: Transaction;
|
12
|
+
transactionId: string;
|
13
|
+
documentType: string;
|
14
|
+
documentUrl: string;
|
15
|
+
description?: string;
|
16
|
+
createdAt?: Date;
|
17
|
+
updatedAt?: Date;
|
18
|
+
deletedAt?: Date;
|
19
|
+
creator?: User;
|
20
|
+
creatorId?: string;
|
21
|
+
updater?: User;
|
22
|
+
updaterId?: string;
|
23
|
+
thumbnail?: string;
|
24
|
+
originalId: string;
|
25
|
+
action: HistoryActionType;
|
26
|
+
}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountingDocumentHistory = 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 ORMCONFIG = env_1.config.get('ormconfig', {});
|
13
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
14
|
+
let AccountingDocumentHistory = class AccountingDocumentHistory {
|
15
|
+
constructor() {
|
16
|
+
this.version = 1;
|
17
|
+
}
|
18
|
+
};
|
19
|
+
exports.AccountingDocumentHistory = AccountingDocumentHistory;
|
20
|
+
tslib_1.__decorate([
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
22
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
23
|
+
tslib_1.__metadata("design:type", String)
|
24
|
+
], AccountingDocumentHistory.prototype, "id", void 0);
|
25
|
+
tslib_1.__decorate([
|
26
|
+
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
28
|
+
tslib_1.__metadata("design:type", Number)
|
29
|
+
], AccountingDocumentHistory.prototype, "version", void 0);
|
30
|
+
tslib_1.__decorate([
|
31
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
33
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
34
|
+
], AccountingDocumentHistory.prototype, "domain", void 0);
|
35
|
+
tslib_1.__decorate([
|
36
|
+
(0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.domain),
|
37
|
+
tslib_1.__metadata("design:type", String)
|
38
|
+
], AccountingDocumentHistory.prototype, "domainId", void 0);
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, typeorm_1.ManyToOne)(type => transaction_1.Transaction, transaction => transaction.documents),
|
41
|
+
(0, type_graphql_1.Field)(type => transaction_1.Transaction),
|
42
|
+
tslib_1.__metadata("design:type", transaction_1.Transaction)
|
43
|
+
], AccountingDocumentHistory.prototype, "transaction", void 0);
|
44
|
+
tslib_1.__decorate([
|
45
|
+
(0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.transaction),
|
46
|
+
tslib_1.__metadata("design:type", String)
|
47
|
+
], AccountingDocumentHistory.prototype, "transactionId", void 0);
|
48
|
+
tslib_1.__decorate([
|
49
|
+
(0, typeorm_1.Column)(),
|
50
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
51
|
+
tslib_1.__metadata("design:type", String)
|
52
|
+
], AccountingDocumentHistory.prototype, "documentType", void 0);
|
53
|
+
tslib_1.__decorate([
|
54
|
+
(0, typeorm_1.Column)(),
|
55
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
56
|
+
tslib_1.__metadata("design:type", String)
|
57
|
+
], AccountingDocumentHistory.prototype, "documentUrl", void 0);
|
58
|
+
tslib_1.__decorate([
|
59
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
61
|
+
tslib_1.__metadata("design:type", String)
|
62
|
+
], AccountingDocumentHistory.prototype, "description", void 0);
|
63
|
+
tslib_1.__decorate([
|
64
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
65
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
66
|
+
tslib_1.__metadata("design:type", Date)
|
67
|
+
], AccountingDocumentHistory.prototype, "createdAt", void 0);
|
68
|
+
tslib_1.__decorate([
|
69
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
71
|
+
tslib_1.__metadata("design:type", Date)
|
72
|
+
], AccountingDocumentHistory.prototype, "updatedAt", void 0);
|
73
|
+
tslib_1.__decorate([
|
74
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
75
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
76
|
+
tslib_1.__metadata("design:type", Date)
|
77
|
+
], AccountingDocumentHistory.prototype, "deletedAt", void 0);
|
78
|
+
tslib_1.__decorate([
|
79
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
80
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
81
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
82
|
+
], AccountingDocumentHistory.prototype, "creator", void 0);
|
83
|
+
tslib_1.__decorate([
|
84
|
+
(0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.creator),
|
85
|
+
tslib_1.__metadata("design:type", String)
|
86
|
+
], AccountingDocumentHistory.prototype, "creatorId", void 0);
|
87
|
+
tslib_1.__decorate([
|
88
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
89
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
90
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
91
|
+
], AccountingDocumentHistory.prototype, "updater", void 0);
|
92
|
+
tslib_1.__decorate([
|
93
|
+
(0, typeorm_1.RelationId)((accountingDocument) => accountingDocument.updater),
|
94
|
+
tslib_1.__metadata("design:type", String)
|
95
|
+
], AccountingDocumentHistory.prototype, "updaterId", void 0);
|
96
|
+
tslib_1.__decorate([
|
97
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
98
|
+
tslib_1.__metadata("design:type", String)
|
99
|
+
], AccountingDocumentHistory.prototype, "thumbnail", void 0);
|
100
|
+
tslib_1.__decorate([
|
101
|
+
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
102
|
+
tslib_1.__metadata("design:type", String)
|
103
|
+
], AccountingDocumentHistory.prototype, "originalId", void 0);
|
104
|
+
tslib_1.__decorate([
|
105
|
+
(0, typeorm_history_1.HistoryActionColumn)({
|
106
|
+
nullable: false,
|
107
|
+
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
108
|
+
? 'enum'
|
109
|
+
: DATABASE_TYPE == 'oracle'
|
110
|
+
? 'varchar2'
|
111
|
+
: 'smallint',
|
112
|
+
enum: typeorm_history_1.HistoryActionType
|
113
|
+
}),
|
114
|
+
tslib_1.__metadata("design:type", String)
|
115
|
+
], AccountingDocumentHistory.prototype, "action", void 0);
|
116
|
+
exports.AccountingDocumentHistory = AccountingDocumentHistory = tslib_1.__decorate([
|
117
|
+
(0, typeorm_1.Entity)(),
|
118
|
+
(0, typeorm_1.Index)('ix_accounting-document_history_0', (accountingDocumentHistory) => [
|
119
|
+
accountingDocumentHistory.originalId,
|
120
|
+
accountingDocumentHistory.version
|
121
|
+
], { unique: true }),
|
122
|
+
(0, typeorm_1.Index)('ix_accounting-document_history_1', (accountingDocumentHistory) => [
|
123
|
+
accountingDocumentHistory.domain,
|
124
|
+
accountingDocumentHistory.originalId,
|
125
|
+
accountingDocumentHistory.version
|
126
|
+
], { unique: true }),
|
127
|
+
(0, type_graphql_1.ObjectType)({ description: 'History Entity of AccountingDocument' })
|
128
|
+
], AccountingDocumentHistory);
|
129
|
+
//# sourceMappingURL=accounting-document-history.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"accounting-document-history.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,4DAAwD;AAGxD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAqB7B,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAOL,YAAO,GAAY,CAAC,CAAA;IAuEtB,CAAC;CAAA,CAAA;AA9EY,8DAAyB;AAG3B;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;qDACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;yDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBA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,eAAK,EACJ,kCAAkC,EAClC,CAAC,yBAAoD,EAAE,EAAE,CAAC;QACxD,yBAAyB,CAAC,MAAM;QAChC,yBAAyB,CAAC,UAAU;QACpC,yBAAyB,CAAC,OAAO;KAClC,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,yBAAyB,CA8ErC","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 { AccountingDocument } from './accounting-document'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_accounting-document_history_0',\n (accountingDocumentHistory: AccountingDocumentHistory) => [\n accountingDocumentHistory.originalId,\n accountingDocumentHistory.version\n ],\n { unique: true }\n)\n@Index(\n 'ix_accounting-document_history_1',\n (accountingDocumentHistory: AccountingDocumentHistory) => [\n accountingDocumentHistory.domain,\n accountingDocumentHistory.originalId,\n accountingDocumentHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of AccountingDocument' })\nexport class AccountingDocumentHistory implements HistoryEntityInterface<AccountingDocument> {\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((accountingDocument: AccountingDocument) => accountingDocument.domain)\n domainId?: string\n\n @ManyToOne(type => Transaction, transaction => transaction.documents)\n @Field(type => Transaction)\n transaction: Transaction\n\n @RelationId((accountingDocument: AccountingDocument) => accountingDocument.transaction)\n transactionId: string\n\n @Column()\n @Field({ nullable: false })\n documentType: string // 문서의 유형 (예: 계약서, 인보이스 등)\n\n @Column()\n @Field({ nullable: false })\n documentUrl: string // 문서의 URL 또는 파일 경로\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: 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((accountingDocument: AccountingDocument) => accountingDocument.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((accountingDocument: AccountingDocument) => accountingDocument.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 { AccountingDocument } from './accounting-document';
|
2
|
+
import { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type';
|
3
|
+
export declare class AccountingDocumentMutation {
|
4
|
+
createAccountingDocument(accountingDocument: NewAccountingDocument, context: ResolverContext): Promise<AccountingDocument>;
|
5
|
+
updateAccountingDocument(id: string, patch: AccountingDocumentPatch, context: ResolverContext): Promise<AccountingDocument>;
|
6
|
+
updateMultipleAccountingDocument(patches: AccountingDocumentPatch[], context: ResolverContext): Promise<AccountingDocument[]>;
|
7
|
+
deleteAccountingDocument(id: string, context: ResolverContext): Promise<boolean>;
|
8
|
+
deleteAccountingDocuments(ids: string[], context: ResolverContext): Promise<boolean>;
|
9
|
+
importAccountingDocuments(accountingDocuments: AccountingDocumentPatch[], context: ResolverContext): Promise<boolean>;
|
10
|
+
}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountingDocumentMutation = 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 accounting_document_1 = require("./accounting-document");
|
9
|
+
const accounting_document_type_1 = require("./accounting-document-type");
|
10
|
+
let AccountingDocumentMutation = class AccountingDocumentMutation {
|
11
|
+
async createAccountingDocument(accountingDocument, context) {
|
12
|
+
const { domain, user, tx } = context.state;
|
13
|
+
const result = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save(Object.assign(Object.assign({}, accountingDocument), { domain, creator: user, updater: user }));
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
async updateAccountingDocument(id, patch, context) {
|
17
|
+
const { domain, user, tx } = context.state;
|
18
|
+
const repository = (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx);
|
19
|
+
const accountingDocument = await repository.findOne({
|
20
|
+
where: { domain: { id: domain.id }, id }
|
21
|
+
});
|
22
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, accountingDocument), patch), { updater: user }));
|
23
|
+
return result;
|
24
|
+
}
|
25
|
+
async updateMultipleAccountingDocument(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 accountingDocumentRepo = (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx);
|
31
|
+
if (_createRecords.length > 0) {
|
32
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
33
|
+
const newRecord = _createRecords[i];
|
34
|
+
const result = await accountingDocumentRepo.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 accountingDocument = await accountingDocumentRepo.findOneBy({ id: updateRecord.id });
|
42
|
+
const result = await accountingDocumentRepo.save(Object.assign(Object.assign(Object.assign({}, accountingDocument), updateRecord), { updater: user }));
|
43
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return results;
|
47
|
+
}
|
48
|
+
async deleteAccountingDocument(id, context) {
|
49
|
+
const { domain, tx } = context.state;
|
50
|
+
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).delete({ domain: { id: domain.id }, id });
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
async deleteAccountingDocuments(ids, context) {
|
54
|
+
const { domain, tx } = context.state;
|
55
|
+
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).delete({
|
56
|
+
domain: { id: domain.id },
|
57
|
+
id: (0, typeorm_1.In)(ids)
|
58
|
+
});
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
async importAccountingDocuments(accountingDocuments, context) {
|
62
|
+
const { domain, tx } = context.state;
|
63
|
+
await Promise.all(accountingDocuments.map(async (accountingDocument) => {
|
64
|
+
const createdAccountingDocument = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save(Object.assign({ domain }, accountingDocument));
|
65
|
+
}));
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
exports.AccountingDocumentMutation = AccountingDocumentMutation;
|
70
|
+
tslib_1.__decorate([
|
71
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
72
|
+
(0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To create new AccountingDocument' }),
|
73
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocument')),
|
74
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
75
|
+
tslib_1.__metadata("design:type", Function),
|
76
|
+
tslib_1.__metadata("design:paramtypes", [accounting_document_type_1.NewAccountingDocument, Object]),
|
77
|
+
tslib_1.__metadata("design:returntype", Promise)
|
78
|
+
], AccountingDocumentMutation.prototype, "createAccountingDocument", null);
|
79
|
+
tslib_1.__decorate([
|
80
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
81
|
+
(0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To modify AccountingDocument information' }),
|
82
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
83
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
84
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
85
|
+
tslib_1.__metadata("design:type", Function),
|
86
|
+
tslib_1.__metadata("design:paramtypes", [String, accounting_document_type_1.AccountingDocumentPatch, Object]),
|
87
|
+
tslib_1.__metadata("design:returntype", Promise)
|
88
|
+
], AccountingDocumentMutation.prototype, "updateAccountingDocument", null);
|
89
|
+
tslib_1.__decorate([
|
90
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
91
|
+
(0, type_graphql_1.Mutation)(returns => [accounting_document_1.AccountingDocument], { description: "To modify multiple AccountingDocuments' information" }),
|
92
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [accounting_document_type_1.AccountingDocumentPatch])),
|
93
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
94
|
+
tslib_1.__metadata("design:type", Function),
|
95
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
96
|
+
tslib_1.__metadata("design:returntype", Promise)
|
97
|
+
], AccountingDocumentMutation.prototype, "updateMultipleAccountingDocument", null);
|
98
|
+
tslib_1.__decorate([
|
99
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
100
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete AccountingDocument' }),
|
101
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
102
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
103
|
+
tslib_1.__metadata("design:type", Function),
|
104
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
105
|
+
tslib_1.__metadata("design:returntype", Promise)
|
106
|
+
], AccountingDocumentMutation.prototype, "deleteAccountingDocument", null);
|
107
|
+
tslib_1.__decorate([
|
108
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
109
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple AccountingDocuments' }),
|
110
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
111
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
112
|
+
tslib_1.__metadata("design:type", Function),
|
113
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
114
|
+
tslib_1.__metadata("design:returntype", Promise)
|
115
|
+
], AccountingDocumentMutation.prototype, "deleteAccountingDocuments", null);
|
116
|
+
tslib_1.__decorate([
|
117
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
118
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple AccountingDocuments' }),
|
119
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocuments', type => [accounting_document_type_1.AccountingDocumentPatch])),
|
120
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
121
|
+
tslib_1.__metadata("design:type", Function),
|
122
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
123
|
+
tslib_1.__metadata("design:returntype", Promise)
|
124
|
+
], AccountingDocumentMutation.prototype, "importAccountingDocuments", null);
|
125
|
+
exports.AccountingDocumentMutation = AccountingDocumentMutation = tslib_1.__decorate([
|
126
|
+
(0, type_graphql_1.Resolver)(accounting_document_1.AccountingDocument)
|
127
|
+
], AccountingDocumentMutation);
|
128
|
+
//# sourceMappingURL=accounting-document-mutation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"accounting-document-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CAA4B,kBAAyC,EAAS,OAAwB;QAClI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,iCAC1D,kBAAkB,KACrB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAClD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,C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AAC,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kFAwCP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0EAM3D;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;qCA/HU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAgItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingDocument } from './accounting-document'\nimport { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentMutation {\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To create new AccountingDocument' })\n async createAccountingDocument(@Arg('accountingDocument') accountingDocument: NewAccountingDocument, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingDocument, tx).save({\n ...accountingDocument,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To modify AccountingDocument information' })\n async updateAccountingDocument(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingDocumentPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingDocument, tx)\n const accountingDocument = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingDocument,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [AccountingDocument], { description: \"To modify multiple AccountingDocuments' information\" })\n async updateMultipleAccountingDocument(\n @Arg('patches', type => [AccountingDocumentPatch]) patches: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument[]> {\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 accountingDocumentRepo = getRepository(AccountingDocument, 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 accountingDocumentRepo.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 accountingDocument = await accountingDocumentRepo.findOneBy({ id: updateRecord.id })\n\n const result = await accountingDocumentRepo.save({\n ...accountingDocument,\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 @Mutation(returns => Boolean, { description: 'To delete AccountingDocument' })\n async deleteAccountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingDocuments' })\n async deleteAccountingDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingDocuments' })\n async importAccountingDocuments(\n @Arg('accountingDocuments', type => [AccountingDocumentPatch]) accountingDocuments: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingDocuments.map(async (accountingDocument: AccountingDocumentPatch) => {\n const createdAccountingDocument: AccountingDocument = await getRepository(AccountingDocument, tx).save({ domain, ...accountingDocument })\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 { AccountingDocument } from './accounting-document';
|
4
|
+
import { AccountingDocumentList } from './accounting-document-type';
|
5
|
+
export declare class AccountingDocumentQuery {
|
6
|
+
accountingDocument(id: string, context: ResolverContext): Promise<AccountingDocument>;
|
7
|
+
accountingDocuments(params: ListParam, context: ResolverContext): Promise<AccountingDocumentList>;
|
8
|
+
domain(accountingDocument: AccountingDocument): Promise<Domain>;
|
9
|
+
updater(accountingDocument: AccountingDocument): Promise<User>;
|
10
|
+
creator(accountingDocument: AccountingDocument): Promise<User>;
|
11
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AccountingDocumentQuery = 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 accounting_document_1 = require("./accounting-document");
|
9
|
+
const accounting_document_type_1 = require("./accounting-document-type");
|
10
|
+
let AccountingDocumentQuery = class AccountingDocumentQuery {
|
11
|
+
async accountingDocument(id, context) {
|
12
|
+
const { domain } = context.state;
|
13
|
+
return await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument).findOne({
|
14
|
+
where: { domain: { id: domain.id }, id }
|
15
|
+
});
|
16
|
+
}
|
17
|
+
async accountingDocuments(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)(accounting_document_1.AccountingDocument),
|
23
|
+
searchables: ['name', 'description']
|
24
|
+
});
|
25
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
26
|
+
return { items, total };
|
27
|
+
}
|
28
|
+
async domain(accountingDocument) {
|
29
|
+
return accountingDocument.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: accountingDocument.domainId }));
|
30
|
+
}
|
31
|
+
async updater(accountingDocument) {
|
32
|
+
return accountingDocument.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: accountingDocument.updaterId }));
|
33
|
+
}
|
34
|
+
async creator(accountingDocument) {
|
35
|
+
return accountingDocument.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: accountingDocument.creatorId }));
|
36
|
+
}
|
37
|
+
};
|
38
|
+
exports.AccountingDocumentQuery = AccountingDocumentQuery;
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, type_graphql_1.Query)(returns => accounting_document_1.AccountingDocument, { nullable: true, description: 'To fetch a AccountingDocument' }),
|
41
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
42
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
43
|
+
tslib_1.__metadata("design:type", Function),
|
44
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
45
|
+
tslib_1.__metadata("design:returntype", Promise)
|
46
|
+
], AccountingDocumentQuery.prototype, "accountingDocument", null);
|
47
|
+
tslib_1.__decorate([
|
48
|
+
(0, type_graphql_1.Query)(returns => accounting_document_type_1.AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' }),
|
49
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
50
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
51
|
+
tslib_1.__metadata("design:type", Function),
|
52
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
53
|
+
tslib_1.__metadata("design:returntype", Promise)
|
54
|
+
], AccountingDocumentQuery.prototype, "accountingDocuments", null);
|
55
|
+
tslib_1.__decorate([
|
56
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
57
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
58
|
+
tslib_1.__metadata("design:type", Function),
|
59
|
+
tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
|
60
|
+
tslib_1.__metadata("design:returntype", Promise)
|
61
|
+
], AccountingDocumentQuery.prototype, "domain", null);
|
62
|
+
tslib_1.__decorate([
|
63
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
64
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
66
|
+
tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
68
|
+
], AccountingDocumentQuery.prototype, "updater", null);
|
69
|
+
tslib_1.__decorate([
|
70
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
71
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
72
|
+
tslib_1.__metadata("design:type", Function),
|
73
|
+
tslib_1.__metadata("design:paramtypes", [accounting_document_1.AccountingDocument]),
|
74
|
+
tslib_1.__metadata("design:returntype", Promise)
|
75
|
+
], AccountingDocumentQuery.prototype, "creator", null);
|
76
|
+
exports.AccountingDocumentQuery = AccountingDocumentQuery = tslib_1.__decorate([
|
77
|
+
(0, type_graphql_1.Resolver)(accounting_document_1.AccountingDocument)
|
78
|
+
], AccountingDocumentQuery);
|
79
|
+
//# sourceMappingURL=accounting-document-query.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"accounting-document-query.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAE5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAS,OAAwB;QAC7E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YACrD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,mBAAmB,CAA0B,MAAiB,EAAS,OAAwB;QACnG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,E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AAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IACxE,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;kEAanE;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCAvCU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAwCnC","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 { AccountingDocument } from './accounting-document'\nimport { AccountingDocumentList } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentQuery {\n @Query(returns => AccountingDocument!, { nullable: true, description: 'To fetch a AccountingDocument' })\n async accountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain } = context.state\n\n return await getRepository(AccountingDocument).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' })\n async accountingDocuments(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<AccountingDocumentList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingDocument),\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() accountingDocument: AccountingDocument): Promise<Domain> {\n return accountingDocument.domainId && (await getRepository(Domain).findOneBy({ id: accountingDocument.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.updaterId && (await getRepository(User).findOneBy({ id: accountingDocument.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.creatorId && (await getRepository(User).findOneBy({ id: accountingDocument.creatorId }))\n }\n}\n"]}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { ObjectRef } from '@things-factory/shell';
|
2
|
+
import { AccountingDocument } from './accounting-document';
|
3
|
+
export declare class NewAccountingDocument {
|
4
|
+
transaction: ObjectRef;
|
5
|
+
documentType: string;
|
6
|
+
documentUrl: string;
|
7
|
+
description?: string;
|
8
|
+
}
|
9
|
+
export declare class AccountingDocumentPatch {
|
10
|
+
id?: string;
|
11
|
+
transaction: ObjectRef;
|
12
|
+
documentType: string;
|
13
|
+
documentUrl: string;
|
14
|
+
description?: string;
|
15
|
+
cuFlag?: string;
|
16
|
+
}
|
17
|
+
export declare class AccountingDocumentList {
|
18
|
+
items: AccountingDocument[];
|
19
|
+
total: number;
|
20
|
+
}
|