taxtank-core 0.27.0 → 0.27.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.
@@ -13,45 +13,48 @@ export declare enum AppEventTypeEnum {
13
13
  CURRENT_USER_GET_FAILED = 11,
14
14
  DEPRECIATION_DELETED = 12,
15
15
  DEPRECIATIONS_CREATED = 13,
16
- INCOME_SOURCES_CREATED = 14,
17
- INCOME_SOURCES_UPDATED = 15,
18
- INCOME_SOURCES_FORECASTS_CREATED = 16,
19
- INCOME_SOURCES_FORECASTS_UPDATED = 17,
20
- LOAN_UPDATED = 18,
21
- LOAN_PAYOUT_UPDATED = 19,
22
- MESSAGE_CREATED = 20,
23
- MESSAGE_FILE_CREATED = 21,
24
- MESSAGE_FILE_DELETED = 22,
25
- NOTIFICATION_ADDED = 23,
26
- PROPERTY_UPDATED_WITH_DOCUMENT = 24,
27
- PROPERTY_DOCUMENT_ADDED = 25,
28
- PROPERTY_MOVEMENT_CREATED = 26,
29
- PROPERTY_MOVEMENT_UPDATED = 27,
30
- PROPERTY_MOVEMENT_DELETED = 28,
31
- PROPERTY_SHARE_UPDATED = 29,
32
- PROPERTY_SALE_ADDED = 30,
33
- PROPERTY_SALE_DELETED = 31,
34
- PROPERTY_SUBSCRIPTION_ADDED = 32,
35
- PROPERTY_SUBSCRIPTION_DELETED = 33,
36
- PROPERTY_VALUATION_DOCUMENT_CREATED = 34,
37
- SERVICE_SUBSCRIPTION_UPDATED = 35,
38
- TAX_REVIEW_UPDATED = 36,
39
- TRANSACTION_CREATED = 37,
40
- TRANSACTION_DELETED = 38,
41
- TRANSACTION_UPDATED = 39,
42
- TRANSACTION_CREATED_WITH_NEW_RECEIPT = 40,
43
- TRANSACTION_UPDATED_WITH_NEW_RECEIPT = 41,
44
- TRANSACTION_UPDATED_WITH_DELETED_RECEIPT = 42,
45
- TRANSACTION_RECEIPT_CREATED = 43,
46
- TRANSACTION_RECEIPT_DELETED = 44,
47
- TRANSACTIONS_CREATED = 45,
48
- USER_UPDATED = 46,
49
- VEHICLE_CLAIM_UPDATED = 47,
50
- VEHICLE_CLAIM_CREATED = 48,
51
- VEHICLE_CLAIM_DETAILS_UPDATED = 49,
52
- VEHICLE_CLAIM_DETAILS_CREATED = 50,
53
- VEHICLE_LOGBOOK_CREATED = 51,
54
- VEHICLE_LOGBOOK_UPDATED = 52,
55
- VEHICLE_LOGBOOK_DELETED = 53,
56
- VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 54
16
+ DEPRECIATION_UPDATED_WITH_RECEIPT = 14,
17
+ DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT = 15,
18
+ DEPRECIATION_RECEIPT_CREATED = 16,
19
+ DEPRECIATION_RECEIPT_DELETED = 17,
20
+ INCOME_SOURCES_CREATED = 18,
21
+ INCOME_SOURCES_UPDATED = 19,
22
+ INCOME_SOURCES_FORECASTS_CREATED = 20,
23
+ INCOME_SOURCES_FORECASTS_UPDATED = 21,
24
+ LOAN_UPDATED = 22,
25
+ LOAN_PAYOUT_UPDATED = 23,
26
+ MESSAGE_CREATED = 24,
27
+ MESSAGE_FILE_CREATED = 25,
28
+ MESSAGE_FILE_DELETED = 26,
29
+ NOTIFICATION_ADDED = 27,
30
+ PROPERTY_UPDATED_WITH_DOCUMENT = 28,
31
+ PROPERTY_DOCUMENT_ADDED = 29,
32
+ PROPERTY_MOVEMENT_CREATED = 30,
33
+ PROPERTY_MOVEMENT_UPDATED = 31,
34
+ PROPERTY_MOVEMENT_DELETED = 32,
35
+ PROPERTY_SHARE_UPDATED = 33,
36
+ PROPERTY_SALE_ADDED = 34,
37
+ PROPERTY_SALE_DELETED = 35,
38
+ PROPERTY_SUBSCRIPTION_ADDED = 36,
39
+ PROPERTY_SUBSCRIPTION_DELETED = 37,
40
+ PROPERTY_VALUATION_DOCUMENT_CREATED = 38,
41
+ SERVICE_SUBSCRIPTION_UPDATED = 39,
42
+ TAX_REVIEW_UPDATED = 40,
43
+ TRANSACTION_CREATED = 41,
44
+ TRANSACTION_DELETED = 42,
45
+ TRANSACTION_UPDATED = 43,
46
+ TRANSACTION_UPDATED_WITH_RECEIPT = 44,
47
+ TRANSACTION_UPDATED_WITH_DELETED_RECEIPT = 45,
48
+ TRANSACTION_RECEIPT_CREATED = 46,
49
+ TRANSACTION_RECEIPT_DELETED = 47,
50
+ TRANSACTIONS_CREATED = 48,
51
+ USER_UPDATED = 49,
52
+ VEHICLE_CLAIM_UPDATED = 50,
53
+ VEHICLE_CLAIM_CREATED = 51,
54
+ VEHICLE_CLAIM_DETAILS_UPDATED = 52,
55
+ VEHICLE_CLAIM_DETAILS_CREATED = 53,
56
+ VEHICLE_LOGBOOK_CREATED = 54,
57
+ VEHICLE_LOGBOOK_UPDATED = 55,
58
+ VEHICLE_LOGBOOK_DELETED = 56,
59
+ VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 57
57
60
  }
@@ -0,0 +1,28 @@
1
+ import { DepreciationReceipt as DepreciationReceiptBase } from '../../../../db/Models/depreciation/depreciation-receipt';
2
+ import { DepreciationReceipt } from '../../../../models/depreciation/depreciation-receipt';
3
+ import { AppEventTypeEnum } from '../../../../models/event/app-event-type.enum';
4
+ import { Depreciation } from '../../../../models/depreciation/depreciation';
5
+ import { ReceiptService } from '../../receipt/receipt.service';
6
+ import { AssetEntityTypeEnum } from '../../../../interfaces/asset-entity-type.enum';
7
+ import { HttpClient } from '@angular/common/http';
8
+ import { EventDispatcherService } from '../../../event/event-dispatcher.service';
9
+ import { ToastService } from '../../../toast/toast.service';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * @Todo TT-2191 refactor service when receipts API will be updated
13
+ */
14
+ export declare class DepreciationReceiptService extends ReceiptService<Depreciation, DepreciationReceiptBase, DepreciationReceipt> {
15
+ protected http: HttpClient;
16
+ protected eventDispatcherService: EventDispatcherService;
17
+ protected environment: any;
18
+ protected toastService: ToastService;
19
+ modelClass: typeof DepreciationReceipt;
20
+ entityType: AssetEntityTypeEnum;
21
+ receiptCreatedEvent: AppEventTypeEnum;
22
+ receiptDeletedEvent: AppEventTypeEnum;
23
+ entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
24
+ entityUpdatedWithReceiptEvent: AppEventTypeEnum;
25
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<DepreciationReceiptService, never>;
27
+ static ɵprov: i0.ɵɵInjectableDeclaration<DepreciationReceiptService>;
28
+ }
@@ -2,11 +2,20 @@ import { Observable } from 'rxjs';
2
2
  import { Depreciation as DepreciationBase } from '../../../db/Models/depreciation/depreciation';
3
3
  import { RestService } from '../rest/rest.service';
4
4
  import { Depreciation } from '../../../models/depreciation/depreciation';
5
- import { IEventListener } from '../../../interfaces/event-listener.interface';
5
+ import { HttpClient } from '@angular/common/http';
6
+ import { EventDispatcherService } from '../../event/event-dispatcher.service';
7
+ import { ToastService } from '../../toast/toast.service';
8
+ import { DepreciationReceiptService } from './depreciation-receipt/depreciation-receipt.service';
6
9
  import * as i0 from "@angular/core";
7
- export declare class DepreciationService extends RestService<DepreciationBase, Depreciation> implements IEventListener {
10
+ export declare class DepreciationService extends RestService<DepreciationBase, Depreciation> {
11
+ protected http: HttpClient;
12
+ protected eventDispatcherService: EventDispatcherService;
13
+ protected environment: any;
14
+ protected toastService: ToastService;
15
+ private depreciationReceiptService;
8
16
  modelClass: typeof Depreciation;
9
17
  url: string;
18
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService, depreciationReceiptService: DepreciationReceiptService);
10
19
  /**
11
20
  * Add a single depreciation
12
21
  * @TODO add auto-generation for events
@@ -17,16 +26,14 @@ export declare class DepreciationService extends RestService<DepreciationBase, D
17
26
  * @TODO add auto-generation for events
18
27
  */
19
28
  addBatch(depreciations: Depreciation[]): Observable<Depreciation[]>;
29
+ update(depreciation: Depreciation): Observable<Depreciation>;
20
30
  /**
21
31
  * Listen to Depreciations events
22
32
  */
23
33
  listenEvents(): void;
24
34
  getOpenBalance(depreciation: Depreciation): Observable<number>;
25
- /**
26
- * Upload depreciation receipt
27
- * @param depreciation for which will be uploaded receipt
28
- */
29
- uploadReceipt(depreciation: Depreciation): void;
35
+ private listenReceiptAdded;
36
+ private listenReceiptDeleted;
30
37
  /**
31
38
  * Listen to EventDispatcherService event related to updated bank loan
32
39
  */
@@ -39,6 +46,7 @@ export declare class DepreciationService extends RestService<DepreciationBase, D
39
46
  * Listen to EventDispatcherService event related to updated vehicle claim
40
47
  */
41
48
  private listenVehicleClaimChanges;
49
+ private replaceInCache;
42
50
  static ɵfac: i0.ɵɵFactoryDeclaration<DepreciationService, never>;
43
51
  static ɵprov: i0.ɵɵInjectableDeclaration<DepreciationService>;
44
52
  }
@@ -0,0 +1,3 @@
1
+ export * from './depreciation.service';
2
+ export * from './depreciation-capital-project/depreciation-capital-project.service';
3
+ export * from './depreciation-receipt/depreciation-receipt.service';
@@ -0,0 +1,62 @@
1
+ import { Type } from '@angular/core';
2
+ import { AssetEntityTypeEnum } from '../../../interfaces/asset-entity-type.enum';
3
+ import { IEventListener } from '../../../interfaces/event-listener.interface';
4
+ import { Transaction } from '../../../models/transaction/transaction';
5
+ import { Depreciation } from '../../../models/depreciation/depreciation';
6
+ import { AppEventTypeEnum } from '../../../models/event/app-event-type.enum';
7
+ import { TransactionReceipt as TransactionReceiptBase } from '../../../db/Models/transaction/transaction-receipt';
8
+ import { DepreciationReceipt as DepreciationReceiptBase } from '../../../db/Models/depreciation/depreciation-receipt';
9
+ import { Observable } from 'rxjs';
10
+ import { HttpClient } from '@angular/common/http';
11
+ import { EventDispatcherService } from '../../event/event-dispatcher.service';
12
+ import { ToastService } from '../../toast/toast.service';
13
+ import * as i0 from "@angular/core";
14
+ /**
15
+ * Abstract service class to work with transactions-like receipt files (transactions, depreciations, e.t.c.)
16
+ * @Todo TT-2191 refactor service when receipts API will be updated
17
+ */
18
+ export declare abstract class ReceiptService<ParentModel extends Transaction | Depreciation, BaseModel extends TransactionReceiptBase | DepreciationReceiptBase, Model extends BaseModel> implements IEventListener {
19
+ protected http: HttpClient;
20
+ protected eventDispatcherService: EventDispatcherService;
21
+ protected environment: any;
22
+ protected toastService: ToastService;
23
+ /**
24
+ * Needed to fulfill endpoint to API
25
+ */
26
+ abstract entityType: AssetEntityTypeEnum;
27
+ abstract modelClass: Type<Model>;
28
+ /**
29
+ * Event type that will be dispatched when receipt will be uploaded
30
+ */
31
+ abstract receiptCreatedEvent: AppEventTypeEnum;
32
+ /**
33
+ * Event type that will be dispatched when receipt will be deleted
34
+ */
35
+ abstract receiptDeletedEvent: AppEventTypeEnum;
36
+ /**
37
+ * Event type that will be dispatched when parent entity (transaction-like class) will be updated with attached receipt
38
+ */
39
+ abstract entityUpdatedWithReceiptEvent: AppEventTypeEnum;
40
+ /**
41
+ * Event type that will be dispatched when parent entity (transaction-like class) will be updated with deleted receipt
42
+ */
43
+ abstract entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
44
+ protected constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
45
+ listenEvents(): void;
46
+ /**
47
+ * Entity is necessary to take the ID and the receipt file from it.
48
+ */
49
+ add(receiptEntity: ParentModel): Observable<Model>;
50
+ delete(receiptEntity: ParentModel): Observable<void>;
51
+ /**
52
+ * Parent entity was updated with attached receipt
53
+ */
54
+ private listenParentWithReceiptUpdated;
55
+ /**
56
+ * Parent entity was updated, but receipt was removed
57
+ */
58
+ private listenParentWithoutReceiptUpdated;
59
+ private createModelInstance;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReceiptService<any, any, any>, never>;
61
+ static ɵprov: i0.ɵɵInjectableDeclaration<ReceiptService<any, any, any>>;
62
+ }
@@ -1,28 +1,28 @@
1
1
  import { Transaction } from '../../../../models/transaction/transaction';
2
+ import { AppEventTypeEnum } from '../../../../models/event/app-event-type.enum';
3
+ import { ReceiptService } from '../../receipt/receipt.service';
4
+ import { AssetEntityTypeEnum } from '../../../../interfaces/asset-entity-type.enum';
5
+ import { TransactionReceipt as TransactionReceiptBase } from '../../../../db/Models/transaction/transaction-receipt';
6
+ import { TransactionReceipt } from '../../../../models/transaction/transaction-receipt';
2
7
  import { HttpClient } from '@angular/common/http';
3
8
  import { EventDispatcherService } from '../../../event/event-dispatcher.service';
4
- import { IEventListener } from '../../../../interfaces/event-listener.interface';
9
+ import { ToastService } from '../../../toast/toast.service';
5
10
  import * as i0 from "@angular/core";
6
- export declare class TransactionReceiptService implements IEventListener {
7
- private http;
8
- private eventDispatcherService;
9
- private environment;
10
- url: string;
11
- constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any);
12
- /**
13
- * Transaction instance is necessary to take the ID and the receipt file from it.
14
- */
15
- add(transaction: Transaction): void;
16
- /**
17
- * Transaction instance is necessary to take the ID and the receipt ID from it.
18
- */
19
- delete(transaction: Transaction): void;
20
- listenEvents(): void;
21
- private listenTransactionWithReceiptUpdated;
22
- /**
23
- * Case when transaction was updated, but receipt was removed
24
- */
25
- private listenTransactionWithoutReceiptUpdated;
11
+ /**
12
+ * @Todo TT-2191 refactor service when receipts API will be updated
13
+ */
14
+ export declare class TransactionReceiptService extends ReceiptService<Transaction, TransactionReceiptBase, TransactionReceipt> {
15
+ protected http: HttpClient;
16
+ protected eventDispatcherService: EventDispatcherService;
17
+ protected environment: any;
18
+ protected toastService: ToastService;
19
+ modelClass: typeof TransactionReceipt;
20
+ entityType: AssetEntityTypeEnum;
21
+ receiptCreatedEvent: AppEventTypeEnum;
22
+ receiptDeletedEvent: AppEventTypeEnum;
23
+ entityUpdatedWithReceiptEvent: AppEventTypeEnum;
24
+ entityUpdatedWithDeletedReceiptEvent: AppEventTypeEnum;
25
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
26
26
  static ɵfac: i0.ɵɵFactoryDeclaration<TransactionReceiptService, never>;
27
27
  static ɵprov: i0.ɵɵInjectableDeclaration<TransactionReceiptService>;
28
28
  }
@@ -93,6 +93,7 @@ export declare class TransactionService extends RestService<TransactionBase, Tra
93
93
  private listenReceiptAdded;
94
94
  private listenReceiptDeleted;
95
95
  private listenVehicleClaimChanges;
96
+ private replaceInCache;
96
97
  static ɵfac: i0.ɵɵFactoryDeclaration<TransactionService, never>;
97
98
  static ɵprov: i0.ɵɵInjectableDeclaration<TransactionService>;
98
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",
package/public-api.d.ts CHANGED
@@ -314,8 +314,7 @@ export * from './lib/services/http/firm/client-invite/client-invite.service';
314
314
  export * from './lib/services/http/firm/client-movement/client-movement.service';
315
315
  export * from './lib/services/http/firm/portfolio-report/client-portfolio-report.service';
316
316
  export * from './lib/services/http/firm/portfolio-report/client-portfolio-report.service';
317
- export * from './lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service';
318
- export * from './lib/services/http/depreciation/depreciation.service';
317
+ export * from './lib/services/http/depreciation';
319
318
  export * from './lib/services/http/document/document-folder/document-folder.service';
320
319
  export * from './lib/services/http/firm/employee/employee.service';
321
320
  export * from './lib/services/http/firm/employee-invite/employee-invite.service';