taxtank-core 0.0.1 → 0.1.1
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/.browserslistrc +16 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +12 -0
- package/package.json +13 -12
- package/src/lib/collections/abstract.collection.ts +83 -0
- package/src/lib/collections/bank-account.collection.ts +171 -0
- package/src/lib/collections/bank-transaction.collection.ts +153 -0
- package/src/lib/collections/client-movement.collection.ts +42 -0
- package/src/lib/collections/client-portfolio-report.collection.ts +47 -0
- package/src/lib/collections/client.collection.ts +5 -0
- package/src/lib/collections/collection-dictionary.ts +112 -0
- package/src/lib/collections/depreciation-forecast.collection.ts +25 -0
- package/src/lib/collections/depreciation.collection.ts +113 -0
- package/src/lib/collections/employee.collection.ts +14 -0
- package/src/lib/collections/income-source.collection.ts +44 -0
- package/src/lib/collections/loan.collection.ts +22 -0
- package/src/lib/collections/logbook.collection.ts +129 -0
- package/src/lib/collections/message-document.collection.ts +16 -0
- package/src/lib/collections/message.collection.ts +27 -0
- package/src/lib/collections/property.collection.ts +88 -0
- package/src/lib/collections/service-price.collection.ts +13 -0
- package/src/lib/collections/service-subscription.collection.ts +20 -0
- package/src/lib/collections/tax-return-category-item.collection.ts +148 -0
- package/src/lib/collections/tax-review.collection.ts +64 -0
- package/src/lib/collections/transaction-allocation.collection.ts +54 -0
- package/src/lib/collections/transaction.collection.ts +170 -0
- package/src/lib/collections/user-event-setting.collection.ts +70 -0
- package/src/lib/db/Enums/address-type.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-status.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-type.enum.ts +10 -0
- package/src/lib/db/Enums/bank-connection-status.enum.ts +5 -0
- package/src/lib/db/Enums/bank-transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-category.enum.ts +13 -0
- package/src/lib/db/Enums/chart-accounts-etp.enum.ts +7 -0
- package/src/lib/db/Enums/chart-accounts-heading-tax-deductible.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-taxable.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-list.enum.ts +19 -0
- package/src/lib/db/Enums/chart-accounts-metadata-list.enum.ts +14 -0
- package/src/lib/db/Enums/chart-accounts-metadata-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-type.enum.ts +4 -0
- package/src/lib/db/Enums/chat-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/client-details-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/client-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-invite-type.enum.ts +4 -0
- package/src/lib/db/Enums/depreciation-calculation-percent.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-calculation.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-type.enum.ts +6 -0
- package/src/lib/db/Enums/depreciation-write-off-amount.enum.ts +4 -0
- package/src/lib/db/Enums/firm-type.enum.ts +4 -0
- package/src/lib/db/Enums/income-source-type-list-other.enum.ts +6 -0
- package/src/lib/db/Enums/income-source-type-list-salary.enum.ts +3 -0
- package/src/lib/db/Enums/income-source-type-list-work.enum.ts +8 -0
- package/src/lib/db/Enums/income-source-type.enum.ts +5 -0
- package/src/lib/db/Enums/invite-status.enum.ts +5 -0
- package/src/lib/db/Enums/loan-bank-type.enum.ts +10 -0
- package/src/lib/db/Enums/loan-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/loan-interest-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-payout-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-repayment-frequency.enum.ts +5 -0
- package/src/lib/db/Enums/loan-repayment-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-type.enum.ts +12 -0
- package/src/lib/db/Enums/loan-vehicle-type.enum.ts +5 -0
- package/src/lib/db/Enums/phone-type.enum.ts +4 -0
- package/src/lib/db/Enums/property-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-access.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-status.enum.ts +5 -0
- package/src/lib/db/Enums/registration-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/salary-forecast-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/service-notification-status.enum.ts +5 -0
- package/src/lib/db/Enums/service-notification-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-payment-status.enum.ts +4 -0
- package/src/lib/db/Enums/service-price-recurring-interval.enum.ts +6 -0
- package/src/lib/db/Enums/service-price-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-subscription-status.enum.ts +8 -0
- package/src/lib/db/Enums/spare-document-spare-type.enum.ts +4 -0
- package/src/lib/db/Enums/tank-type.enum.ts +5 -0
- package/src/lib/db/Enums/tax-calculation-medicare-exemption.enum.ts +4 -0
- package/src/lib/db/Enums/tax-calculation-type.enum.ts +12 -0
- package/src/lib/db/Enums/tax-return-category-list.enum.ts +26 -0
- package/src/lib/db/Enums/tax-return-category-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-review-status.enum.ts +11 -0
- package/src/lib/db/Enums/tax-summary-list.enum.ts +15 -0
- package/src/lib/db/Enums/tax-summary-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-summary-tax-summary.enum.ts +15 -0
- package/src/lib/db/Enums/ticket-feedback.enum.ts +4 -0
- package/src/lib/db/Enums/ticket-status.enum.ts +7 -0
- package/src/lib/db/Enums/ticket-types.enum.ts +3 -0
- package/src/lib/db/Enums/transaction-operation.enum.ts +5 -0
- package/src/lib/db/Enums/transaction-source.enum.ts +4 -0
- package/src/lib/db/Enums/transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/user-event-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder-type.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder.enum.ts +5 -0
- package/src/lib/db/Enums/user-event-type-type.enum.ts +33 -0
- package/src/lib/db/Enums/user-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/user-roles.enum.ts +13 -0
- package/src/lib/db/Enums/user-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-title.enum.ts +7 -0
- package/src/lib/db/Enums/user-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/user-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/vehicle-claim-method.enum.ts +4 -0
- package/src/lib/db/Enums/vehicle-logbook-purpose.enum.ts +4 -0
- package/src/lib/db/Models/address.ts +20 -0
- package/src/lib/db/Models/bank-account-balance.ts +13 -0
- package/src/lib/db/Models/bank-account-property.ts +9 -0
- package/src/lib/db/Models/bank-account.ts +34 -0
- package/src/lib/db/Models/bank-connection.ts +15 -0
- package/src/lib/db/Models/bank-provider-account.ts +13 -0
- package/src/lib/db/Models/bank-transaction-import.ts +12 -0
- package/src/lib/db/Models/bank-transaction-rule.ts +26 -0
- package/src/lib/db/Models/bank-transaction.ts +17 -0
- package/src/lib/db/Models/bank.ts +12 -0
- package/src/lib/db/Models/basiq-job.ts +9 -0
- package/src/lib/db/Models/borrowing-expense-loan.ts +15 -0
- package/src/lib/db/Models/borrowing-expense.ts +7 -0
- package/src/lib/db/Models/capital-cost-property.ts +14 -0
- package/src/lib/db/Models/capital-cost.ts +4 -0
- package/src/lib/db/Models/chart-accounts-depreciation.ts +11 -0
- package/src/lib/db/Models/chart-accounts-heading.ts +7 -0
- package/src/lib/db/Models/chart-accounts-metadata.ts +12 -0
- package/src/lib/db/Models/chart-accounts-value.ts +13 -0
- package/src/lib/db/Models/chart-accounts.ts +24 -0
- package/src/lib/db/Models/chat.ts +18 -0
- package/src/lib/db/Models/client-details.ts +30 -0
- package/src/lib/db/Models/client-invite.ts +17 -0
- package/src/lib/db/Models/client-movement.ts +13 -0
- package/src/lib/db/Models/country.ts +5 -0
- package/src/lib/db/Models/depreciation-capital-project.ts +14 -0
- package/src/lib/db/Models/depreciation-forecast.ts +19 -0
- package/src/lib/db/Models/depreciation-receipt.ts +12 -0
- package/src/lib/db/Models/depreciation.ts +43 -0
- package/src/lib/db/Models/document-base.ts +10 -0
- package/src/lib/db/Models/document-folder.ts +10 -0
- package/src/lib/db/Models/document.ts +12 -0
- package/src/lib/db/Models/employee-details.ts +8 -0
- package/src/lib/db/Models/employee-invite.ts +10 -0
- package/src/lib/db/Models/financial-data-system.ts +10 -0
- package/src/lib/db/Models/firm-invite.ts +15 -0
- package/src/lib/db/Models/firm.ts +29 -0
- package/src/lib/db/Models/income-source-forecast.ts +13 -0
- package/src/lib/db/Models/income-source-type.ts +9 -0
- package/src/lib/db/Models/income-source.ts +21 -0
- package/src/lib/db/Models/loan-payout.ts +13 -0
- package/src/lib/db/Models/loan.ts +34 -0
- package/src/lib/db/Models/message-document.ts +16 -0
- package/src/lib/db/Models/message.ts +16 -0
- package/src/lib/db/Models/occupation.ts +5 -0
- package/src/lib/db/Models/phone.ts +13 -0
- package/src/lib/db/Models/property-capital-cost.ts +14 -0
- package/src/lib/db/Models/property-category-movement.ts +18 -0
- package/src/lib/db/Models/property-category.ts +14 -0
- package/src/lib/db/Models/property-document.ts +14 -0
- package/src/lib/db/Models/property-forecast.ts +15 -0
- package/src/lib/db/Models/property-owner.ts +21 -0
- package/src/lib/db/Models/property-sold.ts +13 -0
- package/src/lib/db/Models/property-subscription.ts +10 -0
- package/src/lib/db/Models/property-valuation.ts +13 -0
- package/src/lib/db/Models/property.ts +42 -0
- package/src/lib/db/Models/registration-invite.ts +13 -0
- package/src/lib/db/Models/salary-forecast.ts +16 -0
- package/src/lib/db/Models/service-notification.ts +14 -0
- package/src/lib/db/Models/service-payment.ts +12 -0
- package/src/lib/db/Models/service-price.ts +16 -0
- package/src/lib/db/Models/service-product.ts +13 -0
- package/src/lib/db/Models/service-subscription-item.ts +10 -0
- package/src/lib/db/Models/service-subscription.ts +15 -0
- package/src/lib/db/Models/spare-document-category.ts +6 -0
- package/src/lib/db/Models/spare-document.ts +16 -0
- package/src/lib/db/Models/tax-calculation.ts +19 -0
- package/src/lib/db/Models/tax-return-category.ts +13 -0
- package/src/lib/db/Models/tax-return-item.ts +16 -0
- package/src/lib/db/Models/tax-return.ts +9 -0
- package/src/lib/db/Models/tax-review.ts +14 -0
- package/src/lib/db/Models/ticket.ts +20 -0
- package/src/lib/db/Models/transaction-allocation.ts +9 -0
- package/src/lib/db/Models/transaction-base.ts +33 -0
- package/src/lib/db/Models/transaction-metadata.ts +12 -0
- package/src/lib/db/Models/transaction-receipt.ts +12 -0
- package/src/lib/db/Models/transaction.ts +44 -0
- package/src/lib/db/Models/user-event-setting.ts +11 -0
- package/src/lib/db/Models/user-event-type.ts +16 -0
- package/src/lib/db/Models/user-event.ts +14 -0
- package/src/lib/db/Models/user.ts +52 -0
- package/src/lib/db/Models/vehicle-claim.ts +12 -0
- package/src/lib/db/Models/vehicle-logbook.ts +17 -0
- package/src/lib/db/Models/vehicle.ts +9 -0
- package/src/lib/functions/array/index.ts +3 -0
- package/src/lib/functions/array/replace.ts +5 -0
- package/src/lib/functions/array/sort-deep.ts +19 -0
- package/src/lib/functions/array/sort.ts +8 -0
- package/src/lib/functions/clone-deep.ts +4 -0
- package/src/lib/functions/create-date.ts +7 -0
- package/src/lib/functions/enum-to-list.ts +16 -0
- package/src/lib/functions/get-doc-icon.ts +21 -0
- package/src/lib/functions/mat-options-functions.ts +11 -0
- package/src/lib/functions/mat-sort-options.ts +9 -0
- package/src/lib/functions/round-to.ts +9 -0
- package/src/lib/functions/tax-review-filter-predicate.ts +11 -0
- package/src/lib/interfaces/asset-entity-type.enum.ts +10 -0
- package/src/lib/interfaces/asset-type.enum.ts +9 -0
- package/src/lib/interfaces/asset.interface.ts +18 -0
- package/src/lib/interfaces/chart-data.interface.ts +11 -0
- package/src/lib/interfaces/chart-serie.interface.ts +8 -0
- package/src/lib/interfaces/document.interface.ts +20 -0
- package/src/lib/interfaces/documentable.interface.ts +9 -0
- package/src/lib/interfaces/event-listener.interface.ts +9 -0
- package/src/lib/interfaces/income-source-forecast.interface.ts +7 -0
- package/src/lib/interfaces/option.interface.ts +4 -0
- package/src/lib/interfaces/photoable.ts +14 -0
- package/src/lib/interfaces/receipt.interface.ts +13 -0
- package/src/lib/interfaces/salary-forecast.interface.ts +17 -0
- package/src/lib/interfaces/tank.interface.ts +9 -0
- package/src/lib/models/address/address.ts +24 -0
- package/src/lib/models/address/country.ts +17 -0
- package/src/lib/models/bank/bank-account-chart-data.ts +42 -0
- package/src/lib/models/bank/bank-account-property.ts +8 -0
- package/src/lib/models/bank/bank-account-types.const.ts +15 -0
- package/src/lib/models/bank/bank-account.ts +136 -0
- package/src/lib/models/bank/bank-connection.ts +12 -0
- package/src/lib/models/bank/bank-transaction-chart-data.ts +132 -0
- package/src/lib/models/bank/bank-transaction-summary-fields.enum.ts +4 -0
- package/src/lib/models/bank/bank-transaction.ts +74 -0
- package/src/lib/models/bank/bank.ts +21 -0
- package/src/lib/models/bank/basiq-job.ts +4 -0
- package/src/lib/models/bank/basiq-token.ts +16 -0
- package/src/lib/models/bank/type-loan.const.ts +7 -0
- package/src/lib/models/borrowing-expense/borrowing-expense-loan.ts +4 -0
- package/src/lib/models/borrowing-expense/borrowing-expense.ts +4 -0
- package/src/lib/models/chart/chart-data.ts +13 -0
- package/src/lib/models/chart/chart-serie.ts +8 -0
- package/src/lib/models/chart-accounts/chart-accounts-categories.const.ts +85 -0
- package/src/lib/models/chart-accounts/chart-accounts-depreciation.ts +14 -0
- package/src/lib/models/chart-accounts/chart-accounts-heading.ts +6 -0
- package/src/lib/models/chart-accounts/chart-accounts-metadata.ts +15 -0
- package/src/lib/models/chart-accounts/chart-accounts-tax-labels.enum.ts +5 -0
- package/src/lib/models/chart-accounts/chart-accounts.ts +137 -0
- package/src/lib/models/chat/chat-view-type.enum.ts +4 -0
- package/src/lib/models/chat/chat.ts +23 -0
- package/src/lib/models/chat/message-document.ts +18 -0
- package/src/lib/models/chat/message.ts +40 -0
- package/src/lib/models/client/client-details.ts +4 -0
- package/src/lib/models/client/client-invite.ts +70 -0
- package/src/lib/models/client/client-movement.ts +25 -0
- package/src/lib/models/client/client-portfolio-chart-data.ts +65 -0
- package/src/lib/models/client/client-portfolio-report.ts +10 -0
- package/src/lib/models/depreciation/depreciation-capital-project.ts +10 -0
- package/src/lib/models/depreciation/depreciation-forecast.ts +31 -0
- package/src/lib/models/depreciation/depreciation-group-item.ts +20 -0
- package/src/lib/models/depreciation/depreciation-group.enum.ts +7 -0
- package/src/lib/models/depreciation/depreciation-group.ts +25 -0
- package/src/lib/models/depreciation/depreciation-groups.const.ts +35 -0
- package/src/lib/models/depreciation/depreciation-receipt.ts +9 -0
- package/src/lib/models/depreciation/depreciation.ts +174 -0
- package/src/lib/models/document/document-api-url-prefix.enum.ts +7 -0
- package/src/lib/models/document/document-file-types.const.ts +22 -0
- package/src/lib/models/document/document-folder.ts +11 -0
- package/src/lib/models/document/document.ts +29 -0
- package/src/lib/models/employee/employee-details.ts +8 -0
- package/src/lib/models/employee/employee-invite.ts +12 -0
- package/src/lib/models/endpoint/endpoint.ts +35 -0
- package/src/lib/models/endpoint/endpoints.const.ts +157 -0
- package/src/lib/models/event/app-event-type.enum.ts +37 -0
- package/src/lib/models/event/app-event.ts +9 -0
- package/src/lib/models/file/icons-file.enum.ts +5 -0
- package/src/lib/models/financial-year/financial-year.ts +57 -0
- package/src/lib/models/financial-year/month-name-short.enum.ts +19 -0
- package/src/lib/models/financial-year/month-number.enum.ts +19 -0
- package/src/lib/models/financial-year/months.const.ts +1 -0
- package/src/lib/models/firm/firm.ts +31 -0
- package/src/lib/models/income-position/income-position.ts +13 -0
- package/src/lib/models/income-source/income-source-chart-data.ts +57 -0
- package/src/lib/models/income-source/income-source-forecast.ts +35 -0
- package/src/lib/models/income-source/income-source-type.ts +30 -0
- package/src/lib/models/income-source/income-source.ts +57 -0
- package/src/lib/models/income-source/salary-forecast.ts +23 -0
- package/src/lib/models/loan/loan-max-number-of-payments.enum.ts +8 -0
- package/src/lib/models/loan/loan-payment.ts +17 -0
- package/src/lib/models/loan/loan-payout.ts +13 -0
- package/src/lib/models/loan/loan.ts +38 -0
- package/src/lib/models/logbook/default-vehicle-expense.ts +20 -0
- package/src/lib/models/logbook/logbook-period.ts +12 -0
- package/src/lib/models/logbook/logbook-purpose-options.const.ts +6 -0
- package/src/lib/models/logbook/vehicle-claim.ts +27 -0
- package/src/lib/models/logbook/vehicle-logbook.ts +16 -0
- package/src/lib/models/logbook/vehicle.ts +46 -0
- package/src/lib/models/notification/notification-event-types.const.ts +43 -0
- package/src/lib/models/notification/notification.ts +66 -0
- package/src/lib/models/phone/phone.ts +10 -0
- package/src/lib/models/property/calculation-form-item.ts +24 -0
- package/src/lib/models/property/calculation-form-type.enum.ts +7 -0
- package/src/lib/models/property/capital-costs-itmes.const.ts +57 -0
- package/src/lib/models/property/corelogic-suggestion.ts +18 -0
- package/src/lib/models/property/ownership-filter-options.enum.ts +8 -0
- package/src/lib/models/property/property-capital-cost.ts +4 -0
- package/src/lib/models/property/property-category-movement.ts +18 -0
- package/src/lib/models/property/property-category.ts +9 -0
- package/src/lib/models/property/property-document.ts +21 -0
- package/src/lib/models/property/property-equity-chart-data.ts +188 -0
- package/src/lib/models/property/property-equity-chart-item.ts +35 -0
- package/src/lib/models/property/property-equity-chart-type.enum.ts +4 -0
- package/src/lib/models/property/property-forecast.ts +55 -0
- package/src/lib/models/property/property-owner.ts +50 -0
- package/src/lib/models/property/property-sold.ts +10 -0
- package/src/lib/models/property/property-subscription.ts +11 -0
- package/src/lib/models/property/property-valuation.ts +24 -0
- package/src/lib/models/property/property.ts +157 -0
- package/src/lib/models/registration-invite/registration-invite.ts +12 -0
- package/src/lib/models/service-subscription/module-url-list.const.ts +11 -0
- package/src/lib/models/service-subscription/service-payment.ts +8 -0
- package/src/lib/models/service-subscription/service-price.ts +8 -0
- package/src/lib/models/service-subscription/service-product.ts +11 -0
- package/src/lib/models/service-subscription/service-subscription-item.ts +12 -0
- package/src/lib/models/service-subscription/service-subscription.ts +151 -0
- package/src/lib/models/service-subscription/subscription-description.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-title.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-type.enum.ts +6 -0
- package/src/lib/models/tax-review/tax-review.ts +96 -0
- package/src/lib/models/tax-summary/tax-return-category-item-details.ts +14 -0
- package/src/lib/models/tax-summary/tax-return-category-item.ts +22 -0
- package/src/lib/models/tax-summary/tax-summary-section.ts +32 -0
- package/src/lib/models/tax-summary/tax-summary-type.enum.ts +7 -0
- package/src/lib/models/tax-summary/tax-summary.ts +79 -0
- package/src/lib/models/transaction/income-amount-type.enum.ts +7 -0
- package/src/lib/models/transaction/transaction-allocation.ts +20 -0
- package/src/lib/models/transaction/transaction-metadata.ts +8 -0
- package/src/lib/models/transaction/transaction-receipt.ts +9 -0
- package/src/lib/models/transaction/transaction.ts +241 -0
- package/src/lib/models/user/my-account-history-initiated-by.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-status.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-type.enum.ts +5 -0
- package/src/lib/models/user/my-account-history.ts +12 -0
- package/src/lib/models/user/occupation.ts +4 -0
- package/src/lib/models/user/user-roles.const.ts +13 -0
- package/src/lib/models/user/user-to-register.ts +7 -0
- package/src/lib/models/user/user-work-position.const.ts +7 -0
- package/src/lib/models/user/user.ts +160 -0
- package/src/lib/models/user-event/user-event-category.enum.ts +9 -0
- package/src/lib/models/user-event/user-event-category.ts +9 -0
- package/src/lib/models/user-event/user-event-setting-field.enum.ts +8 -0
- package/src/lib/models/user-event/user-event-setting.ts +11 -0
- package/src/lib/models/user-event/user-event-type.ts +22 -0
- package/src/lib/services/address/address.service.spec.ts +12 -0
- package/src/lib/services/address/address.service.ts +36 -0
- package/src/lib/services/asset/assets.service.spec.ts +12 -0
- package/src/lib/services/asset/assets.service.ts +51 -0
- package/src/lib/services/auth/auth.service.ts +48 -0
- package/src/lib/services/auth/jwt.service.ts +37 -0
- package/src/lib/services/bank/bank-account-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-account-calculation.service.ts +38 -0
- package/src/lib/services/bank/bank-account.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-account.service.ts +120 -0
- package/src/lib/services/bank/bank-connection.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-connection.service.ts +42 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.ts +71 -0
- package/src/lib/services/bank/bank-transaction.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-transaction.service.ts +97 -0
- package/src/lib/services/bank/bank.service.spec.ts +12 -0
- package/src/lib/services/bank/bank.service.ts +16 -0
- package/src/lib/services/bank/basiq.service.spec.ts +12 -0
- package/src/lib/services/bank/basiq.service.ts +103 -0
- package/src/lib/services/base-rest.service.spec.ts +13 -0
- package/src/lib/services/base-rest.service.ts +229 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.spec.ts +12 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.ts +82 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.spec.ts +16 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.ts +34 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.spec.ts +12 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.ts +101 -0
- package/src/lib/services/chat/chat.service.spec.ts +16 -0
- package/src/lib/services/chat/chat.service.ts +79 -0
- package/src/lib/services/chat/message-document.service.spec.ts +16 -0
- package/src/lib/services/chat/message-document.service.ts +133 -0
- package/src/lib/services/chat/message.service.spec.ts +16 -0
- package/src/lib/services/chat/message.service.ts +61 -0
- package/src/lib/services/client/client-invite.service.spec.ts +16 -0
- package/src/lib/services/client/client-invite.service.ts +111 -0
- package/src/lib/services/client/client-movement.service.spec.ts +16 -0
- package/src/lib/services/client/client-movement.service.ts +114 -0
- package/src/lib/services/client/client-portfolio-report.service.spec.ts +16 -0
- package/src/lib/services/client/client-portfolio-report.service.ts +34 -0
- package/src/lib/services/depreciation/capital-project.service.spec.ts +16 -0
- package/src/lib/services/depreciation/capital-project.service.ts +69 -0
- package/src/lib/services/depreciation/depreciation.service.spec.ts +12 -0
- package/src/lib/services/depreciation/depreciation.service.ts +171 -0
- package/src/lib/services/document/document-folder.service.spec.ts +16 -0
- package/src/lib/services/document/document-folder.service.ts +95 -0
- package/src/lib/services/employee/employee-invite.service.spec.ts +16 -0
- package/src/lib/services/employee/employee-invite.service.ts +53 -0
- package/src/lib/services/employee/employee.service.spec.ts +16 -0
- package/src/lib/services/employee/employee.service.ts +35 -0
- package/src/lib/services/event/event-dispatcher.service.spec.ts +16 -0
- package/src/lib/services/event/event-dispatcher.service.ts +29 -0
- package/src/lib/services/event/sse.service.spec.ts +16 -0
- package/src/lib/services/event/sse.service.ts +42 -0
- package/src/lib/services/firm/firm.service.spec.ts +16 -0
- package/src/lib/services/firm/firm.service.ts +93 -0
- package/src/lib/services/header-title/header-title.service.spec.ts +12 -0
- package/src/lib/services/header-title/header-title.service.ts +31 -0
- package/src/lib/services/income-source/income-source-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/income-source-forecast.service.ts +91 -0
- package/src/lib/services/income-source/income-source.service.spec.ts +12 -0
- package/src/lib/services/income-source/income-source.service.ts +127 -0
- package/src/lib/services/income-source/salary-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/salary-forecast.service.ts +92 -0
- package/src/lib/services/intercom/intercom.service.spec.ts +16 -0
- package/src/lib/services/intercom/intercom.service.ts +37 -0
- package/src/lib/services/loan/loan.service.spec.ts +12 -0
- package/src/lib/services/loan/loan.service.ts +166 -0
- package/src/lib/services/notification/notification.service.spec.ts +12 -0
- package/src/lib/services/notification/notification.service.ts +60 -0
- package/src/lib/services/preloader/preloader.service.spec.ts +16 -0
- package/src/lib/services/preloader/preloader.service.ts +28 -0
- package/src/lib/services/property/corelogic.service.spec.ts +12 -0
- package/src/lib/services/property/corelogic.service.ts +47 -0
- package/src/lib/services/property/property-calculation.service.spec.ts +16 -0
- package/src/lib/services/property/property-calculation.service.ts +166 -0
- package/src/lib/services/property/property-capital-cost.service.ts +42 -0
- package/src/lib/services/property/property-category.service.spec.ts +16 -0
- package/src/lib/services/property/property-category.service.ts +15 -0
- package/src/lib/services/property/property-document.service.spec.ts +16 -0
- package/src/lib/services/property/property-document.service.ts +74 -0
- package/src/lib/services/property/property-owner.service.spec.ts +12 -0
- package/src/lib/services/property/property-owner.service.ts +134 -0
- package/src/lib/services/property/property-sold.service.spec.ts +16 -0
- package/src/lib/services/property/property-sold.service.ts +15 -0
- package/src/lib/services/property/property.service.spec.ts +12 -0
- package/src/lib/services/property/property.service.ts +136 -0
- package/src/lib/services/subscription/subscription.service.spec.ts +12 -0
- package/src/lib/services/subscription/subscription.service.ts +153 -0
- package/src/lib/services/tax-review/tax-review-history.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review-history.service.ts +35 -0
- package/src/lib/services/tax-review/tax-review.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review.service.ts +114 -0
- package/src/lib/services/tax-summary/tax-summary.service.ts +70 -0
- package/src/lib/services/transaction/transaction-allocation.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction-allocation.service.ts +92 -0
- package/src/lib/services/transaction/transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/transaction/transaction-calculation.service.ts +50 -0
- package/src/lib/services/transaction/transaction.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction.service.ts +374 -0
- package/src/lib/services/user/occupation.service.spec.ts +12 -0
- package/src/lib/services/user/occupation.service.ts +42 -0
- package/src/lib/services/user/user-switcher.service.ts +34 -0
- package/src/lib/services/user/user.service.spec.ts +12 -0
- package/src/lib/services/user/user.service.ts +140 -0
- package/src/lib/services/user-event/user-event-setting.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-setting.service.ts +60 -0
- package/src/lib/services/user-event/user-event-type.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-type.service.ts +24 -0
- package/src/lib/services/work/work-tank.service.spec.ts +12 -0
- package/src/lib/services/work/work-tank.service.ts +277 -0
- package/src/lib/tt-core.module.ts +22 -0
- package/src/lib/tt-core.service.spec.ts +16 -0
- package/src/lib/tt-core.service.ts +17 -0
- package/src/public-api.ts +425 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/taxtank-core.umd.js +0 -97
- package/bundles/taxtank-core.umd.js.map +0 -1
- package/esm2015/lib/tt-core.module.js +0 -33
- package/esm2015/lib/tt-core.service.js +0 -23
- package/esm2015/public-api.js +0 -6
- package/esm2015/taxtank-core.js +0 -5
- package/fesm2015/taxtank-core.js +0 -64
- package/fesm2015/taxtank-core.js.map +0 -1
- package/lib/tt-core.module.d.ts +0 -9
- package/lib/tt-core.service.d.ts +0 -8
- package/public-api.d.ts +0 -2
- package/taxtank-core.d.ts +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// replace array element with the new one (only arrays of objects)
|
|
2
|
+
export function replace(array: any[], item: any, matchField: string = 'id'): void {
|
|
3
|
+
const index: number = array.findIndex((i: any) => i[matchField] === item[matchField]);
|
|
4
|
+
array.splice(index, 1, item);
|
|
5
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// sort array of objects by field
|
|
2
|
+
export function sortDeep(array: any[], fieldsQueue: string[] = ['id'], isDesc: boolean = true): void {
|
|
3
|
+
array.sort((a: any, b: any): number => {
|
|
4
|
+
const aValue: any = getValue(a, fieldsQueue);
|
|
5
|
+
const bValue: any = getValue(b, fieldsQueue);
|
|
6
|
+
|
|
7
|
+
if (aValue > bValue) { return !isDesc ? 1 : -1; }
|
|
8
|
+
if (aValue < bValue) { return !isDesc ? -1 : 1; }
|
|
9
|
+
return 0;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getValue(obj: any, fields: string[]): any {
|
|
14
|
+
let value: any = obj;
|
|
15
|
+
fields.forEach((field: string) => {
|
|
16
|
+
value = value[field];
|
|
17
|
+
});
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// sort array of objects by field
|
|
2
|
+
export function sort(array: any[], field: string = 'id', isDesc: boolean = true): void {
|
|
3
|
+
array.sort((a: any, b: any): number => {
|
|
4
|
+
if (a[field] > b[field]) { return !isDesc ? 1 : -1; }
|
|
5
|
+
if (a[field] < b[field]) { return !isDesc ? -1 : 1; }
|
|
6
|
+
return 0;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IOption } from '../interfaces/option.interface';
|
|
2
|
+
|
|
3
|
+
export function enumToList(data: object): IOption[] {
|
|
4
|
+
const list: IOption[] = [];
|
|
5
|
+
|
|
6
|
+
for (const key in data) {
|
|
7
|
+
if (Number(key) >= 0) {
|
|
8
|
+
list.push({
|
|
9
|
+
label: data[key],
|
|
10
|
+
value: Number(key)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return list;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IAsset } from '../interfaces/asset.interface';
|
|
2
|
+
import { IconsFileEnum } from '../models/file/icons-file.enum';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Function which returns icon depends on document extension
|
|
6
|
+
* @param document
|
|
7
|
+
*/
|
|
8
|
+
export function getDocIcon(document: IAsset): IconsFileEnum {
|
|
9
|
+
switch (document.mimeType) {
|
|
10
|
+
case 'image/gif':
|
|
11
|
+
case 'image/jpeg':
|
|
12
|
+
case 'image/png':
|
|
13
|
+
return IconsFileEnum.JPG;
|
|
14
|
+
|
|
15
|
+
case 'application/pdf':
|
|
16
|
+
return IconsFileEnum.PDF;
|
|
17
|
+
|
|
18
|
+
default:
|
|
19
|
+
return IconsFileEnum.DOC;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare function, that used for sortData method
|
|
3
|
+
* @param a: first comparison argument
|
|
4
|
+
* @param b: second comparison argument
|
|
5
|
+
* @param isAsc: is ascending sorting flag
|
|
6
|
+
*/
|
|
7
|
+
export function compare(a: number | string, b: number | string, isAsc: boolean): number {
|
|
8
|
+
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function which round value to the provided decimals
|
|
3
|
+
* @param value to be rounded
|
|
4
|
+
* @param decimals: amount of decimals
|
|
5
|
+
*/
|
|
6
|
+
export function roundTo(value: number, decimals: number = 2): number {
|
|
7
|
+
const multiplier: number = Math.pow(10, decimals);
|
|
8
|
+
return Math.round((value * 100) * multiplier) / multiplier;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TaxReview } from '../models/tax-review/tax-review';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Filter predicate function to search inside TaxReview class fields
|
|
5
|
+
* @param data in which query will be searched
|
|
6
|
+
* @param filter: search query
|
|
7
|
+
*/
|
|
8
|
+
export function taxReviewFilterPredicate(data: TaxReview, filter: string): boolean {
|
|
9
|
+
return data.client.fullName.toLowerCase().includes(filter) ||
|
|
10
|
+
data.employee.fullName.toLowerCase().includes(filter);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AssetTypeEnum } from './asset-type.enum';
|
|
2
|
+
import { AssetEntityTypeEnum } from './asset-entity-type.enum';
|
|
3
|
+
import { User } from '../models/user/user';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for assets (documents, receipts, e.t.c.)
|
|
7
|
+
*/
|
|
8
|
+
export interface IAsset {
|
|
9
|
+
id?: number;
|
|
10
|
+
type: AssetTypeEnum;
|
|
11
|
+
entityType: AssetEntityTypeEnum;
|
|
12
|
+
name?: string;
|
|
13
|
+
originalName?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
createdAt?: Date;
|
|
17
|
+
user?: User;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Documentable } from './documentable.interface';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interface for documents
|
|
5
|
+
*/
|
|
6
|
+
export interface IDocument {
|
|
7
|
+
id?: number;
|
|
8
|
+
originalName?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
/**
|
|
12
|
+
* Get document parent entity
|
|
13
|
+
*/
|
|
14
|
+
getEntity(): Documentable;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get API url prefix
|
|
18
|
+
*/
|
|
19
|
+
getApiUrlPrefix(): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IAsset } from './asset.interface';
|
|
2
|
+
import { ChartAccounts } from '../models/chart-accounts/chart-accounts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface that contains main fields for transaction-like classes
|
|
6
|
+
*/
|
|
7
|
+
export interface IReceipt {
|
|
8
|
+
id?: number;
|
|
9
|
+
amount?: number;
|
|
10
|
+
receipt: IAsset;
|
|
11
|
+
chartAccounts: ChartAccounts;
|
|
12
|
+
getDate(): Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SalaryForecastFrequencyEnum } from '../db/Enums/salary-forecast-frequency.enum';
|
|
2
|
+
import { IncomeSource } from '../models/income-source/income-source';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface for income source forecasts that related to Salary category
|
|
6
|
+
*/
|
|
7
|
+
export interface ISalaryForecast {
|
|
8
|
+
id: number;
|
|
9
|
+
tax: number;
|
|
10
|
+
netPay: number;
|
|
11
|
+
grossAmount: number;
|
|
12
|
+
paygIncome: number;
|
|
13
|
+
financialYear: number;
|
|
14
|
+
frequency: SalaryForecastFrequencyEnum;
|
|
15
|
+
isTaxFree: boolean;
|
|
16
|
+
incomeSource: IncomeSource;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Address as AddressBase } from '../../db/Models/address';
|
|
2
|
+
import { Country } from './country';
|
|
3
|
+
import { AddressTypeEnum } from '../../db/Enums/address-type.enum';
|
|
4
|
+
import { Type } from 'class-transformer';
|
|
5
|
+
|
|
6
|
+
export class Address extends AddressBase {
|
|
7
|
+
@Type((() => Country))
|
|
8
|
+
country: Country;
|
|
9
|
+
|
|
10
|
+
suggestion: string;
|
|
11
|
+
type: AddressTypeEnum = AddressTypeEnum.STREET;
|
|
12
|
+
|
|
13
|
+
toString(): string {
|
|
14
|
+
return [this.unitNumber, this.address, this.city, this.state, this.postcode].filter(Boolean).join(', ');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get name(): string {
|
|
18
|
+
return `${this.unitNumber ? this.unitNumber + '/' : ''}${this.address}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get nameLong(): string {
|
|
22
|
+
return `${this.name}, ${this.city}, ${this.state}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Country as CountryBase } from '../../db/Models/country';
|
|
2
|
+
|
|
3
|
+
export class Country extends CountryBase {
|
|
4
|
+
/**
|
|
5
|
+
* Return country name with phone code
|
|
6
|
+
*/
|
|
7
|
+
get countryWithCode(): string {
|
|
8
|
+
return `${this.name} (+${this.callingCode})`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Check if country calling code is Australian or not
|
|
13
|
+
*/
|
|
14
|
+
isAustralianCode(): boolean {
|
|
15
|
+
return this.callingCode === '61';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BankAccount } from './bank-account';
|
|
2
|
+
import { IChartData } from '../../interfaces/chart-data.interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* bank account collection UI class with frontend specific data
|
|
6
|
+
*/
|
|
7
|
+
export class BankAccountChartData {
|
|
8
|
+
private bankAccounts: BankAccount[];
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
bankAccounts: BankAccount[]
|
|
12
|
+
) {
|
|
13
|
+
this.bankAccounts = bankAccounts;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* set value of pie chart data
|
|
18
|
+
*/
|
|
19
|
+
getBalancePieChartData(): IChartData[] {
|
|
20
|
+
return this.bankAccounts.map((bankAccount: BankAccount) => {
|
|
21
|
+
return {
|
|
22
|
+
name: bankAccount.accountName,
|
|
23
|
+
data: Math.abs(bankAccount.currentBalance)
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* set value of bar chart data
|
|
30
|
+
*/
|
|
31
|
+
getBalanceBarChartData(): IChartData[] {
|
|
32
|
+
return [{
|
|
33
|
+
name: 'Balance',
|
|
34
|
+
data: this.bankAccounts.map((bankAccount: BankAccount) => {
|
|
35
|
+
return {
|
|
36
|
+
label: bankAccount.accountName,
|
|
37
|
+
value: bankAccount.currentBalance
|
|
38
|
+
};
|
|
39
|
+
})
|
|
40
|
+
}];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BankAccountProperty as BankAccountPropertyBase } from '../../db/Models/bank-account-property';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import { Property } from '../property/property';
|
|
4
|
+
|
|
5
|
+
export class BankAccountProperty extends BankAccountPropertyBase {
|
|
6
|
+
@Type(() => Property)
|
|
7
|
+
property: Property;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BankAccountTypeEnum } from '../../db/Enums/bank-account-type.enum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Const which contains array of bank account types
|
|
5
|
+
*/
|
|
6
|
+
export const BANK_ACCOUNT_TYPES: {key: number, value: string}[] = [
|
|
7
|
+
{key: BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts'},
|
|
8
|
+
{key: BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts'},
|
|
9
|
+
{key: BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts'},
|
|
10
|
+
{key: BankAccountTypeEnum.LOAN, value: 'Loan Accounts'},
|
|
11
|
+
{key: BankAccountTypeEnum.MORTGAGE, value: 'Mortgage Accounts'},
|
|
12
|
+
{key: BankAccountTypeEnum.OFFSET, value: 'Offset'},
|
|
13
|
+
{key: BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts'},
|
|
14
|
+
{key: BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts'},
|
|
15
|
+
];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BankAccount as BankAccountBase } from '../../db/Models/bank-account';
|
|
2
|
+
import { BankAccountTypeEnum } from '../../db/Enums/bank-account-type.enum';
|
|
3
|
+
import { BankAccountStatusEnum } from '../../db/Enums/bank-account-status.enum';
|
|
4
|
+
import { Loan } from '../loan/loan';
|
|
5
|
+
import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
|
|
6
|
+
import { BankAccountBalance } from '../../db/Models/bank-account-balance';
|
|
7
|
+
import { FinancialYear } from '../financial-year/financial-year';
|
|
8
|
+
import { BankAccountProperty } from './bank-account-property';
|
|
9
|
+
import { BankConnection } from './bank-connection';
|
|
10
|
+
import { Type } from 'class-transformer';
|
|
11
|
+
|
|
12
|
+
export class BankAccount extends BankAccountBase {
|
|
13
|
+
// list of properties related with this bank account
|
|
14
|
+
@Type(() => BankAccountProperty)
|
|
15
|
+
bankAccountProperties: BankAccountProperty[];
|
|
16
|
+
|
|
17
|
+
@Type(() => BankAccountBalance)
|
|
18
|
+
balances: BankAccountBalance[];
|
|
19
|
+
|
|
20
|
+
// bank account's loan
|
|
21
|
+
@Type(() => Loan)
|
|
22
|
+
loan: Loan;
|
|
23
|
+
|
|
24
|
+
@Type(() => BankConnection)
|
|
25
|
+
bankConnection: BankConnection;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get current opening balance amount
|
|
29
|
+
*/
|
|
30
|
+
getOpeningBalance(): number {
|
|
31
|
+
return this.getCurrentYearBalance()?.openingBalance || 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get bank account balance for current financial year
|
|
36
|
+
*/
|
|
37
|
+
getCurrentYearBalance(): BankAccountBalance {
|
|
38
|
+
const currentFinYear: number = new FinancialYear().year;
|
|
39
|
+
return this.balances.find((balance: BankAccountBalance): boolean => balance.financialYear === currentFinYear);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* check if bank account type is one of savings accounts
|
|
44
|
+
*/
|
|
45
|
+
isSavingsAccount(): boolean {
|
|
46
|
+
return this.type === BankAccountTypeEnum.INVESTMENT ||
|
|
47
|
+
this.type === BankAccountTypeEnum.TERM_DEPOSIT ||
|
|
48
|
+
this.type === BankAccountTypeEnum.SAVINGS;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* check if bank account type is Loan
|
|
53
|
+
* @TODO nicole check
|
|
54
|
+
*/
|
|
55
|
+
isLoan(): boolean {
|
|
56
|
+
return [BankAccountTypeEnum.MORTGAGE, BankAccountTypeEnum.LOAN].includes(this.type);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* check if bank account type is Credit card
|
|
61
|
+
*/
|
|
62
|
+
isCreditCard(): boolean {
|
|
63
|
+
return this.type === BankAccountTypeEnum.CREDIT_CARD;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* check if bank account related to work tank
|
|
68
|
+
*/
|
|
69
|
+
isWorkTank(): boolean {
|
|
70
|
+
return this.tankType === TankTypeEnum.WORK;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* check if bank account related to work tank
|
|
75
|
+
*/
|
|
76
|
+
isPropertyTank(): boolean {
|
|
77
|
+
return this.tankType === TankTypeEnum.PROPERTY;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get Bank account property by id
|
|
82
|
+
* @param id Id of property
|
|
83
|
+
*/
|
|
84
|
+
getPropertyById(id: number): BankAccountProperty {
|
|
85
|
+
return this.bankAccountProperties.find((bankAccountProperty: BankAccountProperty): boolean => bankAccountProperty.property.id === id);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* check if bank account is related with passed property by id
|
|
90
|
+
* @param propertyId Property id for checking
|
|
91
|
+
*/
|
|
92
|
+
hasProperty(propertyId: number): boolean {
|
|
93
|
+
return !!this.getPropertyById(propertyId);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get decimal percentage for property
|
|
98
|
+
* @param propertyId Id of property
|
|
99
|
+
*/
|
|
100
|
+
getPropertyPercentage(propertyId: number): number {
|
|
101
|
+
if (!this.hasProperty(propertyId)) {
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return this.getPropertyById(propertyId).percent / 100;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get balance amount for property by id
|
|
110
|
+
* @param propertyId Id of property
|
|
111
|
+
*/
|
|
112
|
+
getPropertyBalanceAmount(propertyId: number): number {
|
|
113
|
+
return this.currentBalance * this.getPropertyPercentage(propertyId);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Check if bank account is active (has 'active' status or hasn't been paid out/refinanced)
|
|
118
|
+
*/
|
|
119
|
+
isActive(): boolean {
|
|
120
|
+
return this.status === BankAccountStatusEnum.ACTIVE;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* first import (transactions) of basiq accounts
|
|
125
|
+
*/
|
|
126
|
+
isFirstImport(): boolean {
|
|
127
|
+
return !this.lastTransactionDate && !this.isManual;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Check if passed user id is owner of bank account
|
|
132
|
+
*/
|
|
133
|
+
isOwner(userId: number): boolean {
|
|
134
|
+
return this.bankConnection.user.id === userId;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BankConnection as BankConnectionBase } from '../../db/Models/bank-connection';
|
|
2
|
+
import { BasiqJob } from './basiq-job';
|
|
3
|
+
import { Bank } from './bank';
|
|
4
|
+
import { Type } from 'class-transformer';
|
|
5
|
+
|
|
6
|
+
export class BankConnection extends BankConnectionBase {
|
|
7
|
+
@Type(() => BasiqJob)
|
|
8
|
+
basiqJob: BasiqJob;
|
|
9
|
+
|
|
10
|
+
@Type(() => Bank)
|
|
11
|
+
bank: Bank;
|
|
12
|
+
}
|