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,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { FirmService } from './firm.service';
|
|
4
|
+
|
|
5
|
+
describe('FirmService', () => {
|
|
6
|
+
let service: FirmService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(FirmService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
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 { FirmTypeEnum } from '../../db/Enums/firm-type.enum';
|
|
6
|
+
import { plainToClass } from 'class-transformer';
|
|
7
|
+
import { Firm, Firm as FirmBase } from '../../db/Models/firm';
|
|
8
|
+
|
|
9
|
+
// @TODO Alex: think about extend base rest service
|
|
10
|
+
@Injectable({
|
|
11
|
+
providedIn: 'root'
|
|
12
|
+
})
|
|
13
|
+
export class FirmService {
|
|
14
|
+
firm: Firm;
|
|
15
|
+
firmSubject: ReplaySubject<Firm> = new ReplaySubject<Firm>(1);
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private http: HttpClient,
|
|
19
|
+
@Inject('environment') protected environment: any
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Register new firm
|
|
24
|
+
* @param data: firm and firm owner data to register
|
|
25
|
+
*/
|
|
26
|
+
register(data: Firm): Observable<Firm> {
|
|
27
|
+
return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
|
|
28
|
+
.pipe(
|
|
29
|
+
map((firm: FirmBase): Firm => {
|
|
30
|
+
return plainToClass(Firm, firm);
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get(): Observable<Firm> {
|
|
36
|
+
if (!this.firm) {
|
|
37
|
+
this.http.get(`${this.environment.apiV2}/firms/current`)
|
|
38
|
+
.pipe(
|
|
39
|
+
map((firm: FirmBase): Firm => {
|
|
40
|
+
return plainToClass(Firm, firm);
|
|
41
|
+
})
|
|
42
|
+
)
|
|
43
|
+
.subscribe((firm: Firm): void => {
|
|
44
|
+
this.firm = firm;
|
|
45
|
+
this.firmSubject.next(this.firm);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this.firmSubject.asObservable();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
update(firm: Firm): Observable<void> {
|
|
53
|
+
return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
|
|
54
|
+
.pipe(
|
|
55
|
+
map((updatedItem: FirmBase) => {
|
|
56
|
+
const updatedInstance: Firm = plainToClass(Firm, updatedItem);
|
|
57
|
+
this.firmSubject.next(updatedInstance);
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* get list of all registered firms
|
|
64
|
+
*/
|
|
65
|
+
getAll(): Observable<Firm[]> {
|
|
66
|
+
return this.http.get(`${this.environment.apiV2}/firms`)
|
|
67
|
+
.pipe(
|
|
68
|
+
map((response: object): Firm[] => {
|
|
69
|
+
return response['hydra:member'].map((firmBase: FirmBase): Firm => plainToClass(Firm, firmBase));
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getByType(type: FirmTypeEnum): Observable<Firm[]> {
|
|
75
|
+
return this.getAll().pipe(
|
|
76
|
+
map((firms: Firm[]): Firm[] => {
|
|
77
|
+
return firms.filter((firm: Firm) => firm.type === type);
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
updatePhoto(firm: Firm, photo: FormData): Observable<Firm> {
|
|
83
|
+
return this.http.post(`${this.environment.apiV2}/firms/photo?_method=PUT`, photo)
|
|
84
|
+
.pipe(
|
|
85
|
+
map((firmPhoto: string) => {
|
|
86
|
+
this.firm = plainToClass(Firm, Object.assign(firm, {photo: firmPhoto}));
|
|
87
|
+
this.firmSubject.next(this.firm);
|
|
88
|
+
|
|
89
|
+
return firm;
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { HeaderTitleService } from './header-title.service';
|
|
4
|
+
|
|
5
|
+
describe('TitleServiceService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: HeaderTitleService = TestBed.get(HeaderTitleService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { filter, map, mergeMap } from 'rxjs/operators';
|
|
5
|
+
|
|
6
|
+
@Injectable({
|
|
7
|
+
providedIn: 'root'
|
|
8
|
+
})
|
|
9
|
+
export class HeaderTitleService {
|
|
10
|
+
|
|
11
|
+
constructor(
|
|
12
|
+
private router: Router,
|
|
13
|
+
private activatedRoute: ActivatedRoute,
|
|
14
|
+
) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
handleTitle(): Observable<any> {
|
|
18
|
+
return this.router.events.pipe(
|
|
19
|
+
filter((event: any) => event instanceof NavigationEnd),
|
|
20
|
+
map(() => this.activatedRoute),
|
|
21
|
+
map((route: any) => {
|
|
22
|
+
while (route.firstChild) {
|
|
23
|
+
route = route.firstChild;
|
|
24
|
+
}
|
|
25
|
+
return route;
|
|
26
|
+
}),
|
|
27
|
+
filter((route: any) => route.outlet === 'primary'),
|
|
28
|
+
mergeMap((route: any) => route.data)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { IncomeSourceForecastService } from './income-source-forecast.service';
|
|
4
|
+
|
|
5
|
+
describe('IncomeSourceForecastService', () => {
|
|
6
|
+
let service: IncomeSourceForecastService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(IncomeSourceForecastService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { IncomeSourceForecast as IncomeSourceForecastBase } from '../../db/Models/income-source-forecast';
|
|
5
|
+
import { plainToClass } from 'class-transformer';
|
|
6
|
+
import { BaseRestService } from '../base-rest.service';
|
|
7
|
+
import { IncomeSourceForecast } from '../../models/income-source/income-source-forecast';
|
|
8
|
+
import { EventDispatcherService } from '../event/event-dispatcher.service';
|
|
9
|
+
import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
|
|
10
|
+
import { IncomeSource } from '../../models/income-source/income-source';
|
|
11
|
+
import { AppEvent } from '../../models/event/app-event';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Service to work with Other Income Forecasts
|
|
15
|
+
*/
|
|
16
|
+
@Injectable({
|
|
17
|
+
providedIn: 'root'
|
|
18
|
+
})
|
|
19
|
+
export class IncomeSourceForecastService extends BaseRestService<IncomeSourceForecastBase, IncomeSourceForecast> {
|
|
20
|
+
modelClass: typeof IncomeSourceForecast = IncomeSourceForecast;
|
|
21
|
+
url: string = 'income-source-forecasts';
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
protected http: HttpClient,
|
|
25
|
+
protected eventDispatcherService: EventDispatcherService,
|
|
26
|
+
@Inject('environment') protected environment: any
|
|
27
|
+
) {
|
|
28
|
+
super(http, eventDispatcherService, environment);
|
|
29
|
+
this.listenEvents();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Listen to Income Sources events
|
|
34
|
+
*/
|
|
35
|
+
listenEvents(): void {
|
|
36
|
+
this.listenToAddedIncomeSources();
|
|
37
|
+
this.listenToUpdatedIncomeSources();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Listen to EventDispatcherService event related to added Income Sources
|
|
42
|
+
*/
|
|
43
|
+
private listenToAddedIncomeSources(): void {
|
|
44
|
+
this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
|
|
45
|
+
.pipe(
|
|
46
|
+
map((incomeSources: IncomeSource[]) => incomeSources
|
|
47
|
+
.filter((incomeSource: IncomeSource) => !incomeSource.isSalaryIncome()))
|
|
48
|
+
)
|
|
49
|
+
.subscribe((incomeSources: IncomeSource[]) => {
|
|
50
|
+
|
|
51
|
+
const incomeSourceForecasts: IncomeSourceForecast[] = this.assignIncomeSourceForecasts(incomeSources);
|
|
52
|
+
if (incomeSourceForecasts.length) {
|
|
53
|
+
this.addBatch(incomeSourceForecasts).subscribe((createdIncomeSourceForecasts: IncomeSourceForecast[]) => {
|
|
54
|
+
this.eventDispatcherService
|
|
55
|
+
.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdIncomeSourceForecasts));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Listen to EventDispatcherService event related to updated Income Sources
|
|
63
|
+
*/
|
|
64
|
+
private listenToUpdatedIncomeSources(): void {
|
|
65
|
+
this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
|
|
66
|
+
.subscribe((incomeSources: IncomeSource[]) => {
|
|
67
|
+
const incomeSourceForecasts: IncomeSourceForecast[] = this.assignIncomeSourceForecasts(incomeSources);
|
|
68
|
+
if (incomeSourceForecasts.length) {
|
|
69
|
+
this.updateBatch(incomeSourceForecasts).subscribe((updatedIncomeSourceForecasts: IncomeSourceForecast[]) => {
|
|
70
|
+
this.eventDispatcherService
|
|
71
|
+
.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedIncomeSourceForecasts));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Assign other income forecasts based on provided income sources
|
|
79
|
+
* @param incomeSources by which other income forecasts will be assigned
|
|
80
|
+
*/
|
|
81
|
+
private assignIncomeSourceForecasts(incomeSources: IncomeSource[]): IncomeSourceForecast[] {
|
|
82
|
+
return incomeSources.map((incomeSource: IncomeSource) => {
|
|
83
|
+
incomeSource.incomeSourceForecasts = incomeSource.incomeSourceForecasts
|
|
84
|
+
.map((incomeSourceForecast: IncomeSourceForecast) => {
|
|
85
|
+
incomeSourceForecast.incomeSource = plainToClass(IncomeSource, {id: incomeSource.id});
|
|
86
|
+
return incomeSourceForecast;
|
|
87
|
+
});
|
|
88
|
+
return incomeSource.incomeSourceForecasts;
|
|
89
|
+
}).flat();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { IncomeSourceService } from './income-source.service';
|
|
4
|
+
|
|
5
|
+
describe('IncomeService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: IncomeSourceService = TestBed.get(IncomeSourceService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { Observable, ReplaySubject } from 'rxjs';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { HttpClient } from '@angular/common/http';
|
|
5
|
+
import { IncomeSource as IncomeSourceBase } from '../../db/Models/income-source';
|
|
6
|
+
import { BaseRestService } from '../base-rest.service';
|
|
7
|
+
import { IncomeSourceType } from '../../models/income-source/income-source-type';
|
|
8
|
+
import { SalaryForecast } from '../../models/income-source/salary-forecast';
|
|
9
|
+
import { replace } from '../../functions/array';
|
|
10
|
+
import { IncomeSourceTypeEnum } from '../../db/Enums/income-source-type.enum';
|
|
11
|
+
import { plainToClass } from 'class-transformer';
|
|
12
|
+
import { EventDispatcherService } from '../event/event-dispatcher.service';
|
|
13
|
+
import { IncomeSource } from '../../models/income-source/income-source';
|
|
14
|
+
import { AppEvent } from '../../models/event/app-event';
|
|
15
|
+
import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Service to work with income sources
|
|
19
|
+
*/
|
|
20
|
+
@Injectable({
|
|
21
|
+
providedIn: 'root'
|
|
22
|
+
})
|
|
23
|
+
export class IncomeSourceService extends BaseRestService<IncomeSourceBase, IncomeSource> {
|
|
24
|
+
url: string = 'income-sources';
|
|
25
|
+
modelClass = IncomeSource;
|
|
26
|
+
incomeSourceTypes: IncomeSourceType[];
|
|
27
|
+
incomeSourceTypeSubject: ReplaySubject<IncomeSourceType[]> = new ReplaySubject<IncomeSourceType[]>(1);
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
protected http: HttpClient,
|
|
31
|
+
protected eventDispatcherService: EventDispatcherService,
|
|
32
|
+
@Inject('environment') protected environment: any
|
|
33
|
+
) {
|
|
34
|
+
super(http, eventDispatcherService, environment);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get income sources tax calculation
|
|
39
|
+
* @param salaryForecast for which tax should be calculated
|
|
40
|
+
*/
|
|
41
|
+
getTaxCalculation(salaryForecast: SalaryForecast): Observable<SalaryForecast> {
|
|
42
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}/tax-calculation`, salaryForecast)
|
|
43
|
+
.pipe(
|
|
44
|
+
map((response: any) => {
|
|
45
|
+
return plainToClass(SalaryForecast, response);
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Add batch of income sources
|
|
52
|
+
* @param incomeSources to add
|
|
53
|
+
*/
|
|
54
|
+
addBatch(incomeSources: IncomeSource[]): Observable<IncomeSource[]> {
|
|
55
|
+
return this.http.post(`${this.environment.apiV2}/${this.url}`, incomeSources)
|
|
56
|
+
.pipe(
|
|
57
|
+
map((addedIncomeSources: IncomeSourceBase[]) => {
|
|
58
|
+
// assign respond income sources to provided income sources
|
|
59
|
+
const assignedIncomeSources: IncomeSource[] = addedIncomeSources
|
|
60
|
+
.map((incomeSource: IncomeSource, index: number) => Object.assign(plainToClass(IncomeSource, {}), incomeSource, incomeSources[index]));
|
|
61
|
+
|
|
62
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_CREATED, assignedIncomeSources));
|
|
63
|
+
|
|
64
|
+
this.cache.push(...assignedIncomeSources);
|
|
65
|
+
this.updateCache();
|
|
66
|
+
return assignedIncomeSources;
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update batch of income sources
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
updateBatch(incomeSources: IncomeSource[], queryParams: object = {}): Observable<IncomeSource[]> {
|
|
76
|
+
return this.http.put(`${this.environment.apiV2}/${this.url}`, incomeSources, queryParams)
|
|
77
|
+
.pipe(
|
|
78
|
+
map((updatedItems: IncomeSource[]) => {
|
|
79
|
+
const updatedInstances: IncomeSource[] = updatedItems.map(
|
|
80
|
+
(item: IncomeSource) => this.createModelInstance(this.modelClass, item)
|
|
81
|
+
);
|
|
82
|
+
updatedInstances.forEach((instance: IncomeSource) => {
|
|
83
|
+
replace(this.cache, instance);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (incomeSources[0].forecasts.length) {
|
|
87
|
+
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_UPDATED, incomeSources));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.updateCache();
|
|
91
|
+
return updatedInstances;
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get income sources by provided types
|
|
98
|
+
* @param types
|
|
99
|
+
*/
|
|
100
|
+
getByTypes(types: IncomeSourceTypeEnum[]): Observable<IncomeSource[]> {
|
|
101
|
+
return this.get()
|
|
102
|
+
.pipe(
|
|
103
|
+
map((incomeSources: IncomeSource[]) => incomeSources
|
|
104
|
+
.filter((incomeSource: IncomeSource) => types.includes(incomeSource.type))));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get other incomes types
|
|
109
|
+
*/
|
|
110
|
+
getIncomeSourceTypes(): Observable<IncomeSourceType[]> {
|
|
111
|
+
if (!this.incomeSourceTypes) {
|
|
112
|
+
this.incomeSourceTypes = [];
|
|
113
|
+
this.http.get(`${this.environment.apiV2}/income-source-types`)
|
|
114
|
+
.pipe(
|
|
115
|
+
map((response: any) => {
|
|
116
|
+
return response.map((item: any) => plainToClass(IncomeSourceType, item));
|
|
117
|
+
})
|
|
118
|
+
)
|
|
119
|
+
.subscribe((otherIncomesTypes: IncomeSourceType[]) => {
|
|
120
|
+
this.incomeSourceTypes = otherIncomesTypes;
|
|
121
|
+
this.incomeSourceTypeSubject.next(this.incomeSourceTypes);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return this.incomeSourceTypeSubject.asObservable();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { SalaryForecastService } from './salary-forecast.service';
|
|
4
|
+
|
|
5
|
+
describe('SalaryForecastService', () => {
|
|
6
|
+
let service: SalaryForecastService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(SalaryForecastService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { SalaryForecast as SalaryForecastBase } from '../../db/Models/salary-forecast';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { plainToClass } from 'class-transformer';
|
|
6
|
+
import { BaseRestService } from '../base-rest.service';
|
|
7
|
+
import { IEventListener } from '../../interfaces/event-listener.interface';
|
|
8
|
+
import { SalaryForecast } from '../../models/income-source/salary-forecast';
|
|
9
|
+
import { EventDispatcherService } from '../event/event-dispatcher.service';
|
|
10
|
+
import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
|
|
11
|
+
import { IncomeSource } from '../../models/income-source/income-source';
|
|
12
|
+
import { AppEvent } from '../../models/event/app-event';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Service to work with Salary Forecasts
|
|
16
|
+
*/
|
|
17
|
+
@Injectable({
|
|
18
|
+
providedIn: 'root'
|
|
19
|
+
})
|
|
20
|
+
export class SalaryForecastService extends BaseRestService<SalaryForecastBase, SalaryForecast> implements IEventListener {
|
|
21
|
+
modelClass: typeof SalaryForecast = SalaryForecast;
|
|
22
|
+
url: string = 'salary-forecasts';
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
protected http: HttpClient,
|
|
26
|
+
protected eventDispatcherService: EventDispatcherService,
|
|
27
|
+
@Inject('environment') protected environment: any
|
|
28
|
+
) {
|
|
29
|
+
super(http, eventDispatcherService, environment);
|
|
30
|
+
this.listenEvents();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Listen to Income Sources events
|
|
35
|
+
*/
|
|
36
|
+
listenEvents(): void {
|
|
37
|
+
this.listenToAddedIncomeSources();
|
|
38
|
+
this.listenToUpdatedIncomeSources();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Listen to EventDispatcherService event related to added Income Sources
|
|
43
|
+
*/
|
|
44
|
+
private listenToAddedIncomeSources(): void {
|
|
45
|
+
this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_CREATED)
|
|
46
|
+
.pipe(
|
|
47
|
+
map((incomeSources: IncomeSource[]) => incomeSources
|
|
48
|
+
.filter((incomeSource: IncomeSource) => incomeSource.isSalaryIncome()))
|
|
49
|
+
)
|
|
50
|
+
.subscribe((incomeSources: IncomeSource[]) => {
|
|
51
|
+
|
|
52
|
+
const salaryForecasts: SalaryForecast[] = this.assignSalaryForecasts(incomeSources);
|
|
53
|
+
if (salaryForecasts.length) {
|
|
54
|
+
this.addBatch(salaryForecasts).subscribe((createdSalaryForecasts: SalaryForecast[]) => {
|
|
55
|
+
this.eventDispatcherService
|
|
56
|
+
.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_CREATED, createdSalaryForecasts));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Listen to EventDispatcherService event related to updated Income Sources
|
|
64
|
+
*/
|
|
65
|
+
private listenToUpdatedIncomeSources(): void {
|
|
66
|
+
this.eventDispatcherService.on(AppEventTypeEnum.INCOME_SOURCES_UPDATED)
|
|
67
|
+
.subscribe((incomeSources: IncomeSource[]) => {
|
|
68
|
+
const salaryForecasts: SalaryForecast[] = this.assignSalaryForecasts(incomeSources);
|
|
69
|
+
if (salaryForecasts.length) {
|
|
70
|
+
this.updateBatch(salaryForecasts).subscribe((updatedSalaryForecasts: SalaryForecast[]) => {
|
|
71
|
+
this.eventDispatcherService
|
|
72
|
+
.dispatch(new AppEvent(AppEventTypeEnum.INCOME_SOURCES_FORECASTS_UPDATED, updatedSalaryForecasts));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Assign salary forecasts based on provided income sources
|
|
80
|
+
* @param incomeSources by which salary forecasts will be assigned
|
|
81
|
+
*/
|
|
82
|
+
private assignSalaryForecasts(incomeSources: IncomeSource[]): SalaryForecast[] {
|
|
83
|
+
return incomeSources.map((incomeSource: IncomeSource) => {
|
|
84
|
+
incomeSource.salaryForecasts = incomeSource.salaryForecasts
|
|
85
|
+
.map((salaryForecast: SalaryForecast) => {
|
|
86
|
+
salaryForecast.incomeSource = plainToClass(IncomeSource, {id: incomeSource.id});
|
|
87
|
+
return salaryForecast;
|
|
88
|
+
});
|
|
89
|
+
return incomeSource.salaryForecasts;
|
|
90
|
+
}).flat();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { IntercomService } from './intercom.service';
|
|
4
|
+
|
|
5
|
+
describe('IntercomService', () => {
|
|
6
|
+
let service: IntercomService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(IntercomService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { User } from '../../models/user/user';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Service to work with intercom
|
|
6
|
+
*/
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root'
|
|
9
|
+
})
|
|
10
|
+
export class IntercomService {
|
|
11
|
+
constructor(
|
|
12
|
+
@Inject('environment') private environment: any
|
|
13
|
+
) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Init object with user credentials
|
|
18
|
+
* @param user
|
|
19
|
+
*/
|
|
20
|
+
initUser(user: User): object {
|
|
21
|
+
return {
|
|
22
|
+
app_id: this.environment.intercomAppId,
|
|
23
|
+
email: user.email,
|
|
24
|
+
user_hash: user.hashedEmail
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Init connection for provided data
|
|
30
|
+
* @param user
|
|
31
|
+
*/
|
|
32
|
+
initConnection(user: User): void {
|
|
33
|
+
const connectionCredentials: object = this.initUser(user);
|
|
34
|
+
|
|
35
|
+
(<any>window).Intercom('boot', connectionCredentials);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { LoanService } from './loan.service';
|
|
4
|
+
|
|
5
|
+
describe('LoanService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: LoanService = TestBed.get(LoanService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|