@things-factory/accounting 7.0.6 → 7.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/activities/activity-book-edit.ts +1 -1
- package/client/activities/activity-book-view.ts +1 -1
- package/client/activities/activity-expense-edit.ts +1 -1
- package/client/activities/activity-expense-view.ts +1 -1
- package/client/bootstrap.ts +10 -1
- package/client/components/accounting-category-selector.ts +136 -0
- package/client/components/accounting-category-view.ts +75 -0
- package/client/grist-editors/grist-editor-accounting-category-object.ts +83 -0
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +13 -0
- package/client/pages/account/account-importer.ts +19 -8
- package/client/pages/account/account-list-page.ts +38 -8
- package/client/pages/accounting-category/accounting-category-importer.ts +19 -8
- package/client/pages/accounting-category/accounting-category-list-page.ts +36 -6
- package/client/pages/accounting-category/accounting-category-tree-page.ts +338 -0
- package/client/pages/accounting-document/accounting-document-importer.ts +90 -0
- package/client/pages/accounting-document/accounting-document-list-page.ts +398 -0
- package/client/pages/financial-statement/financial-statement-importer.ts +19 -8
- package/client/pages/financial-statement/financial-statement-list-page.ts +5 -6
- package/client/pages/fiscal-month/fiscal-month-importer.ts +90 -0
- package/client/pages/fiscal-month/fiscal-month-list-page.ts +398 -0
- package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +90 -0
- package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +398 -0
- package/client/pages/fiscal-year/fiscal-year-importer.ts +90 -0
- package/client/pages/fiscal-year/fiscal-year-list-page.ts +398 -0
- package/client/pages/income-statement/income-statement-importer.ts +19 -8
- package/client/pages/income-statement/income-statement-list-page.ts +5 -6
- package/client/pages/{ledger/ledger-importer.ts → payment/payment-importer.ts} +13 -9
- package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -58
- package/client/pages/transaction/transaction-importer.ts +19 -8
- package/client/pages/transaction/transaction-list-page.ts +5 -6
- package/client/route.ts +16 -8
- package/client/types/accounting-category.ts +23 -0
- package/client/types/index.ts +1 -0
- package/dist-client/activities/activity-book-edit.js +1 -1
- package/dist-client/activities/activity-book-edit.js.map +1 -1
- package/dist-client/activities/activity-book-view.js +1 -1
- package/dist-client/activities/activity-book-view.js.map +1 -1
- package/dist-client/activities/activity-expense-edit.js +1 -1
- package/dist-client/activities/activity-expense-edit.js.map +1 -1
- package/dist-client/activities/activity-expense-view.js +1 -1
- package/dist-client/activities/activity-expense-view.js.map +1 -1
- package/dist-client/bootstrap.js +7 -1
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/components/accounting-category-selector.d.ts +16 -0
- package/dist-client/components/accounting-category-selector.js +134 -0
- package/dist-client/components/accounting-category-selector.js.map +1 -0
- package/dist-client/components/accounting-category-view.d.ts +14 -0
- package/dist-client/components/accounting-category-view.js +81 -0
- package/dist-client/components/accounting-category-view.js.map +1 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
- package/dist-client/pages/account/account-importer.d.ts +0 -1
- package/dist-client/pages/account/account-importer.js +12 -5
- package/dist-client/pages/account/account-importer.js.map +1 -1
- package/dist-client/pages/account/account-list-page.js +38 -8
- package/dist-client/pages/account/account-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +0 -1
- package/dist-client/pages/accounting-category/accounting-category-importer.js +12 -5
- package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +36 -6
- package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -1
- package/dist-client/pages/financial-statement/financial-statement-importer.js +12 -5
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -1
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +5 -6
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -1
- package/dist-client/pages/fiscal-month/fiscal-month-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-month/fiscal-month-importer.js +93 -0
- package/dist-client/pages/fiscal-month/fiscal-month-importer.js.map +1 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.js +370 -0
- package/dist-client/pages/fiscal-month/fiscal-month-list-page.js.map +1 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js +93 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-importer.js.map +1 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js +370 -0
- package/dist-client/pages/fiscal-quarter/fiscal-quarter-list-page.js.map +1 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.d.ts +23 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.js +93 -0
- package/dist-client/pages/fiscal-year/fiscal-year-importer.js.map +1 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.d.ts +66 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.js +370 -0
- package/dist-client/pages/fiscal-year/fiscal-year-list-page.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -1
- package/dist-client/pages/income-statement/income-statement-importer.js +12 -5
- package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -1
- package/dist-client/pages/income-statement/income-statement-list-page.js +5 -6
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -1
- package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +2 -2
- package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +11 -11
- package/dist-client/pages/payment/payment-importer.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-list-page.d.ts → payment/payment-list-page.d.ts} +12 -8
- package/dist-client/pages/{ledger/ledger-list-page.js → payment/payment-list-page.js} +114 -68
- package/dist-client/pages/payment/payment-list-page.js.map +1 -0
- package/dist-client/pages/transaction/transaction-importer.d.ts +0 -1
- package/dist-client/pages/transaction/transaction-importer.js +12 -5
- package/dist-client/pages/transaction/transaction-importer.js.map +1 -1
- package/dist-client/pages/transaction/transaction-list-page.js +5 -6
- package/dist-client/pages/transaction/transaction-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +9 -3
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types/accounting-category.d.ts +16 -0
- package/dist-client/types/accounting-category.js +3 -0
- package/dist-client/types/accounting-category.js.map +1 -0
- package/dist-client/types/index.d.ts +1 -0
- package/dist-client/types/index.js +2 -0
- package/dist-client/types/index.js.map +1 -0
- package/dist-server/activities/activity-book.js +31 -19
- package/dist-server/activities/activity-book.js.map +1 -1
- package/dist-server/controllers/index.d.ts +1 -0
- package/dist-server/controllers/index.js +4 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/summary-statements.d.ts +4 -0
- package/dist-server/controllers/summary-statements.js +149 -0
- package/dist-server/controllers/summary-statements.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +2 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.d.ts +5 -0
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +95 -0
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -0
- package/dist-server/migrations/1725201467183-seed-accounts.d.ts +5 -0
- package/dist-server/migrations/1725201467183-seed-accounts.js +318 -0
- package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -0
- package/dist-server/service/account/account-history.d.ts +4 -1
- package/dist-server/service/account/account-history.js +17 -7
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +13 -9
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-query.js +3 -1
- package/dist-server/service/account/account-query.js.map +1 -1
- package/dist-server/service/account/account.d.ts +1 -1
- package/dist-server/service/account/account.js +16 -5
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/account/index.d.ts +1 -2
- package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
- package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
- package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +24 -1
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-type.d.ts +2 -0
- package/dist-server/service/accounting-category/accounting-category-type.js +8 -0
- package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category.d.ts +2 -0
- package/dist-server/service/accounting-category/accounting-category.js +20 -3
- package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
- package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-category/event-subscriber.js +21 -0
- package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-category/index.d.ts +2 -1
- package/dist-server/service/accounting-category/index.js +4 -2
- package/dist-server/service/accounting-category/index.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
- package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
- package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
- package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
- package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
- package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
- package/dist-server/service/accounting-document/accounting-document.js +104 -0
- package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
- package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-document/event-subscriber.js +21 -0
- package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-document/index.d.ts +7 -0
- package/dist-server/service/accounting-document/index.js +12 -0
- package/dist-server/service/accounting-document/index.js.map +1 -0
- package/dist-server/service/common-type.d.ts +5 -0
- package/dist-server/service/common-type.js +15 -0
- package/dist-server/service/common-type.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
- package/dist-server/service/financial-statement/financial-statement-history.js +33 -23
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.js +3 -1
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
- package/dist-server/service/financial-statement/financial-statement.js +45 -24
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +2 -2
- package/dist-server/service/financial-statement/index.js +2 -1
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-mutation.d.ts +10 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js +134 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.d.ts +11 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js +83 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.d.ts +26 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.js +98 -0
- package/dist-server/service/fiscal-month/fiscal-month-type.js.map +1 -0
- package/dist-server/service/fiscal-month/fiscal-month.d.ts +22 -0
- package/dist-server/service/fiscal-month/fiscal-month.js +99 -0
- package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -0
- package/dist-server/service/fiscal-month/index.d.ts +6 -0
- package/dist-server/service/fiscal-month/index.js +10 -0
- package/dist-server/service/fiscal-month/index.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.d.ts +10 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +134 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.d.ts +11 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +85 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.d.ts +24 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js +90 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-type.js.map +1 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.d.ts +21 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js +94 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -0
- package/dist-server/service/fiscal-quarter/index.d.ts +6 -0
- package/dist-server/service/fiscal-quarter/index.js +10 -0
- package/dist-server/service/fiscal-quarter/index.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.d.ts +10 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js +134 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.d.ts +11 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js +81 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.d.ts +22 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.js +82 -0
- package/dist-server/service/fiscal-year/fiscal-year-type.js.map +1 -0
- package/dist-server/service/fiscal-year/fiscal-year.d.ts +20 -0
- package/dist-server/service/fiscal-year/fiscal-year.js +89 -0
- package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -0
- package/dist-server/service/fiscal-year/index.d.ts +6 -0
- package/dist-server/service/fiscal-year/index.js +10 -0
- package/dist-server/service/fiscal-year/index.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
- package/dist-server/service/income-statement/income-statement-history.js +38 -23
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
- package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
- package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
- package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-query.js +3 -1
- package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
- package/dist-server/service/income-statement/income-statement.d.ts +2 -0
- package/dist-server/service/income-statement/income-statement.js +46 -26
- package/dist-server/service/income-statement/income-statement.js.map +1 -1
- package/dist-server/service/income-statement/index.d.ts +2 -2
- package/dist-server/service/income-statement/index.js +2 -1
- package/dist-server/service/income-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +7 -2
- package/dist-server/service/index.js +29 -3
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/event-subscriber.d.ts +7 -0
- package/dist-server/service/payment/event-subscriber.js +21 -0
- package/dist-server/service/payment/event-subscriber.js.map +1 -0
- package/dist-server/service/payment/index.d.ts +8 -0
- package/dist-server/service/payment/index.js +12 -0
- package/dist-server/service/payment/index.js.map +1 -0
- package/dist-server/service/payment/payment-history.d.ts +30 -0
- package/dist-server/service/payment/payment-history.js +143 -0
- package/dist-server/service/payment/payment-history.js.map +1 -0
- package/dist-server/service/payment/payment-mutation.d.ts +10 -0
- package/dist-server/service/payment/payment-mutation.js +134 -0
- package/dist-server/service/payment/payment-mutation.js.map +1 -0
- package/dist-server/service/payment/payment-query.d.ts +11 -0
- package/dist-server/service/payment/payment-query.js +81 -0
- package/dist-server/service/payment/payment-query.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +24 -0
- package/dist-server/service/payment/payment-type.js +90 -0
- package/dist-server/service/payment/payment-type.js.map +1 -0
- package/dist-server/service/payment/payment.d.ts +30 -0
- package/dist-server/service/payment/payment.js +146 -0
- package/dist-server/service/payment/payment.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.d.ts +15 -3
- package/dist-server/service/transaction/transaction-history.js +64 -8
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -9
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-query.js +3 -1
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +31 -6
- package/dist-server/service/transaction/transaction.js +138 -27
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/accounting-document.md +160 -0
- package/helps/accounting/contract.md +160 -0
- package/helps/accounting/fiscal-month.md +160 -0
- package/helps/accounting/fiscal-quarter.md +160 -0
- package/helps/accounting/fiscal-year.md +160 -0
- package/helps/accounting/payment.md +160 -0
- package/package.json +9 -8
- package/server/activities/activity-book.ts +31 -19
- package/server/controllers/index.ts +1 -0
- package/server/controllers/summary-statements.ts +166 -0
- package/server/index.ts +2 -0
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +106 -0
- package/server/migrations/1725201467183-seed-accounts.ts +339 -0
- package/server/service/account/account-history.ts +15 -7
- package/server/service/account/account-mutation.ts +13 -10
- package/server/service/account/account-query.ts +3 -1
- package/server/service/account/account.ts +16 -5
- package/server/service/accounting-category/accounting-category-history.ts +123 -0
- package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
- package/server/service/accounting-category/accounting-category-query.ts +24 -1
- package/server/service/accounting-category/accounting-category-type.ts +6 -0
- package/server/service/accounting-category/accounting-category.ts +23 -3
- package/server/service/accounting-category/event-subscriber.ts +20 -0
- package/server/service/accounting-category/index.ts +4 -2
- package/server/service/accounting-document/accounting-document-history.ts +117 -0
- package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
- package/server/service/accounting-document/accounting-document-query.ts +48 -0
- package/server/service/accounting-document/accounting-document-type.ts +52 -0
- package/server/service/accounting-document/accounting-document.ts +93 -0
- package/server/service/accounting-document/event-subscriber.ts +17 -0
- package/server/service/accounting-document/index.ts +9 -0
- package/server/service/common-type.ts +12 -0
- package/server/service/financial-statement/financial-statement-history.ts +28 -19
- package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
- package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
- package/server/service/financial-statement/financial-statement-query.ts +3 -1
- package/server/service/financial-statement/financial-statement.ts +52 -36
- package/server/service/financial-statement/index.ts +2 -1
- package/server/service/fiscal-month/fiscal-month-mutation.ts +145 -0
- package/server/service/fiscal-month/fiscal-month-query.ts +58 -0
- package/server/service/fiscal-month/fiscal-month-type.ts +66 -0
- package/server/service/fiscal-month/fiscal-month.ts +84 -0
- package/server/service/fiscal-month/index.ts +7 -0
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +148 -0
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +60 -0
- package/server/service/fiscal-quarter/fiscal-quarter-type.ts +60 -0
- package/server/service/fiscal-quarter/fiscal-quarter.ts +80 -0
- package/server/service/fiscal-quarter/index.ts +7 -0
- package/server/service/fiscal-year/fiscal-year-mutation.ts +145 -0
- package/server/service/fiscal-year/fiscal-year-query.ts +53 -0
- package/server/service/fiscal-year/fiscal-year-type.ts +54 -0
- package/server/service/fiscal-year/fiscal-year.ts +76 -0
- package/server/service/fiscal-year/index.ts +7 -0
- package/server/service/income-statement/income-statement-history.ts +31 -18
- package/server/service/income-statement/income-statement-line-item.ts +84 -0
- package/server/service/income-statement/income-statement-mutation.ts +12 -10
- package/server/service/income-statement/income-statement-query.ts +3 -4
- package/server/service/income-statement/income-statement.ts +54 -39
- package/server/service/income-statement/index.ts +2 -1
- package/server/service/index.ts +49 -3
- package/server/service/payment/event-subscriber.ts +17 -0
- package/server/service/payment/index.ts +9 -0
- package/server/service/payment/payment-history.ts +126 -0
- package/server/service/payment/payment-mutation.ts +139 -0
- package/server/service/payment/payment-query.ts +50 -0
- package/server/service/payment/payment-type.ts +64 -0
- package/server/service/payment/payment.ts +123 -0
- package/server/service/transaction/transaction-history.ts +54 -10
- package/server/service/transaction/transaction-mutation.ts +13 -10
- package/server/service/transaction/transaction-query.ts +3 -4
- package/server/service/transaction/transaction.ts +144 -29
- package/things-factory.config.js +3 -2
- package/translations/en.json +9 -1
- package/translations/ja.json +9 -1
- package/translations/ko.json +9 -1
- package/translations/ms.json +9 -1
- package/translations/zh.json +9 -1
- package/client/pages/main.ts +0 -24
- package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
- package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
- package/dist-client/pages/main.d.ts +0 -1
- package/dist-client/pages/main.js +0 -27
- package/dist-client/pages/main.js.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import { Domain, getRepository } from '@things-factory/shell'
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { FiscalYear } from '../service/fiscal-year/fiscal-year'
|
|
5
|
+
import { FiscalQuarter } from '../service/fiscal-quarter/fiscal-quarter'
|
|
6
|
+
import { FiscalMonth } from '../service/fiscal-month/fiscal-month'
|
|
7
|
+
import { FiscalStatus } from '../service/common-type'
|
|
8
|
+
|
|
9
|
+
export class SeedFiscalEntities1725200507196 implements MigrationInterface {
|
|
10
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
11
|
+
const domainRepository = getRepository(Domain)
|
|
12
|
+
const userRepository = getRepository(User)
|
|
13
|
+
const fiscalYearRepository = getRepository(FiscalYear)
|
|
14
|
+
const fiscalQuarterRepository = getRepository(FiscalQuarter)
|
|
15
|
+
const fiscalMonthRepository = getRepository(FiscalMonth)
|
|
16
|
+
|
|
17
|
+
const domain: Domain | null = await domainRepository.findOne({
|
|
18
|
+
where: { name: 'SYSTEM' }
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
if (!domain) {
|
|
22
|
+
throw new Error('SYSTEM domain not found')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const user = await userRepository.findOne({ where: { id: domain.owner } })
|
|
26
|
+
|
|
27
|
+
if (!user) {
|
|
28
|
+
throw new Error('Domain owner not found')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const currentYear = new Date().getFullYear()
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
// Fiscal Year 생성
|
|
35
|
+
const fiscalYear = await fiscalYearRepository.save({
|
|
36
|
+
domain,
|
|
37
|
+
year: currentYear,
|
|
38
|
+
startDate: `${currentYear}-01-01`, // 문자열로 저장
|
|
39
|
+
endDate: `${currentYear}-12-31`, // 문자열로 저장
|
|
40
|
+
status: FiscalStatus.OPEN,
|
|
41
|
+
creator: user,
|
|
42
|
+
updater: user
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Fiscal Quarters 생성
|
|
46
|
+
for (let quarter = 1; quarter <= 4; quarter++) {
|
|
47
|
+
const startMonth = (quarter - 1) * 3 + 1
|
|
48
|
+
const endMonth = quarter * 3
|
|
49
|
+
|
|
50
|
+
const fiscalQuarter = await fiscalQuarterRepository.save({
|
|
51
|
+
domain,
|
|
52
|
+
year: currentYear,
|
|
53
|
+
quarter,
|
|
54
|
+
startDate: `${currentYear}-${String(startMonth).padStart(2, '0')}-01`, // 문자열로 저장
|
|
55
|
+
endDate: `${currentYear}-${String(endMonth).padStart(2, '0')}-31`, // 임시로 월의 마지막 날을 31일로 설정
|
|
56
|
+
status: FiscalStatus.OPEN,
|
|
57
|
+
creator: user,
|
|
58
|
+
updater: user
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// Fiscal Months 생성
|
|
62
|
+
for (let month = startMonth; month <= endMonth; month++) {
|
|
63
|
+
const startDate = `${currentYear}-${String(month).padStart(2, '0')}-01`
|
|
64
|
+
const endDate = `${currentYear}-${String(month).padStart(2, '0')}-${new Date(currentYear, month, 0).getDate()}`
|
|
65
|
+
|
|
66
|
+
await fiscalMonthRepository.save({
|
|
67
|
+
domain,
|
|
68
|
+
year: currentYear,
|
|
69
|
+
quarter,
|
|
70
|
+
month,
|
|
71
|
+
startDate,
|
|
72
|
+
endDate,
|
|
73
|
+
status: FiscalStatus.OPEN,
|
|
74
|
+
creator: user,
|
|
75
|
+
updater: user
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Failed to seed fiscal entities:', error)
|
|
81
|
+
throw error
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
86
|
+
const domainRepository = getRepository(Domain)
|
|
87
|
+
const fiscalYearRepository = getRepository(FiscalYear)
|
|
88
|
+
const fiscalQuarterRepository = getRepository(FiscalQuarter)
|
|
89
|
+
const fiscalMonthRepository = getRepository(FiscalMonth)
|
|
90
|
+
|
|
91
|
+
const domain: Domain | null = await domainRepository.findOne({
|
|
92
|
+
where: { name: 'SYSTEM' }
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
if (!domain) {
|
|
96
|
+
throw new Error('SYSTEM domain not found')
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const currentYear = new Date().getFullYear()
|
|
100
|
+
|
|
101
|
+
// FiscalMonth, FiscalQuarter, FiscalYear 삭제
|
|
102
|
+
await fiscalMonthRepository.delete({ domain: { id: domain.id }, year: currentYear })
|
|
103
|
+
await fiscalQuarterRepository.delete({ domain: { id: domain.id }, year: currentYear })
|
|
104
|
+
await fiscalYearRepository.delete({ domain: { id: domain.id }, year: currentYear })
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import { Domain, getRepository } from '@things-factory/shell'
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { Account } from '../service/account/account'
|
|
5
|
+
import { AccountingCategory } from '../service/accounting-category/accounting-category'
|
|
6
|
+
|
|
7
|
+
export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
const domainRepository = getRepository(Domain)
|
|
10
|
+
const userRepository = getRepository(User)
|
|
11
|
+
const accountingCategoryRepository = getRepository(AccountingCategory)
|
|
12
|
+
const accountRepository = getRepository(Account)
|
|
13
|
+
|
|
14
|
+
const domain: Domain | null = await domainRepository.findOne({
|
|
15
|
+
where: { name: 'SYSTEM' }
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
if (!domain) {
|
|
19
|
+
throw new Error('SYSTEM domain not found')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const user = await userRepository.findOne({ where: { id: domain.owner } })
|
|
23
|
+
|
|
24
|
+
if (!user) {
|
|
25
|
+
throw new Error('Domain owner not found')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
// 최상위 카테고리 생성
|
|
30
|
+
const topLevelCategories = {
|
|
31
|
+
자산: await accountingCategoryRepository.save({
|
|
32
|
+
domain,
|
|
33
|
+
code: 'ASSET',
|
|
34
|
+
name: '자산',
|
|
35
|
+
description: '기업이 소유하고 있는 자산',
|
|
36
|
+
creator: user,
|
|
37
|
+
updater: user
|
|
38
|
+
}),
|
|
39
|
+
부채: await accountingCategoryRepository.save({
|
|
40
|
+
domain,
|
|
41
|
+
code: 'LIABILITY',
|
|
42
|
+
name: '부채',
|
|
43
|
+
description: '기업이 갚아야 할 빚',
|
|
44
|
+
creator: user,
|
|
45
|
+
updater: user
|
|
46
|
+
}),
|
|
47
|
+
자본: await accountingCategoryRepository.save({
|
|
48
|
+
domain,
|
|
49
|
+
code: 'EQUITY',
|
|
50
|
+
name: '자본',
|
|
51
|
+
description: '기업 소유주의 자산',
|
|
52
|
+
creator: user,
|
|
53
|
+
updater: user
|
|
54
|
+
}),
|
|
55
|
+
수익: await accountingCategoryRepository.save({
|
|
56
|
+
domain,
|
|
57
|
+
code: 'REVENUE',
|
|
58
|
+
name: '수익',
|
|
59
|
+
description: '기업이 벌어들인 돈',
|
|
60
|
+
creator: user,
|
|
61
|
+
updater: user
|
|
62
|
+
}),
|
|
63
|
+
비용: await accountingCategoryRepository.save({
|
|
64
|
+
domain,
|
|
65
|
+
code: 'EXPENSE',
|
|
66
|
+
name: '비용',
|
|
67
|
+
description: '기업 운영에 사용된 돈',
|
|
68
|
+
creator: user,
|
|
69
|
+
updater: user
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 유동자산 및 비유동자산과 같은 하위 카테고리 생성
|
|
74
|
+
const subCategories = {
|
|
75
|
+
유동자산: await accountingCategoryRepository.save({
|
|
76
|
+
domain,
|
|
77
|
+
code: 'CURRENT_ASSET',
|
|
78
|
+
name: '유동자산',
|
|
79
|
+
description: '쉽게 현금화할 수 있는 자산',
|
|
80
|
+
parent: topLevelCategories.자산,
|
|
81
|
+
creator: user,
|
|
82
|
+
updater: user
|
|
83
|
+
}),
|
|
84
|
+
비유동자산: await accountingCategoryRepository.save({
|
|
85
|
+
domain,
|
|
86
|
+
code: 'NON_CURRENT_ASSET',
|
|
87
|
+
name: '비유동자산',
|
|
88
|
+
description: '장기 보유 자산',
|
|
89
|
+
parent: topLevelCategories.자산,
|
|
90
|
+
creator: user,
|
|
91
|
+
updater: user
|
|
92
|
+
}),
|
|
93
|
+
유동부채: await accountingCategoryRepository.save({
|
|
94
|
+
domain,
|
|
95
|
+
code: 'CURRENT_LIABILITY',
|
|
96
|
+
name: '유동부채',
|
|
97
|
+
description: '단기간에 상환해야 하는 부채',
|
|
98
|
+
parent: topLevelCategories.부채,
|
|
99
|
+
creator: user,
|
|
100
|
+
updater: user
|
|
101
|
+
}),
|
|
102
|
+
비유동부채: await accountingCategoryRepository.save({
|
|
103
|
+
domain,
|
|
104
|
+
code: 'NON_CURRENT_LIABILITY',
|
|
105
|
+
name: '비유동부채',
|
|
106
|
+
description: '장기 부채',
|
|
107
|
+
parent: topLevelCategories.부채,
|
|
108
|
+
creator: user,
|
|
109
|
+
updater: user
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 이제 유형자산, 무형자산, 단기금융부채 같은 하위 카테고리를 subCategories 객체를 사용하여 생성합니다.
|
|
114
|
+
const furtherSubCategories = {
|
|
115
|
+
유형자산: await accountingCategoryRepository.save({
|
|
116
|
+
domain,
|
|
117
|
+
code: 'TANGIBLE_ASSET',
|
|
118
|
+
name: '유형자산',
|
|
119
|
+
description: '물리적 형태가 있는 자산',
|
|
120
|
+
parent: subCategories.비유동자산,
|
|
121
|
+
creator: user,
|
|
122
|
+
updater: user
|
|
123
|
+
}),
|
|
124
|
+
무형자산: await accountingCategoryRepository.save({
|
|
125
|
+
domain,
|
|
126
|
+
code: 'INTANGIBLE_ASSET',
|
|
127
|
+
name: '무형자산',
|
|
128
|
+
description: '물리적 형태가 없는 자산',
|
|
129
|
+
parent: subCategories.비유동자산,
|
|
130
|
+
creator: user,
|
|
131
|
+
updater: user
|
|
132
|
+
}),
|
|
133
|
+
단기금융부채: await accountingCategoryRepository.save({
|
|
134
|
+
domain,
|
|
135
|
+
code: 'SHORT_TERM_FINANCIAL_LIABILITY',
|
|
136
|
+
name: '단기금융부채',
|
|
137
|
+
description: '단기적으로 갚아야 할 금융부채',
|
|
138
|
+
parent: subCategories.유동부채,
|
|
139
|
+
creator: user,
|
|
140
|
+
updater: user
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 계정 생성 및 하위 카테고리 연결
|
|
145
|
+
const accounts = [
|
|
146
|
+
// 유동자산 계정
|
|
147
|
+
{
|
|
148
|
+
code: '101',
|
|
149
|
+
name: '현금 및 현금성 자산',
|
|
150
|
+
description: '현금, 예금 및 기타 현금성 자산',
|
|
151
|
+
category: subCategories.유동자산
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
code: '102',
|
|
155
|
+
name: '매출채권',
|
|
156
|
+
description: '상품 또는 서비스의 판매로 인해 발생한 채권',
|
|
157
|
+
category: subCategories.유동자산
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
code: '103',
|
|
161
|
+
name: '재고자산',
|
|
162
|
+
description: '판매를 목적으로 보유한 상품, 제품, 원재료 등',
|
|
163
|
+
category: subCategories.유동자산
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
code: '104',
|
|
167
|
+
name: '단기금융상품',
|
|
168
|
+
description: '단기투자 목적으로 보유한 금융상품',
|
|
169
|
+
category: subCategories.유동자산
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
code: '105',
|
|
173
|
+
name: '선급금',
|
|
174
|
+
description: '상품, 서비스 제공을 위해 미리 지급한 금액',
|
|
175
|
+
category: subCategories.유동자산
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
// 비유동자산 계정
|
|
179
|
+
{
|
|
180
|
+
code: '201',
|
|
181
|
+
name: '건물',
|
|
182
|
+
description: '기업이 소유한 건물',
|
|
183
|
+
category: furtherSubCategories.유형자산
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
code: '202',
|
|
187
|
+
name: '토지',
|
|
188
|
+
description: '기업이 소유한 토지',
|
|
189
|
+
category: furtherSubCategories.유형자산
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
code: '203',
|
|
193
|
+
name: '기계장치',
|
|
194
|
+
description: '생산을 위해 사용되는 기계 및 장치',
|
|
195
|
+
category: furtherSubCategories.유형자산
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
code: '204',
|
|
199
|
+
name: '무형자산',
|
|
200
|
+
description: '특허권, 상표권 등의 무형자산',
|
|
201
|
+
category: furtherSubCategories.무형자산
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
// 유동부채 계정
|
|
205
|
+
{
|
|
206
|
+
code: '301',
|
|
207
|
+
name: '매입채무',
|
|
208
|
+
description: '상품 또는 서비스의 구매로 인해 발생한 채무',
|
|
209
|
+
category: subCategories.유동부채
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
code: '302',
|
|
213
|
+
name: '단기차입금',
|
|
214
|
+
description: '단기 대출금',
|
|
215
|
+
category: furtherSubCategories.단기금융부채
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
code: '303',
|
|
219
|
+
name: '미지급금',
|
|
220
|
+
description: '이미 발생한 비용에 대한 지급할 금액',
|
|
221
|
+
category: subCategories.유동부채
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
code: '304',
|
|
225
|
+
name: '선수금',
|
|
226
|
+
description: '고객으로부터 미리 받은 금액',
|
|
227
|
+
category: subCategories.유동부채
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
// 비유동부채 계정
|
|
231
|
+
{ code: '401', name: '장기차입금', description: '장기 대출금', category: subCategories.비유동부채 },
|
|
232
|
+
{
|
|
233
|
+
code: '402',
|
|
234
|
+
name: '퇴직급여충당부채',
|
|
235
|
+
description: '퇴직급여 지급을 위해 설정한 부채',
|
|
236
|
+
category: subCategories.비유동부채
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
// 자본 계정
|
|
240
|
+
{ code: '501', name: '자본금', description: '주주가 납입한 자본', category: topLevelCategories.자본 },
|
|
241
|
+
{ code: '502', name: '이익잉여금', description: '이익의 축적', category: topLevelCategories.자본 },
|
|
242
|
+
|
|
243
|
+
// 수익 계정
|
|
244
|
+
{
|
|
245
|
+
code: '601',
|
|
246
|
+
name: '제품매출',
|
|
247
|
+
description: '제품의 판매로 인한 수익',
|
|
248
|
+
category: topLevelCategories.수익
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
code: '602',
|
|
252
|
+
name: '상품매출',
|
|
253
|
+
description: '상품의 판매로 인한 수익',
|
|
254
|
+
category: topLevelCategories.수익
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
code: '603',
|
|
258
|
+
name: '용역매출',
|
|
259
|
+
description: '용역 제공으로 인한 수익',
|
|
260
|
+
category: topLevelCategories.수익
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
code: '604',
|
|
264
|
+
name: '이자수익',
|
|
265
|
+
description: '금융 자산에서 발생한 이자수익',
|
|
266
|
+
category: topLevelCategories.수익
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
code: '605',
|
|
270
|
+
name: '배당금수익',
|
|
271
|
+
description: '주식 투자로 인한 배당금 수익',
|
|
272
|
+
category: topLevelCategories.수익
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
// 비용 계정
|
|
276
|
+
{
|
|
277
|
+
code: '701',
|
|
278
|
+
name: '매출원가',
|
|
279
|
+
description: '제품, 상품, 용역 제공에 대한 원가',
|
|
280
|
+
category: topLevelCategories.비용
|
|
281
|
+
},
|
|
282
|
+
{ code: '702', name: '급여', description: '직원 급여 비용', category: topLevelCategories.비용 },
|
|
283
|
+
{ code: '703', name: '임대료', description: '건물 및 설비 임차료', category: topLevelCategories.비용 },
|
|
284
|
+
{
|
|
285
|
+
code: '704',
|
|
286
|
+
name: '감가상각비',
|
|
287
|
+
description: '유형자산의 감가상각비용',
|
|
288
|
+
category: topLevelCategories.비용
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
code: '705',
|
|
292
|
+
name: '이자비용',
|
|
293
|
+
description: '차입금에 대한 이자비용',
|
|
294
|
+
category: topLevelCategories.비용
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
code: '706',
|
|
298
|
+
name: '판매비 및 관리비',
|
|
299
|
+
description: '기업 운영에 필요한 비용',
|
|
300
|
+
category: topLevelCategories.비용
|
|
301
|
+
},
|
|
302
|
+
{ code: '707', name: '법인세비용', description: '법인세 납부 비용', category: topLevelCategories.비용 }
|
|
303
|
+
]
|
|
304
|
+
|
|
305
|
+
// 계정 저장
|
|
306
|
+
for (const account of accounts) {
|
|
307
|
+
await accountRepository.save({
|
|
308
|
+
domain,
|
|
309
|
+
...account,
|
|
310
|
+
creator: user,
|
|
311
|
+
updater: user
|
|
312
|
+
})
|
|
313
|
+
}
|
|
314
|
+
} catch (error) {
|
|
315
|
+
console.error('Failed to seed accounting categories and accounts:', error)
|
|
316
|
+
throw error
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
321
|
+
const domainRepository = getRepository(Domain)
|
|
322
|
+
const accountingCategoryRepository = getRepository(AccountingCategory)
|
|
323
|
+
const accountRepository = getRepository(Account)
|
|
324
|
+
|
|
325
|
+
const domain: Domain | null = await domainRepository.findOne({
|
|
326
|
+
where: { name: 'SYSTEM' }
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
if (!domain) {
|
|
330
|
+
throw new Error('SYSTEM domain not found')
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Accounts 삭제
|
|
334
|
+
await accountRepository.softDelete({ domain: { id: domain.id } })
|
|
335
|
+
|
|
336
|
+
// AccountingCategories 삭제
|
|
337
|
+
await accountingCategoryRepository.softDelete({ domain: { id: domain.id } })
|
|
338
|
+
}
|
|
339
|
+
}
|
|
@@ -12,6 +12,7 @@ import { config } from '@things-factory/env'
|
|
|
12
12
|
import { Domain } from '@things-factory/shell'
|
|
13
13
|
|
|
14
14
|
import { Account } from './account'
|
|
15
|
+
import { AccountingCategory } from '../accounting-category/accounting-category'
|
|
15
16
|
|
|
16
17
|
const ORMCONFIG = config.get('ormconfig', {})
|
|
17
18
|
const DATABASE_TYPE = ORMCONFIG.type
|
|
@@ -38,15 +39,15 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
|
38
39
|
version?: number = 1
|
|
39
40
|
|
|
40
41
|
@ManyToOne(type => Domain)
|
|
41
|
-
@Field(
|
|
42
|
+
@Field({ nullable: true })
|
|
42
43
|
domain?: Domain
|
|
43
44
|
|
|
44
|
-
@RelationId((
|
|
45
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.domain)
|
|
45
46
|
domainId?: string
|
|
46
47
|
|
|
47
48
|
@Column({ nullable: true })
|
|
48
49
|
@Field({ nullable: true })
|
|
49
|
-
|
|
50
|
+
code?: string
|
|
50
51
|
|
|
51
52
|
@Column({ nullable: true })
|
|
52
53
|
@Field({ nullable: true })
|
|
@@ -60,6 +61,13 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
|
60
61
|
@Field({ nullable: true })
|
|
61
62
|
active?: boolean
|
|
62
63
|
|
|
64
|
+
@ManyToOne(type => AccountingCategory)
|
|
65
|
+
@Field(type => AccountingCategory, { nullable: true })
|
|
66
|
+
category?: AccountingCategory
|
|
67
|
+
|
|
68
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.category)
|
|
69
|
+
categoryId?: string
|
|
70
|
+
|
|
63
71
|
@Column({ nullable: true })
|
|
64
72
|
@Field({ nullable: true })
|
|
65
73
|
createdAt?: Date
|
|
@@ -73,17 +81,17 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
|
73
81
|
deletedAt?: Date
|
|
74
82
|
|
|
75
83
|
@ManyToOne(type => User, { nullable: true })
|
|
76
|
-
@Field(
|
|
84
|
+
@Field({ nullable: true })
|
|
77
85
|
creator?: User
|
|
78
86
|
|
|
79
|
-
@RelationId((
|
|
87
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.creator)
|
|
80
88
|
creatorId?: string
|
|
81
89
|
|
|
82
90
|
@ManyToOne(type => User, { nullable: true })
|
|
83
|
-
@Field(
|
|
91
|
+
@Field({ nullable: true })
|
|
84
92
|
updater?: User
|
|
85
93
|
|
|
86
|
-
@RelationId((
|
|
94
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.updater)
|
|
87
95
|
updaterId?: string
|
|
88
96
|
|
|
89
97
|
@HistoryOriginalIdColumn()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
2
|
import { In } from 'typeorm'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getRepository } from '@things-factory/shell'
|
|
5
5
|
|
|
6
6
|
import { Account } from './account'
|
|
7
7
|
import { NewAccount, AccountPatch } from './account-type'
|
|
@@ -9,11 +9,12 @@ import { NewAccount, AccountPatch } from './account-type'
|
|
|
9
9
|
@Resolver(Account)
|
|
10
10
|
export class AccountMutation {
|
|
11
11
|
@Directive('@transaction')
|
|
12
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
12
13
|
@Mutation(returns => Account, { description: 'To create new Account' })
|
|
13
14
|
async createAccount(@Arg('account') account: NewAccount, @Ctx() context: ResolverContext): Promise<Account> {
|
|
14
15
|
const { domain, user, tx } = context.state
|
|
15
16
|
|
|
16
|
-
const result = await
|
|
17
|
+
const result = await getRepository(Account, tx).save({
|
|
17
18
|
...account,
|
|
18
19
|
domain,
|
|
19
20
|
creator: user,
|
|
@@ -24,6 +25,7 @@ export class AccountMutation {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@Directive('@transaction')
|
|
28
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
27
29
|
@Mutation(returns => Account, { description: 'To modify Account information' })
|
|
28
30
|
async updateAccount(
|
|
29
31
|
@Arg('id') id: string,
|
|
@@ -32,7 +34,7 @@ export class AccountMutation {
|
|
|
32
34
|
): Promise<Account> {
|
|
33
35
|
const { domain, user, tx } = context.state
|
|
34
36
|
|
|
35
|
-
const repository =
|
|
37
|
+
const repository = getRepository(Account, tx)
|
|
36
38
|
const account = await repository.findOne({
|
|
37
39
|
where: { domain: { id: domain.id }, id }
|
|
38
40
|
})
|
|
@@ -47,6 +49,7 @@ export class AccountMutation {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
@Directive('@transaction')
|
|
52
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
50
53
|
@Mutation(returns => [Account], { description: "To modify multiple Accounts' information" })
|
|
51
54
|
async updateMultipleAccount(
|
|
52
55
|
@Arg('patches', type => [AccountPatch]) patches: AccountPatch[],
|
|
@@ -57,7 +60,7 @@ export class AccountMutation {
|
|
|
57
60
|
let results = []
|
|
58
61
|
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
59
62
|
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
60
|
-
const accountRepo =
|
|
63
|
+
const accountRepo = getRepository(Account, tx)
|
|
61
64
|
|
|
62
65
|
if (_createRecords.length > 0) {
|
|
63
66
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
@@ -93,32 +96,32 @@ export class AccountMutation {
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
@Directive('@transaction')
|
|
99
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
96
100
|
@Mutation(returns => Boolean, { description: 'To delete Account' })
|
|
97
101
|
async deleteAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
98
102
|
const { domain, tx } = context.state
|
|
99
103
|
|
|
100
|
-
await
|
|
101
|
-
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
104
|
+
await getRepository(Account, tx).delete({ domain: { id: domain.id }, id })
|
|
102
105
|
|
|
103
106
|
return true
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
@Directive('@transaction')
|
|
110
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
107
111
|
@Mutation(returns => Boolean, { description: 'To delete multiple Accounts' })
|
|
108
112
|
async deleteAccounts(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
109
113
|
const { domain, tx } = context.state
|
|
110
114
|
|
|
111
|
-
await
|
|
115
|
+
await getRepository(Account, tx).delete({
|
|
112
116
|
domain: { id: domain.id },
|
|
113
117
|
id: In(ids)
|
|
114
118
|
})
|
|
115
119
|
|
|
116
|
-
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
117
|
-
|
|
118
120
|
return true
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
@Directive('@transaction')
|
|
124
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
|
122
125
|
@Mutation(returns => Boolean, { description: 'To import multiple Accounts' })
|
|
123
126
|
async importAccounts(
|
|
124
127
|
@Arg('accounts', type => [AccountPatch]) accounts: AccountPatch[],
|
|
@@ -128,7 +131,7 @@ export class AccountMutation {
|
|
|
128
131
|
|
|
129
132
|
await Promise.all(
|
|
130
133
|
accounts.map(async (account: AccountPatch) => {
|
|
131
|
-
const createdAccount: Account = await
|
|
134
|
+
const createdAccount: Account = await getRepository(Account, tx).save({ domain, ...account })
|
|
132
135
|
})
|
|
133
136
|
)
|
|
134
137
|
|
|
@@ -7,6 +7,7 @@ import { AccountList } from './account-type'
|
|
|
7
7
|
|
|
8
8
|
@Resolver(Account)
|
|
9
9
|
export class AccountQuery {
|
|
10
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
|
10
11
|
@Query(returns => Account!, { nullable: true, description: 'To fetch a Account' })
|
|
11
12
|
async account(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Account> {
|
|
12
13
|
const { domain } = context.state
|
|
@@ -16,8 +17,9 @@ export class AccountQuery {
|
|
|
16
17
|
})
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
|
19
21
|
@Query(returns => AccountList, { description: 'To fetch multiple Accounts' })
|
|
20
|
-
async accounts(@Args(
|
|
22
|
+
async accounts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<AccountList> {
|
|
21
23
|
const { domain } = context.state
|
|
22
24
|
|
|
23
25
|
const queryBuilder = getQueryBuilderFromListParams({
|
|
@@ -17,7 +17,18 @@ import { User } from '@things-factory/auth-base'
|
|
|
17
17
|
import { AccountingCategory } from '../accounting-category/accounting-category'
|
|
18
18
|
|
|
19
19
|
@Entity()
|
|
20
|
-
@Index('ix_account_0', (account: Account) => [account.domain, account.name
|
|
20
|
+
@Index('ix_account_0', (account: Account) => [account.domain, account.name], {
|
|
21
|
+
unique: true,
|
|
22
|
+
where: '"deleted_at" IS NULL'
|
|
23
|
+
})
|
|
24
|
+
@Index('ix_account_1', (account: Account) => [account.domain, account.code], {
|
|
25
|
+
unique: true,
|
|
26
|
+
where: '"deleted_at" IS NULL'
|
|
27
|
+
})
|
|
28
|
+
@Index('ix_account_2', (account: Account) => [account.domain, account.category], {
|
|
29
|
+
unique: false,
|
|
30
|
+
where: '"deleted_at" IS NULL'
|
|
31
|
+
})
|
|
21
32
|
@ObjectType({ description: 'Entity for Account' })
|
|
22
33
|
export class Account {
|
|
23
34
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -29,15 +40,15 @@ export class Account {
|
|
|
29
40
|
version?: number = 1
|
|
30
41
|
|
|
31
42
|
@ManyToOne(type => Domain)
|
|
32
|
-
@Field(
|
|
43
|
+
@Field({ nullable: true })
|
|
33
44
|
domain?: Domain
|
|
34
45
|
|
|
35
46
|
@RelationId((account: Account) => account.domain)
|
|
36
47
|
domainId?: string
|
|
37
48
|
|
|
38
49
|
@Column()
|
|
39
|
-
@Field({ nullable: true, description: 'Account
|
|
40
|
-
|
|
50
|
+
@Field({ nullable: true, description: 'Account code number' })
|
|
51
|
+
code?: string
|
|
41
52
|
|
|
42
53
|
@Column()
|
|
43
54
|
@Field({ nullable: true, description: 'Account name' })
|
|
@@ -51,7 +62,7 @@ export class Account {
|
|
|
51
62
|
@Field({ nullable: true })
|
|
52
63
|
active?: boolean
|
|
53
64
|
|
|
54
|
-
@
|
|
65
|
+
@ManyToOne(type => AccountingCategory)
|
|
55
66
|
@Field(type => AccountingCategory, { nullable: true })
|
|
56
67
|
category?: AccountingCategory
|
|
57
68
|
|