@tomei/finance 0.6.114 → 0.8.0
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/dist/account/account.d.ts +1 -0
- package/dist/account/account.d.ts.map +1 -0
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +1 -0
- package/dist/account/account.repository.d.ts.map +1 -0
- package/dist/account/account.repository.js +4 -1
- package/dist/account/account.repository.js.map +1 -1
- package/dist/account/interfaces/account-attr.interface.d.ts +1 -0
- package/dist/account/interfaces/account-attr.interface.d.ts.map +1 -0
- package/dist/account-system-entity/account-system-entity.d.ts +1 -0
- package/dist/account-system-entity/account-system-entity.d.ts.map +1 -0
- package/dist/account-system-entity/account-system-entity.js +4 -1
- package/dist/account-system-entity/account-system-entity.js.map +1 -1
- package/dist/account-system-entity/post-history.repository.d.ts +1 -0
- package/dist/account-system-entity/post-history.repository.d.ts.map +1 -0
- package/dist/account-system-entity/post-history.repository.js +4 -1
- package/dist/account-system-entity/post-history.repository.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +17 -4
- package/dist/config.js.map +1 -1
- package/dist/customer/customer.d.ts +1 -0
- package/dist/customer/customer.d.ts.map +1 -0
- package/dist/customer/customer.js +38 -2
- package/dist/customer/customer.js.map +1 -1
- package/dist/customer/finance-customer.repository.d.ts +1 -0
- package/dist/customer/finance-customer.repository.d.ts.map +1 -0
- package/dist/customer/finance-customer.repository.js +4 -1
- package/dist/customer/finance-customer.repository.js.map +1 -1
- package/dist/customer/interfaces/customer.repository.interface.d.ts +1 -0
- package/dist/customer/interfaces/customer.repository.interface.d.ts.map +1 -0
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +1 -0
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts.map +1 -0
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +1 -0
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts.map +1 -0
- package/dist/database.d.ts +1 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +18 -15
- package/dist/database.js.map +1 -1
- package/dist/document/document-item.d.ts +3 -2
- package/dist/document/document-item.d.ts.map +1 -0
- package/dist/document/document-item.js +1 -1
- package/dist/document/document-item.js.map +1 -1
- package/dist/document/document-item.repository.d.ts +1 -0
- package/dist/document/document-item.repository.d.ts.map +1 -0
- package/dist/document/document-item.repository.js +4 -1
- package/dist/document/document-item.repository.js.map +1 -1
- package/dist/document/document.d.ts +2 -1
- package/dist/document/document.d.ts.map +1 -0
- package/dist/document/document.js +242 -191
- package/dist/document/document.js.map +1 -1
- package/dist/document/document.repository.d.ts +1 -0
- package/dist/document/document.repository.d.ts.map +1 -0
- package/dist/document/document.repository.js +4 -1
- package/dist/document/document.repository.js.map +1 -1
- package/dist/document/interfaces/document-attr.interface.d.ts +1 -0
- package/dist/document/interfaces/document-attr.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-find-all.interface.d.ts +1 -0
- package/dist/document/interfaces/document-find-all.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-item-attr.interface.d.ts +1 -0
- package/dist/document/interfaces/document-item-attr.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-item.repository.interface.d.ts +1 -0
- package/dist/document/interfaces/document-item.repository.interface.d.ts.map +1 -0
- package/dist/document-tag/document-tag.d.ts +19 -0
- package/dist/document-tag/document-tag.d.ts.map +1 -0
- package/dist/document-tag/document-tag.js +68 -0
- package/dist/document-tag/document-tag.js.map +1 -0
- package/dist/document-tag/document-tag.repository.d.ts +6 -0
- package/dist/document-tag/document-tag.repository.d.ts.map +1 -0
- package/dist/document-tag/document-tag.repository.js +15 -0
- package/dist/document-tag/document-tag.repository.js.map +1 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts +8 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts.map +1 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.js +3 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.js.map +1 -0
- package/dist/enum/collect-payment-type.d.ts +1 -0
- package/dist/enum/collect-payment-type.d.ts.map +1 -0
- package/dist/enum/doc-type.enum.d.ts +1 -0
- package/dist/enum/doc-type.enum.d.ts.map +1 -0
- package/dist/enum/document-status.enum.d.ts +1 -0
- package/dist/enum/document-status.enum.d.ts.map +1 -0
- package/dist/enum/index.d.ts +2 -2
- package/dist/enum/index.d.ts.map +1 -0
- package/dist/enum/index.js +1 -3
- package/dist/enum/index.js.map +1 -1
- package/dist/enum/payment-method.enum.d.ts +1 -0
- package/dist/enum/payment-method.enum.d.ts.map +1 -0
- package/dist/enum/payment-status.enum.d.ts +1 -0
- package/dist/enum/payment-status.enum.d.ts.map +1 -0
- package/dist/enum/payment-type.enum.d.ts +1 -0
- package/dist/enum/payment-type.enum.d.ts.map +1 -0
- package/dist/enum/quick-book-client-scopes.enum.d.ts +1 -0
- package/dist/enum/quick-book-client-scopes.enum.d.ts.map +1 -0
- package/dist/enum/quick-book-client-scopes.enum.js +34 -1
- package/dist/enum/quick-book-client-scopes.enum.js.map +1 -1
- package/dist/enum/transaction-type.enum.d.ts +1 -0
- package/dist/enum/transaction-type.enum.d.ts.map +1 -0
- package/dist/finance-company/finance-company.d.ts +20 -17
- package/dist/finance-company/finance-company.d.ts.map +1 -0
- package/dist/finance-company/finance-company.js +89 -23
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/finance-company/finance-company.repository.d.ts +1 -0
- package/dist/finance-company/finance-company.repository.d.ts.map +1 -0
- package/dist/finance-company/finance-company.repository.js +4 -1
- package/dist/finance-company/finance-company.repository.js.map +1 -1
- package/dist/helpers/login-user.d.ts +1 -0
- package/dist/helpers/login-user.d.ts.map +1 -0
- package/dist/helpers/typeof.d.ts +1 -0
- package/dist/helpers/typeof.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -15
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system.interface.d.ts +4 -0
- package/dist/interfaces/account-system.interface.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +1 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.d.ts +1 -0
- package/dist/journal-entry/journal-entry.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.js +4 -1
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/journal-entry/journal-entry.repository.d.ts +1 -0
- package/dist/journal-entry/journal-entry.repository.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.repository.js +4 -1
- package/dist/journal-entry/journal-entry.repository.js.map +1 -1
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts.map +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.d.ts +1 -0
- package/dist/ledger-transaction/ledger-transaction.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.js +4 -1
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
- package/dist/models/account.entity.d.ts +1 -0
- package/dist/models/account.entity.d.ts.map +1 -0
- package/dist/models/account.entity.js +7 -4
- package/dist/models/account.entity.js.map +1 -1
- package/dist/models/customer.entity.d.ts +1 -0
- package/dist/models/customer.entity.d.ts.map +1 -0
- package/dist/models/customer.entity.js +4 -1
- package/dist/models/customer.entity.js.map +1 -1
- package/dist/models/document-item.entity.d.ts +1 -0
- package/dist/models/document-item.entity.d.ts.map +1 -0
- package/dist/models/document-item.entity.js +5 -2
- package/dist/models/document-item.entity.js.map +1 -1
- package/dist/models/document-tag.entity.d.ts +14 -0
- package/dist/models/document-tag.entity.d.ts.map +1 -0
- package/dist/models/document-tag.entity.js +64 -0
- package/dist/models/document-tag.entity.js.map +1 -0
- package/dist/models/document.entity.d.ts +3 -0
- package/dist/models/document.entity.d.ts.map +1 -0
- package/dist/models/document.entity.js +12 -4
- package/dist/models/document.entity.js.map +1 -1
- package/dist/models/finance-company.entity.d.ts +1 -0
- package/dist/models/finance-company.entity.d.ts.map +1 -0
- package/dist/models/finance-company.entity.js +5 -2
- package/dist/models/finance-company.entity.js.map +1 -1
- package/dist/models/journal-entry.entity.d.ts +1 -0
- package/dist/models/journal-entry.entity.d.ts.map +1 -0
- package/dist/models/journal-entry.entity.js +5 -2
- package/dist/models/journal-entry.entity.js.map +1 -1
- package/dist/models/ledger-transaction.entity.d.ts +1 -0
- package/dist/models/ledger-transaction.entity.d.ts.map +1 -0
- package/dist/models/ledger-transaction.entity.js +7 -4
- package/dist/models/ledger-transaction.entity.js.map +1 -1
- package/dist/models/payment-item.entity.d.ts +1 -0
- package/dist/models/payment-item.entity.d.ts.map +1 -0
- package/dist/models/payment-item.entity.js +4 -1
- package/dist/models/payment-item.entity.js.map +1 -1
- package/dist/models/payment-method-type.entity.d.ts +1 -0
- package/dist/models/payment-method-type.entity.d.ts.map +1 -0
- package/dist/models/payment-method-type.entity.js +5 -2
- package/dist/models/payment-method-type.entity.js.map +1 -1
- package/dist/models/payment-method.entity.d.ts +1 -0
- package/dist/models/payment-method.entity.d.ts.map +1 -0
- package/dist/models/payment-method.entity.js +5 -2
- package/dist/models/payment-method.entity.js.map +1 -1
- package/dist/models/payment-paid-with.entity.d.ts +1 -0
- package/dist/models/payment-paid-with.entity.d.ts.map +1 -0
- package/dist/models/payment-paid-with.entity.js +5 -2
- package/dist/models/payment-paid-with.entity.js.map +1 -1
- package/dist/models/payment.entity.d.ts +1 -0
- package/dist/models/payment.entity.d.ts.map +1 -0
- package/dist/models/payment.entity.js +6 -3
- package/dist/models/payment.entity.js.map +1 -1
- package/dist/models/post-history.entity.d.ts +1 -0
- package/dist/models/post-history.entity.d.ts.map +1 -0
- package/dist/models/tag-group.entity.d.ts +16 -0
- package/dist/models/tag-group.entity.d.ts.map +1 -0
- package/dist/models/tag-group.entity.js +95 -0
- package/dist/models/tag-group.entity.js.map +1 -0
- package/dist/models/tag.entity.d.ts +17 -0
- package/dist/models/tag.entity.d.ts.map +1 -0
- package/dist/models/tag.entity.js +100 -0
- package/dist/models/tag.entity.js.map +1 -0
- package/dist/models/tax.entity.d.ts +1 -0
- package/dist/models/tax.entity.d.ts.map +1 -0
- package/dist/models/tax.entity.js +4 -1
- package/dist/models/tax.entity.js.map +1 -1
- package/dist/payment/interfaces/payment-attr.interface.d.ts +1 -0
- package/dist/payment/interfaces/payment-attr.interface.d.ts.map +1 -0
- package/dist/payment/interfaces/payment-params.interface.d.ts +1 -0
- package/dist/payment/interfaces/payment-params.interface.d.ts.map +1 -0
- package/dist/payment/payment.d.ts +1 -0
- package/dist/payment/payment.d.ts.map +1 -0
- package/dist/payment/payment.js +5 -2
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment/payment.repository.d.ts +1 -0
- package/dist/payment/payment.repository.d.ts.map +1 -0
- package/dist/payment/payment.repository.js +4 -1
- package/dist/payment/payment.repository.js.map +1 -1
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +1 -0
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts.map +1 -0
- package/dist/payment-item/payment-item.d.ts +1 -0
- package/dist/payment-item/payment-item.d.ts.map +1 -0
- package/dist/payment-item/payment-item.js +4 -4
- package/dist/payment-item/payment-item.repository.d.ts +1 -0
- package/dist/payment-item/payment-item.repository.d.ts.map +1 -0
- package/dist/payment-item/payment-item.repository.js +4 -1
- package/dist/payment-item/payment-item.repository.js.map +1 -1
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +1 -0
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts.map +1 -0
- package/dist/payment-method/payment-method.d.ts +1 -0
- package/dist/payment-method/payment-method.d.ts.map +1 -0
- package/dist/payment-method/payment-method.js +4 -1
- package/dist/payment-method/payment-method.js.map +1 -1
- package/dist/payment-method/payment-method.repository.d.ts +1 -0
- package/dist/payment-method/payment-method.repository.d.ts.map +1 -0
- package/dist/payment-method/payment-method.repository.js +4 -1
- package/dist/payment-method/payment-method.repository.js.map +1 -1
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +1 -0
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.d.ts +1 -0
- package/dist/payment-method-type/payment-method-type.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.repository.d.ts +1 -0
- package/dist/payment-method-type/payment-method-type.repository.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.repository.js +4 -1
- package/dist/payment-method-type/payment-method-type.repository.js.map +1 -1
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +1 -0
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.d.ts +1 -0
- package/dist/payment-paid-with/payment-paid-with.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.js +4 -1
- package/dist/payment-paid-with/payment-paid-with.repository.js.map +1 -1
- package/dist/tag/interfaces/tag-attr.interface.d.ts +14 -0
- package/dist/tag/interfaces/tag-attr.interface.d.ts.map +1 -0
- package/dist/tag/interfaces/tag-attr.interface.js +3 -0
- package/dist/tag/interfaces/tag-attr.interface.js.map +1 -0
- package/dist/tag/tag.d.ts +26 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +110 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/tag/tag.repository.d.ts +6 -0
- package/dist/tag/tag.repository.d.ts.map +1 -0
- package/dist/tag/tag.repository.js +15 -0
- package/dist/tag/tag.repository.js.map +1 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts +13 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts.map +1 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.js +3 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.js.map +1 -0
- package/dist/tag-group/tag-group.d.ts +24 -0
- package/dist/tag-group/tag-group.d.ts.map +1 -0
- package/dist/tag-group/tag-group.js +82 -0
- package/dist/tag-group/tag-group.js.map +1 -0
- package/dist/tag-group/tag-group.repository.d.ts +6 -0
- package/dist/tag-group/tag-group.repository.d.ts.map +1 -0
- package/dist/tag-group/tag-group.repository.js +15 -0
- package/dist/tag-group/tag-group.repository.js.map +1 -0
- package/dist/tax/interfaces/tax-attr.interface.d.ts +1 -0
- package/dist/tax/interfaces/tax-attr.interface.d.ts.map +1 -0
- package/dist/tax/tax.d.ts +1 -0
- package/dist/tax/tax.d.ts.map +1 -0
- package/dist/tax/tax.repository.d.ts +1 -0
- package/dist/tax/tax.repository.d.ts.map +1 -0
- package/dist/tax/tax.repository.js +4 -1
- package/dist/tax/tax.repository.js.map +1 -1
- package/dist/test-document.d.ts +1 -0
- package/dist/test-document.d.ts.map +1 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-document-tag-migration.js +46 -0
- package/migrations/finance-tag-group-migration.js +53 -0
- package/migrations/finance-tag-migration.js +63 -0
- package/package.json +18 -18
- package/.gitlab-ci.yml +0 -16
- package/.husky/commit-msg +0 -13
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -5
- package/CONTRIBUTING.md +0 -31
- package/README.md +0 -13
- package/eslint.config.mjs +0 -58
- package/nest-cli.json +0 -19
- package/sonar-project.properties +0 -13
- package/src/account/account.repository.ts +0 -11
- package/src/account/account.ts +0 -307
- package/src/account/interfaces/account-attr.interface.ts +0 -31
- package/src/account-system-entity/account-system-entity.ts +0 -66
- package/src/account-system-entity/post-history.repository.ts +0 -11
- package/src/config.ts +0 -382
- package/src/customer/customer.ts +0 -311
- package/src/customer/finance-customer.repository.ts +0 -13
- package/src/customer/interfaces/customer.repository.interface.ts +0 -3
- package/src/customer/interfaces/finance-customer-attr.interface.ts +0 -10
- package/src/customer/interfaces/finance-customer.repository.interface.ts +0 -4
- package/src/database.ts +0 -48
- package/src/document/document-item.repository.ts +0 -11
- package/src/document/document-item.ts +0 -146
- package/src/document/document.repository.ts +0 -11
- package/src/document/document.ts +0 -1328
- package/src/document/interfaces/document-attr.interface.ts +0 -28
- package/src/document/interfaces/document-find-all.interface.ts +0 -14
- package/src/document/interfaces/document-item-attr.interface.ts +0 -26
- package/src/document/interfaces/document-item.repository.interface.ts +0 -4
- package/src/enum/collect-payment-type.ts +0 -4
- package/src/enum/doc-type.enum.ts +0 -8
- package/src/enum/document-status.enum.ts +0 -6
- package/src/enum/index.ts +0 -19
- package/src/enum/payment-method.enum.ts +0 -3
- package/src/enum/payment-status.enum.ts +0 -11
- package/src/enum/payment-type.enum.ts +0 -4
- package/src/enum/quick-book-client-scopes.enum.ts +0 -14
- package/src/enum/transaction-type.enum.ts +0 -4
- package/src/finance-company/finance-company.repository.ts +0 -11
- package/src/finance-company/finance-company.ts +0 -2434
- package/src/helpers/login-user.ts +0 -38
- package/src/helpers/typeof.ts +0 -35
- package/src/index.ts +0 -32
- package/src/interfaces/account-system.interface.ts +0 -51
- package/src/interfaces/index.ts +0 -3
- package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +0 -12
- package/src/journal-entry/journal-entry.repository.ts +0 -17
- package/src/journal-entry/journal-entry.ts +0 -264
- package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +0 -18
- package/src/ledger-transaction/interfaces/ledger-transaction.repository.interface.ts +0 -7
- package/src/ledger-transaction/ledger-transaction.repository.ts +0 -17
- package/src/ledger-transaction/ledger-transaction.ts +0 -182
- package/src/models/account.entity.ts +0 -206
- package/src/models/customer.entity.ts +0 -93
- package/src/models/document-item.entity.ts +0 -167
- package/src/models/document.entity.ts +0 -211
- package/src/models/finance-company.entity.ts +0 -69
- package/src/models/journal-entry.entity.ts +0 -110
- package/src/models/ledger-transaction.entity.ts +0 -148
- package/src/models/payment-item.entity.ts +0 -60
- package/src/models/payment-method-type.entity.ts +0 -70
- package/src/models/payment-method.entity.ts +0 -51
- package/src/models/payment-paid-with.entity.ts +0 -133
- package/src/models/payment.entity.ts +0 -165
- package/src/models/post-history.entity.ts +0 -41
- package/src/models/tax.entity.ts +0 -75
- package/src/payment/interfaces/payment-attr.interface.ts +0 -23
- package/src/payment/interfaces/payment-params.interface.ts +0 -8
- package/src/payment/payment.repository.ts +0 -11
- package/src/payment/payment.ts +0 -236
- package/src/payment-item/interfaces/payment-item-attr.interface.ts +0 -10
- package/src/payment-item/payment-item.repository.ts +0 -11
- package/src/payment-item/payment-item.ts +0 -134
- package/src/payment-method/interfaces/payment-method-attr.interface.ts +0 -5
- package/src/payment-method/payment-method.repository.ts +0 -11
- package/src/payment-method/payment-method.ts +0 -146
- package/src/payment-method-type/interfaces/payment-method-type-attr.interface.ts +0 -8
- package/src/payment-method-type/payment-method-type.repository.ts +0 -11
- package/src/payment-method-type/payment-method-type.ts +0 -79
- package/src/payment-paid-with/interfaces/payment-paid-with.interface.ts +0 -20
- package/src/payment-paid-with/payment-paid-with.repository.ts +0 -11
- package/src/payment-paid-with/payment-paid-with.ts +0 -74
- package/src/tax/interfaces/tax-attr.interface.ts +0 -10
- package/src/tax/tax.repository.ts +0 -11
- package/src/tax/tax.ts +0 -68
- package/src/test-document.ts +0 -25
- package/src/test.ts +0 -3
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -23
package/src/account/account.ts
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
|
|
2
|
-
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
3
|
-
import AccountModel from '../models/account.entity';
|
|
4
|
-
import { AccountRepository } from './account.repository';
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
-
// const getConfig = require('../config');
|
|
8
|
-
|
|
9
|
-
export default class Account extends AccountSystemEntity {
|
|
10
|
-
AccountNo = 'New';
|
|
11
|
-
ParentAccountNo? = '';
|
|
12
|
-
Name = '';
|
|
13
|
-
Description = '';
|
|
14
|
-
AccountType = '';
|
|
15
|
-
AccountSubtype = '';
|
|
16
|
-
OwnerId = '';
|
|
17
|
-
OwnerType = '';
|
|
18
|
-
RelatedObjectId = '';
|
|
19
|
-
RelatedObjectType = '';
|
|
20
|
-
CreatedById = '';
|
|
21
|
-
CreatedAt: Date;
|
|
22
|
-
UpdatedById = '';
|
|
23
|
-
UpdatedAt: Date;
|
|
24
|
-
protected _ObjectType = 'Account';
|
|
25
|
-
|
|
26
|
-
private static _RepositoryBase = new AccountRepository();
|
|
27
|
-
|
|
28
|
-
private _DbTransaction: any;
|
|
29
|
-
private _IsNewRecord = true;
|
|
30
|
-
|
|
31
|
-
private get IsNewRecord() {
|
|
32
|
-
return this._IsNewRecord;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private set IsNewRecord(record: boolean) {
|
|
36
|
-
this._IsNewRecord = record;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get ObjectType() {
|
|
40
|
-
return this._ObjectType;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* AccountSystemEntity Implementation */
|
|
44
|
-
get RepositoryBase() {
|
|
45
|
-
return Account._RepositoryBase;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* ObjectBase Implementation */
|
|
49
|
-
get ObjectId() {
|
|
50
|
-
return this.AccountNo;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get ObjectName() {
|
|
54
|
-
return this.Name;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get TableName() {
|
|
58
|
-
return 'finance_Account';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
constructor(dbTransaction?: any, accountNo?: string) {
|
|
62
|
-
super();
|
|
63
|
-
if (dbTransaction) {
|
|
64
|
-
this._DbTransaction = dbTransaction;
|
|
65
|
-
}
|
|
66
|
-
if (accountNo) {
|
|
67
|
-
this.RepositoryBase.findOne({
|
|
68
|
-
where: {
|
|
69
|
-
AccountNo: accountNo,
|
|
70
|
-
},
|
|
71
|
-
transaction: dbTransaction,
|
|
72
|
-
})
|
|
73
|
-
.then((accountData) => {
|
|
74
|
-
if (accountData) {
|
|
75
|
-
this.IsNewRecord = false;
|
|
76
|
-
this.CompanyId = accountData.CompanyId;
|
|
77
|
-
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
78
|
-
this.Name = accountData.Name;
|
|
79
|
-
this.Description = accountData.Description;
|
|
80
|
-
this.AccountType = accountData.AccountType;
|
|
81
|
-
this.AccountSubtype = accountData.AccountSubType;
|
|
82
|
-
this.OwnerId = accountData.OwnerId;
|
|
83
|
-
this.OwnerType = accountData.OwnerType;
|
|
84
|
-
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
85
|
-
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
86
|
-
this.CreatedById = accountData.CreatedById;
|
|
87
|
-
this.CreatedAt = accountData.CreatedAt;
|
|
88
|
-
this.UpdatedById = accountData.UpdatedById;
|
|
89
|
-
this.UpdatedAt = accountData.UpdatedAt;
|
|
90
|
-
this.AccSystemRefId = accountData.AccSystemRefId;
|
|
91
|
-
this.PostedToAccSystemYN = accountData.PostedToAccSystemYN;
|
|
92
|
-
this.PostedById = accountData.PostedById;
|
|
93
|
-
this.PostedDateTime = accountData.PostedDateTime;
|
|
94
|
-
} else {
|
|
95
|
-
const notFoundError = new RecordNotFoundError(
|
|
96
|
-
'AccountErrMsg',
|
|
97
|
-
'No Record Found.',
|
|
98
|
-
);
|
|
99
|
-
throw notFoundError;
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
.catch((err) => {
|
|
103
|
-
// tslint:disable-next-line:no-console
|
|
104
|
-
console.log('Account Class constructor err: ', err);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public init(accountData: any) {
|
|
110
|
-
this.IsNewRecord = false;
|
|
111
|
-
this.AccountNo = accountData.AccountNo;
|
|
112
|
-
this.CompanyId = accountData.CompanyId;
|
|
113
|
-
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
114
|
-
this.Name = accountData.Name;
|
|
115
|
-
this.Description = accountData.Description;
|
|
116
|
-
this.AccountType = accountData.AccountType;
|
|
117
|
-
this.AccountSubtype = accountData.AccountSubType;
|
|
118
|
-
this.OwnerId = accountData.OwnerId;
|
|
119
|
-
this.OwnerType = accountData.OwnerType;
|
|
120
|
-
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
121
|
-
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
122
|
-
this.CreatedById = accountData.CreatedById;
|
|
123
|
-
this.CreatedAt = accountData.CreatedAt;
|
|
124
|
-
this.UpdatedById = accountData.UpdatedById;
|
|
125
|
-
this.UpdatedAt = accountData.UpdatedAt;
|
|
126
|
-
this.AccSystemRefId = accountData.AccSystemRefId;
|
|
127
|
-
this.PostedToAccSystemYN = accountData.PostedToAccSystemYN;
|
|
128
|
-
this.PostedById = accountData.PostedById;
|
|
129
|
-
this.PostedDateTime = accountData.PostedDateTime;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
static async initAccount(
|
|
133
|
-
dbTransaction: any,
|
|
134
|
-
accountNo: string,
|
|
135
|
-
): Promise<Account> {
|
|
136
|
-
try {
|
|
137
|
-
const accountData = await Account._RepositoryBase.findOne({
|
|
138
|
-
where: {
|
|
139
|
-
AccountNo: accountNo,
|
|
140
|
-
},
|
|
141
|
-
transaction: dbTransaction,
|
|
142
|
-
});
|
|
143
|
-
if (accountData) {
|
|
144
|
-
const account = new Account(dbTransaction);
|
|
145
|
-
account.init(accountData.get({ plain: true }));
|
|
146
|
-
return account;
|
|
147
|
-
} else {
|
|
148
|
-
const notFoundError = new RecordNotFoundError(
|
|
149
|
-
'AccountErrMsg',
|
|
150
|
-
'No Record Found.',
|
|
151
|
-
);
|
|
152
|
-
throw notFoundError;
|
|
153
|
-
}
|
|
154
|
-
} catch (error) {
|
|
155
|
-
console.log('Account Class constructor err: ', error);
|
|
156
|
-
throw error;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Account static constructor
|
|
162
|
-
*
|
|
163
|
-
* Create the Customer Account Receivable (AR) and Customer Account Payable (AP) default accounts.
|
|
164
|
-
* The static constructor is to run once each time the program loads and check if the default accounts have been created.
|
|
165
|
-
* If it has not, it will create the accounts.
|
|
166
|
-
*/
|
|
167
|
-
static initialize(): void {
|
|
168
|
-
const dbTransaction = null;
|
|
169
|
-
let defaultAccountReceivable: Account;
|
|
170
|
-
let defaultAccountPayable: Account;
|
|
171
|
-
|
|
172
|
-
// const config = getConfig();
|
|
173
|
-
// config.systemConfig['EZC']
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
defaultAccountReceivable = new Account(dbTransaction, 'EZC-AR');
|
|
177
|
-
} catch (err) {
|
|
178
|
-
defaultAccountReceivable = new Account(dbTransaction);
|
|
179
|
-
defaultAccountReceivable.AccountNo = null;
|
|
180
|
-
defaultAccountReceivable.AccountType = 'Account Receivable';
|
|
181
|
-
defaultAccountReceivable.OwnerId = 'System';
|
|
182
|
-
defaultAccountReceivable.OwnerType = '';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
defaultAccountPayable = new Account(dbTransaction, 'EZC-AP');
|
|
187
|
-
} catch (err) {
|
|
188
|
-
defaultAccountPayable = new Account(dbTransaction);
|
|
189
|
-
defaultAccountPayable.AccountNo = null;
|
|
190
|
-
defaultAccountPayable.AccountType = 'Account Payable';
|
|
191
|
-
defaultAccountPayable.OwnerId = 'System';
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
validateAccountValue() {
|
|
196
|
-
if (!this.AccSystemRefId) {
|
|
197
|
-
throw new Error('AccSystemAccountId is required.');
|
|
198
|
-
}
|
|
199
|
-
if (!this.AccountType) {
|
|
200
|
-
throw new Error('AccountType is required.');
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
isParentAccountExists() {
|
|
205
|
-
if (this.ParentAccountNo) return true;
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async save(
|
|
210
|
-
CompanyId: string,
|
|
211
|
-
AccSystemRefId: string,
|
|
212
|
-
userId: string,
|
|
213
|
-
dbTransaction?: any,
|
|
214
|
-
): Promise<Account> {
|
|
215
|
-
this.AccSystemRefId = AccSystemRefId;
|
|
216
|
-
console.log('Account Save: Before AccountNo FindOne');
|
|
217
|
-
|
|
218
|
-
let data = await this.RepositoryBase.findOne({
|
|
219
|
-
where: {
|
|
220
|
-
AccountNo: this.AccountNo,
|
|
221
|
-
},
|
|
222
|
-
transaction: dbTransaction,
|
|
223
|
-
});
|
|
224
|
-
console.log('Account Save: After AccountNo FindOne');
|
|
225
|
-
console.log(data, '<><><><><> Account Data Result <><><><><><>');
|
|
226
|
-
|
|
227
|
-
if (data) {
|
|
228
|
-
console.log('Account Save: THERE IS DATA FOUND');
|
|
229
|
-
const oldAccountNo = data.AccountNo;
|
|
230
|
-
this.AccountNo = this.AccountNo || data.AccountNo;
|
|
231
|
-
this.AccSystemRefId = this.AccSystemRefId || data.AccSystemRefId;
|
|
232
|
-
this.Name = this.Name || data.Name;
|
|
233
|
-
this.Description = this.Description || data.Description;
|
|
234
|
-
this.AccountType = this.AccountType || data.AccountType;
|
|
235
|
-
this.AccountSubtype = this.AccountSubtype || data.AccountSubType;
|
|
236
|
-
this.CompanyId = this.CompanyId || data.CompanyId;
|
|
237
|
-
this.OwnerId = this.OwnerId || data.OwnerId;
|
|
238
|
-
this.OwnerType = this.OwnerType || data.OwnerType;
|
|
239
|
-
this.RelatedObjectId = this.RelatedObjectId || data.RelatedObjectId;
|
|
240
|
-
this.RelatedObjectType = this.RelatedObjectType || data.RelatedObjectType;
|
|
241
|
-
this.PostedToAccSystemYN =
|
|
242
|
-
this.PostedToAccSystemYN || data.PostedToAccSystemYN;
|
|
243
|
-
this.ParentAccountNo = this.ParentAccountNo || data.ParentAccountNo;
|
|
244
|
-
this.CreatedAt = data.CreatedAt;
|
|
245
|
-
this.CreatedById = data.CreatedById;
|
|
246
|
-
this.UpdatedAt = new Date();
|
|
247
|
-
this.UpdatedById = userId;
|
|
248
|
-
|
|
249
|
-
await this.RepositoryBase.update(
|
|
250
|
-
{
|
|
251
|
-
AccountNo: this.AccountNo,
|
|
252
|
-
AccSystemRefId: this.AccSystemRefId,
|
|
253
|
-
Name: this.Name,
|
|
254
|
-
Description: this.Description,
|
|
255
|
-
AccountType: this.AccountType,
|
|
256
|
-
AccountSubtype: this.AccountSubtype,
|
|
257
|
-
CompanyId: this.CompanyId,
|
|
258
|
-
OwnerId: this.OwnerId,
|
|
259
|
-
OwnerType: this.OwnerType,
|
|
260
|
-
RelatedObjectId: this.RelatedObjectId,
|
|
261
|
-
RelatedObjectType: this.RelatedObjectType,
|
|
262
|
-
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
263
|
-
ParentAccountNo: this.ParentAccountNo,
|
|
264
|
-
UpdatedAt: this.UpdatedAt,
|
|
265
|
-
UpdatedById: this.UpdatedById,
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
where: {
|
|
269
|
-
AccountNo: oldAccountNo,
|
|
270
|
-
},
|
|
271
|
-
transaction: dbTransaction,
|
|
272
|
-
},
|
|
273
|
-
);
|
|
274
|
-
} else {
|
|
275
|
-
console.log('Account Save: THERE IS NO DATA FOUND');
|
|
276
|
-
|
|
277
|
-
data = await this.RepositoryBase.create(
|
|
278
|
-
{
|
|
279
|
-
AccountNo: this.AccountNo,
|
|
280
|
-
AccSystemRefId: this.AccSystemRefId,
|
|
281
|
-
Name: this.Name,
|
|
282
|
-
Description: this.Description,
|
|
283
|
-
AccountType: this.AccountType,
|
|
284
|
-
AccountSubtype: this.AccountSubtype,
|
|
285
|
-
CompanyId: CompanyId,
|
|
286
|
-
OwnerId: this.OwnerId,
|
|
287
|
-
OwnerType: this.OwnerType,
|
|
288
|
-
RelatedObjectId: this.RelatedObjectId,
|
|
289
|
-
RelatedObjectType: this.RelatedObjectType,
|
|
290
|
-
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
291
|
-
ParentAccountNo: this.ParentAccountNo,
|
|
292
|
-
CreatedAt: new Date(),
|
|
293
|
-
UpdatedAt: new Date(),
|
|
294
|
-
CreatedById: userId,
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
transaction: dbTransaction,
|
|
298
|
-
},
|
|
299
|
-
);
|
|
300
|
-
console.log(data, '<><><><><><><> DATA THAT GETS CREATED <><><><><><><>');
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
console.log(data, 'Account Save: Account details returned');
|
|
304
|
-
|
|
305
|
-
return this;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ObjectBase, LoginUserBase } from '@tomei/general';
|
|
2
|
-
|
|
3
|
-
export interface IAccountAttr {
|
|
4
|
-
AccountNo: string;
|
|
5
|
-
CompanyId: string;
|
|
6
|
-
ParentAccountNo?: string;
|
|
7
|
-
Name: string;
|
|
8
|
-
Description?: string;
|
|
9
|
-
AccountType: string;
|
|
10
|
-
AccountSubType?: string;
|
|
11
|
-
OwnerId?: string;
|
|
12
|
-
OwnerType?: string;
|
|
13
|
-
RelatedObjectId?: string;
|
|
14
|
-
RelatedObjectType?: string;
|
|
15
|
-
CreatedAt: Date;
|
|
16
|
-
CreatedById: string;
|
|
17
|
-
UpdatedAt?: Date;
|
|
18
|
-
UpdatedById?: string;
|
|
19
|
-
AccSystemRefId: string;
|
|
20
|
-
PostedToAccSystemYN: string;
|
|
21
|
-
PostedById?: string;
|
|
22
|
-
PostedDateTime?: Date;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface ICreateAccountAttr {
|
|
26
|
-
Owner: LoginUserBase;
|
|
27
|
-
RelatedObject?: ObjectBase;
|
|
28
|
-
AccountType?: string;
|
|
29
|
-
AccountSubType?: string;
|
|
30
|
-
ParentAccountNo?: string;
|
|
31
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { IRepositoryBase, LoginUserBase, ObjectBase } from '@tomei/general';
|
|
2
|
-
// import { FinanceCompany } from '../finance-company';
|
|
3
|
-
import { PostHistoryRepository } from './post-history.repository';
|
|
4
|
-
import cuid from 'cuid';
|
|
5
|
-
import { Injectable } from '@nestjs/common';
|
|
6
|
-
|
|
7
|
-
@Injectable()
|
|
8
|
-
export abstract class AccountSystemEntity extends ObjectBase {
|
|
9
|
-
CompanyId = '';
|
|
10
|
-
PostedToAccSystemYN = 'N';
|
|
11
|
-
AccSystemRefId = 'REF';
|
|
12
|
-
PostedById = '';
|
|
13
|
-
PostedDateTime: Date;
|
|
14
|
-
protected abstract _ObjectType: string;
|
|
15
|
-
protected abstract RepositoryBase: IRepositoryBase<any>;
|
|
16
|
-
private static PostHistoryRepository = new PostHistoryRepository();
|
|
17
|
-
|
|
18
|
-
async postToAccSystem(dbTransaction: any, loginUser: LoginUserBase) {
|
|
19
|
-
try {
|
|
20
|
-
/*retrieve the finance company details from finance_Company to
|
|
21
|
-
* get details of the accounting system*/
|
|
22
|
-
const company = 'test';
|
|
23
|
-
// const company = await FinanceCompany.getFinanceCompany(this.CompanyId);
|
|
24
|
-
|
|
25
|
-
/*todo:instantiating the appropriate accounting system to perform the post*/
|
|
26
|
-
// if (this.TableName === 'finance_Customer') {
|
|
27
|
-
// await this.AccountingSystem.createCustomer();
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
|
-
/*setting the posted fields*/
|
|
31
|
-
this.PostedToAccSystemYN = 'Y';
|
|
32
|
-
this.PostedById = loginUser.ObjectId;
|
|
33
|
-
this.PostedDateTime = new Date();
|
|
34
|
-
|
|
35
|
-
/*updating the posted fields to the table either using direct
|
|
36
|
-
* SQL or RepositoryBase*/
|
|
37
|
-
const entity = await this.RepositoryBase.findByPk(this.ObjectId);
|
|
38
|
-
const updated = await entity.update(
|
|
39
|
-
{
|
|
40
|
-
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
41
|
-
PostedById: this.PostedById,
|
|
42
|
-
PostedDateTime: this.PostedDateTime,
|
|
43
|
-
},
|
|
44
|
-
{ transaction: dbTransaction },
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
/*writing to accounting transaction log table finance_PostHistory*/
|
|
48
|
-
await AccountSystemEntity.PostHistoryRepository.create(
|
|
49
|
-
{
|
|
50
|
-
PostId: cuid(),
|
|
51
|
-
DateTime: this.PostedDateTime,
|
|
52
|
-
ItemId: this.ObjectId,
|
|
53
|
-
ItemType: this.TableName,
|
|
54
|
-
ItemValue: JSON.stringify(updated),
|
|
55
|
-
PostedById: this.PostedById,
|
|
56
|
-
AccSystemCode: 'test',
|
|
57
|
-
// AccSystemCode: company.AccSystemCode,
|
|
58
|
-
AccSystemRefId: this.AccSystemRefId,
|
|
59
|
-
},
|
|
60
|
-
{ transaction: dbTransaction },
|
|
61
|
-
);
|
|
62
|
-
} catch (err) {
|
|
63
|
-
throw err;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import FinancePostHistoryModel from '../models/post-history.entity';
|
|
3
|
-
|
|
4
|
-
export class PostHistoryRepository
|
|
5
|
-
extends RepositoryBase<FinancePostHistoryModel>
|
|
6
|
-
implements IRepositoryBase<FinancePostHistoryModel>
|
|
7
|
-
{
|
|
8
|
-
constructor() {
|
|
9
|
-
super(FinancePostHistoryModel);
|
|
10
|
-
}
|
|
11
|
-
}
|