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,166 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Loan as LoanBase } from '../../db/Models/loan';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { replace } from '../../functions/array';
|
|
6
|
+
import { HttpClient } from '@angular/common/http';
|
|
7
|
+
import { BaseRestService } from '../base-rest.service';
|
|
8
|
+
import { plainToClass } from 'class-transformer';
|
|
9
|
+
import { Loan } from '../../models/loan/loan';
|
|
10
|
+
import { EventDispatcherService } from '../event/event-dispatcher.service';
|
|
11
|
+
import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
|
|
12
|
+
import { BankAccount } from '../../models/bank/bank-account';
|
|
13
|
+
import { AppEvent } from '../../models/event/app-event';
|
|
14
|
+
import { LoanPayout } from '../../models/loan/loan-payout';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Service that handling loans logic
|
|
18
|
+
*/
|
|
19
|
+
@Injectable({
|
|
20
|
+
providedIn: 'root'
|
|
21
|
+
})
|
|
22
|
+
export class LoanService extends BaseRestService<LoanBase, Loan> {
|
|
23
|
+
url: string = 'bank-accounts/loans';
|
|
24
|
+
modelClass: typeof Loan = Loan;
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
protected http: HttpClient,
|
|
28
|
+
protected eventDispatcherService: EventDispatcherService,
|
|
29
|
+
@Inject('environment') protected environment: any
|
|
30
|
+
) {
|
|
31
|
+
super(http, eventDispatcherService, environment);
|
|
32
|
+
this.listenEvents();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Listen to Loans events
|
|
37
|
+
*/
|
|
38
|
+
listenEvents(): void {
|
|
39
|
+
this.listenToAddedLoans();
|
|
40
|
+
this.listenToUpdatedBankAccounts();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
listenToAddedLoans(): void {
|
|
44
|
+
this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_CREATED)
|
|
45
|
+
.subscribe((bankAccounts: BankAccount[]) => {
|
|
46
|
+
// fetch loans when loan bank account created
|
|
47
|
+
if (bankAccounts.find(ba => !!ba.loan)) {
|
|
48
|
+
this.resetCache();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
listenToUpdatedBankAccounts(): void {
|
|
54
|
+
this.eventDispatcherService.on(AppEventTypeEnum.BANK_ACCOUNT_UPDATED)
|
|
55
|
+
.subscribe((updatedBankAccount: BankAccount): void => {
|
|
56
|
+
if (!!updatedBankAccount.loan) {
|
|
57
|
+
this.resetCache();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create Loan
|
|
64
|
+
*/
|
|
65
|
+
add(model: Loan): Observable<Loan> {
|
|
66
|
+
return this.addBatch([model])
|
|
67
|
+
.pipe(
|
|
68
|
+
map((newLoan: Loan[]): Loan => {
|
|
69
|
+
return newLoan[0];
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Updated loan
|
|
76
|
+
* @param loan
|
|
77
|
+
*/
|
|
78
|
+
update(loan: Loan): Observable<Loan> {
|
|
79
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}/${loan.id}`, loan)
|
|
80
|
+
.pipe(
|
|
81
|
+
map((updatedLoanBase: LoanBase) => {
|
|
82
|
+
const updatedLoan: Loan = plainToClass(Loan, updatedLoanBase);
|
|
83
|
+
// if loan type is NOT vehicle - fire EventDispatcher event
|
|
84
|
+
if (!updatedLoan.isVehicle()) {
|
|
85
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_UPDATED, null));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
replace(this.cache, updatedLoan);
|
|
89
|
+
this.updateCache();
|
|
90
|
+
return updatedLoan;
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get list of vehicle loans
|
|
97
|
+
*/
|
|
98
|
+
getVehicleLoans(): Observable<Loan[]> {
|
|
99
|
+
return this.get()
|
|
100
|
+
.pipe(
|
|
101
|
+
map((loans: Loan[]) => {
|
|
102
|
+
return loans.filter((loan: Loan) => loan.isVehicle());
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Calculate loan payments
|
|
109
|
+
* @param loan
|
|
110
|
+
*/
|
|
111
|
+
calculateLoanPayments(loan: Loan): Observable<any> {
|
|
112
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/calculation`, loan).pipe(
|
|
113
|
+
map((response: any) => {
|
|
114
|
+
return plainToClass(Loan, response);
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Add new loan payout
|
|
121
|
+
* @param loan
|
|
122
|
+
* @param paidOutLoan
|
|
123
|
+
*/
|
|
124
|
+
addPayoutLoan(loan: Loan, paidOutLoan: LoanPayout): Observable<any> {
|
|
125
|
+
return this.http.post(`${this.environment.apiV2}/loans/${loan.id}/payout`, paidOutLoan).pipe(
|
|
126
|
+
map((response: any) => {
|
|
127
|
+
loan.payout = plainToClass(LoanPayout, response);
|
|
128
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
|
|
129
|
+
// reset cache to fetch loans with updated data
|
|
130
|
+
this.resetCache();
|
|
131
|
+
}
|
|
132
|
+
));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Delete loan payout
|
|
137
|
+
* @param loan
|
|
138
|
+
* @param payout
|
|
139
|
+
*/
|
|
140
|
+
deletePayoutLoan(loan: Loan, payout: LoanPayout): Observable<any> {
|
|
141
|
+
return this.http.delete(`${this.environment.apiV2}/loans/${loan.id}/payout/${payout.id}`).pipe(
|
|
142
|
+
map(() => {
|
|
143
|
+
loan.payout = null;
|
|
144
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
|
|
145
|
+
// reset cache to fetch loans with updated data
|
|
146
|
+
this.resetCache();
|
|
147
|
+
}
|
|
148
|
+
));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Update loan payout
|
|
153
|
+
* @param loan
|
|
154
|
+
* @param paidOutLoan
|
|
155
|
+
*/
|
|
156
|
+
updatePayoutLoan(loan: Loan, paidOutLoan: LoanPayout): Observable<any> {
|
|
157
|
+
return this.http.put(`${this.environment.apiV2}/loans/${loan.id}/payout/${paidOutLoan.id}`, paidOutLoan).pipe(
|
|
158
|
+
map((response: any) => {
|
|
159
|
+
loan.payout = plainToClass(LoanPayout, response);
|
|
160
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.LOAN_PAYOUT_UPDATED, null));
|
|
161
|
+
// reset cache to fetch loans with updated data
|
|
162
|
+
this.resetCache();
|
|
163
|
+
}
|
|
164
|
+
));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NotificationService } from './notification.service';
|
|
4
|
+
|
|
5
|
+
describe('NotificationService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: NotificationService = TestBed.get(NotificationService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { ServiceNotification as NotificationBase } from '../../db/Models/service-notification';
|
|
3
|
+
import { Notification } from '../../models/notification/notification';
|
|
4
|
+
import { HttpClient } from '@angular/common/http';
|
|
5
|
+
import { IEventListener } from '../../interfaces/event-listener.interface';
|
|
6
|
+
import { replace } from '../../functions/array';
|
|
7
|
+
import { plainToClass } from 'class-transformer';
|
|
8
|
+
import { BaseRestService } from '../base-rest.service';
|
|
9
|
+
import { EventDispatcherService } from '../event/event-dispatcher.service';
|
|
10
|
+
import { SseService } from '../event/sse.service';
|
|
11
|
+
import { AppEvent } from '../../models/event/app-event';
|
|
12
|
+
import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
|
|
13
|
+
import clone from 'lodash/clone'
|
|
14
|
+
/**
|
|
15
|
+
* Service to handle service notifications logic
|
|
16
|
+
*/
|
|
17
|
+
@Injectable({
|
|
18
|
+
providedIn: 'root'
|
|
19
|
+
})
|
|
20
|
+
export class NotificationService extends BaseRestService<NotificationBase, Notification> implements IEventListener {
|
|
21
|
+
modelClass: typeof Notification = Notification;
|
|
22
|
+
url: string = 'service-notifications';
|
|
23
|
+
isHydra: boolean = true;
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
protected http: HttpClient,
|
|
27
|
+
protected eventDispatcherService: EventDispatcherService,
|
|
28
|
+
@Inject('environment') protected environment: any,
|
|
29
|
+
private sseService: SseService
|
|
30
|
+
) {
|
|
31
|
+
super(http, eventDispatcherService, environment);
|
|
32
|
+
this.listenEvents();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* SSE and Event Dispatcher Services listeners
|
|
37
|
+
*/
|
|
38
|
+
listenEvents(): void {
|
|
39
|
+
this.listenNotifications();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* subscribe to new chat messages
|
|
44
|
+
*/
|
|
45
|
+
private listenNotifications(): void {
|
|
46
|
+
this.sseService.on(`serviceNotification`).subscribe((notificationBase: NotificationBase): void => {
|
|
47
|
+
const notification: Notification = plainToClass(Notification, notificationBase);
|
|
48
|
+
const cache: Notification[] = clone(this.cache);
|
|
49
|
+
// update existing notification if read and add new notification if not read
|
|
50
|
+
if (notification.isRead) {
|
|
51
|
+
replace(cache, notification);
|
|
52
|
+
} else {
|
|
53
|
+
cache.unshift(notification);
|
|
54
|
+
}
|
|
55
|
+
this.cache = cache;
|
|
56
|
+
this.cacheSubject.next(this.cache);
|
|
57
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.NOTIFICATION_ADDED, notification));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PreloaderService } from './preloader.service';
|
|
4
|
+
|
|
5
|
+
describe('PreloaderService', () => {
|
|
6
|
+
let service: PreloaderService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(PreloaderService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
import { Endpoint } from '../../models/endpoint/endpoint';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class PreloaderService {
|
|
9
|
+
activePreloaders: BehaviorSubject<Endpoint[]> = new BehaviorSubject<Endpoint[]>([]);
|
|
10
|
+
|
|
11
|
+
constructor() { }
|
|
12
|
+
|
|
13
|
+
get(): Observable<Endpoint[]> {
|
|
14
|
+
return this.activePreloaders.asObservable();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
add(endpoint: Endpoint): void {
|
|
18
|
+
const activePreloaders: Endpoint[] = this.activePreloaders.getValue();
|
|
19
|
+
activePreloaders.push(endpoint);
|
|
20
|
+
this.activePreloaders.next(activePreloaders);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
delete(endpoint: Endpoint): void {
|
|
24
|
+
let activePreloaders: Endpoint[] = this.activePreloaders.getValue();
|
|
25
|
+
activePreloaders = activePreloaders.filter((preloader: Endpoint): boolean => preloader !== endpoint);
|
|
26
|
+
this.activePreloaders.next(activePreloaders);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { CorelogicService } from './corelogic.service';
|
|
4
|
+
|
|
5
|
+
describe('CorelogicService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: CorelogicService = TestBed.get(CorelogicService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { Observable, ReplaySubject } from 'rxjs';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { plainToClass } from 'class-transformer';
|
|
6
|
+
import { CorelogicSuggestion } from '../../models/property/corelogic-suggestion';
|
|
7
|
+
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root'
|
|
10
|
+
})
|
|
11
|
+
export class CorelogicService {
|
|
12
|
+
_accessToken: string;
|
|
13
|
+
accessTokenSubject: ReplaySubject<string> = new ReplaySubject<string>(1);
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
private http: HttpClient,
|
|
17
|
+
@Inject('environment') private environment: any
|
|
18
|
+
) {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getAccessToken(force: boolean = false): Observable<string> {
|
|
22
|
+
if (!this._accessToken || force) {
|
|
23
|
+
this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
|
|
24
|
+
.pipe(
|
|
25
|
+
map((response: any) => {
|
|
26
|
+
return response.access_token;
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
.subscribe((token: string) => {
|
|
30
|
+
this._accessToken = token;
|
|
31
|
+
this.accessTokenSubject.next(this._accessToken);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return this.accessTokenSubject.asObservable();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getSuggestions(query: string, country: string = 'au'): Observable<CorelogicSuggestion[]> {
|
|
39
|
+
// @TODO handle different countries in future
|
|
40
|
+
return this.http.get(`${this.environment.coreLogicUrl}/property/${country}/v2/suggest.json?q=${query}`)
|
|
41
|
+
.pipe(
|
|
42
|
+
map((response: any) => {
|
|
43
|
+
return response.suggestions.map((item: object) => plainToClass(CorelogicSuggestion, item));
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PropertyCalculationService } from '@services';
|
|
4
|
+
|
|
5
|
+
describe('PropertyCalculationService', () => {
|
|
6
|
+
let service: PropertyCalculationService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(PropertyCalculationService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { combineLatest, Observable } from 'rxjs';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { BankAccountCollection } from '../../collections/bank-account.collection';
|
|
5
|
+
import { DepreciationCollection } from '../../collections/depreciation.collection';
|
|
6
|
+
import { LoanCollection } from '../../collections/loan.collection';
|
|
7
|
+
import { PropertyCollection } from '../../collections/property.collection';
|
|
8
|
+
import { TransactionCollection } from '../../collections/transaction.collection';
|
|
9
|
+
import { Property } from '../../models/property/property';
|
|
10
|
+
import { BankAccount } from '../../models/bank/bank-account';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Service with calculations methods for properties related with other entities.
|
|
14
|
+
* Logic here works like collections methods but for several entities
|
|
15
|
+
*/
|
|
16
|
+
@Injectable({
|
|
17
|
+
providedIn: 'root'
|
|
18
|
+
})
|
|
19
|
+
export class PropertyCalculationService {
|
|
20
|
+
getTaxPosition(transactions: TransactionCollection, depreciations: DepreciationCollection): number {
|
|
21
|
+
// @TODO hack: math abs added because we have mismatching of real values signs
|
|
22
|
+
return transactions.cashPosition - Math.abs(depreciations.claimAmount);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getTaxPosition$(
|
|
26
|
+
transactions$: Observable<TransactionCollection>,
|
|
27
|
+
depreciations$: Observable<DepreciationCollection>
|
|
28
|
+
): Observable<number> {
|
|
29
|
+
return combineLatest([
|
|
30
|
+
transactions$,
|
|
31
|
+
depreciations$
|
|
32
|
+
]).pipe(
|
|
33
|
+
map(([transactions, depreciations]: [TransactionCollection, DepreciationCollection]): number => {
|
|
34
|
+
return this.getTaxPosition(transactions, depreciations);
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
taxPositionGrowth(properties: PropertyCollection, transactions: TransactionCollection, depreciations: DepreciationCollection): number {
|
|
40
|
+
const taxPosition: number = this.getTaxPosition(transactions, depreciations);
|
|
41
|
+
// check if taxPosition = 0 to avoid division by zero
|
|
42
|
+
if (!taxPosition) {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (taxPosition - properties.forecastedTaxPosition) / taxPosition;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
taxPositionGrowth$(
|
|
50
|
+
properties$: Observable<PropertyCollection>,
|
|
51
|
+
transactions$: Observable<TransactionCollection>,
|
|
52
|
+
depreciations$: Observable<DepreciationCollection>
|
|
53
|
+
): Observable<number> {
|
|
54
|
+
return combineLatest([
|
|
55
|
+
properties$,
|
|
56
|
+
transactions$,
|
|
57
|
+
depreciations$
|
|
58
|
+
]).pipe(
|
|
59
|
+
map(([properties, transactions, depreciations]: [PropertyCollection, TransactionCollection, DepreciationCollection]): number => {
|
|
60
|
+
return this.taxPositionGrowth(properties, transactions, depreciations);
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getRentalReturn(properties: PropertyCollection, transactions: TransactionCollection): number {
|
|
66
|
+
return transactions.claimIncome / properties.marketValue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getLoanAmount(properties: PropertyCollection, bankAccounts: BankAccountCollection, loans: LoanCollection): number {
|
|
70
|
+
return properties.items.reduce((totalAmount: number, property: Property): number => {
|
|
71
|
+
return totalAmount + bankAccounts.items
|
|
72
|
+
.reduce((propertyAmount: number, bankAccount: BankAccount): number => {
|
|
73
|
+
return propertyAmount + bankAccount.getPropertyPercentage(property.id) * (loans.getByBankAccountId(bankAccount.id)?.amount || 0);
|
|
74
|
+
}, 0);
|
|
75
|
+
}, 0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getLoanValue(properties: PropertyCollection, bankAccounts: BankAccountCollection): number {
|
|
79
|
+
return properties.items.reduce((totalAmount: number, property: Property): number => {
|
|
80
|
+
return totalAmount + bankAccounts.items
|
|
81
|
+
.reduce((propertyAmount: number, bankAccount: BankAccount): number => {
|
|
82
|
+
return propertyAmount + bankAccount.getPropertyBalanceAmount(property.id);
|
|
83
|
+
}, 0);
|
|
84
|
+
}, 0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* LVR
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
getLvr(properties: PropertyCollection, bankAccounts: BankAccountCollection): number {
|
|
92
|
+
// Math abs is required for correct percentage calculation
|
|
93
|
+
return Math.abs(this.getLoanValue(properties, bankAccounts)) / properties.marketValue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getLvr$(
|
|
97
|
+
properties$: Observable<PropertyCollection>,
|
|
98
|
+
bankAccounts$: Observable<BankAccountCollection>
|
|
99
|
+
): Observable<number> {
|
|
100
|
+
return combineLatest([
|
|
101
|
+
properties$,
|
|
102
|
+
bankAccounts$
|
|
103
|
+
]).pipe(
|
|
104
|
+
map(([properties, bankAccounts]: [PropertyCollection, BankAccountCollection]): number => {
|
|
105
|
+
return this.getLvr(properties, bankAccounts);
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getLvrCommencement(properties: PropertyCollection, loans: LoanCollection, bankAccounts: BankAccountCollection): number {
|
|
111
|
+
// Math abs is required for correct percentage calculation
|
|
112
|
+
return Math.abs(this.getLoanAmount(properties, bankAccounts, loans)) / properties.purchasePrice;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
getLvrCommencement$(
|
|
116
|
+
properties$: Observable<PropertyCollection>,
|
|
117
|
+
bankAccounts$: Observable<BankAccountCollection>,
|
|
118
|
+
loans$: Observable<LoanCollection>
|
|
119
|
+
): Observable<number> {
|
|
120
|
+
return combineLatest([
|
|
121
|
+
properties$,
|
|
122
|
+
bankAccounts$,
|
|
123
|
+
loans$
|
|
124
|
+
]).pipe(
|
|
125
|
+
map(([properties, bankAccounts, loans]: [PropertyCollection, BankAccountCollection, LoanCollection]): number => {
|
|
126
|
+
return this.getLvrCommencement(properties, loans, bankAccounts);
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getLvrGrowth(properties: PropertyCollection, bankAccounts: BankAccountCollection, loans: LoanCollection): number {
|
|
132
|
+
const lvr: number = this.getLvr(properties, bankAccounts);
|
|
133
|
+
if (!lvr) {
|
|
134
|
+
// check if lvr = 0 to avoid division by zero
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (lvr - this.getLvrCommencement(properties, loans, bankAccounts)) / lvr;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getLvrGrowth$(
|
|
142
|
+
properties$: Observable<PropertyCollection>,
|
|
143
|
+
bankAccounts$: Observable<BankAccountCollection>,
|
|
144
|
+
loans$: Observable<LoanCollection>
|
|
145
|
+
): Observable<number> {
|
|
146
|
+
return combineLatest([
|
|
147
|
+
properties$,
|
|
148
|
+
bankAccounts$,
|
|
149
|
+
loans$
|
|
150
|
+
]).pipe(
|
|
151
|
+
map(([properties, bankAccounts, loans]: [PropertyCollection, BankAccountCollection, LoanCollection]): number => {
|
|
152
|
+
return this.getLvrGrowth(properties, bankAccounts, loans);
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
getEquityPosition(properties: PropertyCollection, bankAccounts: BankAccountCollection): number {
|
|
158
|
+
// Math abs is required for correct percentage calculation
|
|
159
|
+
return properties.marketValue - Math.abs(this.getLoanValue(properties, bankAccounts));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
getPurchaseEquity(properties: PropertyCollection, bankAccounts: BankAccountCollection, loans: LoanCollection): number {
|
|
163
|
+
// Math abs is required for correct percentage calculation
|
|
164
|
+
return properties.purchasePrice - Math.abs(this.getLoanAmount(properties, bankAccounts, loans));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { PropertyCapitalCost as PropertyCapitalCostBase } from '../../db/Models/property-capital-cost';
|
|
5
|
+
import { plainToClass } from 'class-transformer';
|
|
6
|
+
import { BaseRestService } from '../base-rest.service';
|
|
7
|
+
import { PropertyCapitalCost } from '../../models/property/property-capital-cost';
|
|
8
|
+
import { Property } from '../../models/property/property';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Service to work with capital costs
|
|
12
|
+
*/
|
|
13
|
+
@Injectable({
|
|
14
|
+
providedIn: 'root'
|
|
15
|
+
})
|
|
16
|
+
export class PropertyCapitalCostService extends BaseRestService<PropertyCapitalCostBase, PropertyCapitalCost> {
|
|
17
|
+
url: string = 'capital-costs';
|
|
18
|
+
modelClass: typeof PropertyCapitalCost = PropertyCapitalCost;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get property capital costs
|
|
22
|
+
* @param property which params will be taken for list of property capital costs
|
|
23
|
+
*/
|
|
24
|
+
getByProperty(property: Property): Observable<PropertyCapitalCost[]> {
|
|
25
|
+
// get list of capital costs items
|
|
26
|
+
return this.get()
|
|
27
|
+
.pipe(
|
|
28
|
+
map((capitalCosts: PropertyCapitalCost[]) => {
|
|
29
|
+
// property capital costs array
|
|
30
|
+
return capitalCosts.map((capitalCost: PropertyCapitalCost) => {
|
|
31
|
+
// return new Property capital cost object with capital cost and amount
|
|
32
|
+
return plainToClass(PropertyCapitalCost, {
|
|
33
|
+
capitalCost,
|
|
34
|
+
amount: property.capitalCosts.find((existingCapitalCost: PropertyCapitalCost): boolean => {
|
|
35
|
+
return existingCapitalCost.capitalCost.id === capitalCost.id;
|
|
36
|
+
})?.amount || null
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PropertyCategoryService } from './property-category.service';
|
|
4
|
+
|
|
5
|
+
describe('PropertyCategoryService', () => {
|
|
6
|
+
let service: PropertyCategoryService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(PropertyCategoryService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { PropertyCategory as PropertyCategoryBase } from '../../db/Models/property-category';
|
|
3
|
+
import { BaseRestService } from '../base-rest.service';
|
|
4
|
+
import { PropertyCategory } from '../../models/property/property-category';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Service for work with Property Categories
|
|
8
|
+
*/
|
|
9
|
+
@Injectable({
|
|
10
|
+
providedIn: 'root'
|
|
11
|
+
})
|
|
12
|
+
export class PropertyCategoryService extends BaseRestService<PropertyCategoryBase, PropertyCategory>{
|
|
13
|
+
modelClass: typeof PropertyCategory = PropertyCategory;
|
|
14
|
+
url: string = 'properties/categories';
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PropertyDocumentService } from './property-document.service';
|
|
4
|
+
|
|
5
|
+
describe('PropertyDocumentService', () => {
|
|
6
|
+
let service: PropertyDocumentService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(PropertyDocumentService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|