From db75a4472746421597fa6492761150a509b4eb21 Mon Sep 17 00:00:00 2001 From: aastha Date: Mon, 9 Sep 2024 14:35:00 +0530 Subject: [PATCH 01/13] Minor --- .../v1/expenses-query-params.model.ts | 1 + .../services/personal-cards.service.spec.ts | 16 --- .../core/services/personal-cards.service.ts | 10 -- .../core/services/transaction.service.spec.ts | 129 ------------------ src/app/core/services/transaction.service.ts | 81 +---------- .../expense-preview.component.html | 18 +-- .../expense-preview.component.ts | 16 ++- 7 files changed, 23 insertions(+), 248 deletions(-) diff --git a/src/app/core/models/platform/v1/expenses-query-params.model.ts b/src/app/core/models/platform/v1/expenses-query-params.model.ts index 81eebdcc19..31fdaffd86 100644 --- a/src/app/core/models/platform/v1/expenses-query-params.model.ts +++ b/src/app/core/models/platform/v1/expenses-query-params.model.ts @@ -3,6 +3,7 @@ import { APIQueryParams } from './query-params.model'; export interface ExpensesQueryParams extends APIQueryParams { report_id?: string; state?: string; + split_group_id?: string; searchString?: string; queryParams?: Record; } diff --git a/src/app/core/services/personal-cards.service.spec.ts b/src/app/core/services/personal-cards.service.spec.ts index 8ba34d4bfc..821dcc61f6 100644 --- a/src/app/core/services/personal-cards.service.spec.ts +++ b/src/app/core/services/personal-cards.service.spec.ts @@ -814,22 +814,6 @@ describe('PersonalCardsService', () => { }); }); - it('getExpenseDetails(): should get expense details', (done) => { - apiV2Service.get.and.returnValue(of(etxncData)); - - const txnSplitGroupID = 'txOJVaaPxo9O'; - - personalCardsService.getExpenseDetails(txnSplitGroupID).subscribe((res) => { - expect(res).toEqual(etxncData.data[0]); - expect(apiV2Service.get).toHaveBeenCalledOnceWith('/expenses', { - params: { - tx_split_group_id: `eq.${txnSplitGroupID}`, - }, - }); - done(); - }); - }); - it('fetchTransactions(): should fetch transactions', (done) => { expenseAggregationService.post.and.returnValue(of(apiPersonalCardTxnsRes)); const accountId = 'baccLesaRlyvLY'; diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index 5116f05adf..dedd34202e 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -129,16 +129,6 @@ export class PersonalCardsService { return this.getMatchedExpenses(amount, txnDate).pipe(map((res) => res.length)); } - getExpenseDetails(transactionSplitGroupId: string): Observable { - return this.apiv2Service - .get('/expenses', { - params: { - tx_split_group_id: `eq.${transactionSplitGroupId}`, - }, - }) - .pipe(map((res) => res.data[0])); - } - matchExpense(transactionSplitGroupId: string, externalExpenseId: string): Observable { return this.apiService.post('/transactions/external_expense/match', { transaction_split_group_id: transactionSplitGroupId, diff --git a/src/app/core/services/transaction.service.spec.ts b/src/app/core/services/transaction.service.spec.ts index ba558a8036..929e7cdf53 100644 --- a/src/app/core/services/transaction.service.spec.ts +++ b/src/app/core/services/transaction.service.spec.ts @@ -60,7 +60,6 @@ import { cloneDeep } from 'lodash'; import { expensesCacheBuster$ } from '../cache-buster/expense-cache-buster'; import { ExpensesService } from './platform/v1/spender/expenses.service'; import { expenseData } from '../mock-data/platform/v1/expense.data'; -import { LaunchDarklyService } from './launch-darkly.service'; describe('TransactionService', () => { let transactionService: TransactionService; @@ -85,9 +84,7 @@ describe('TransactionService', () => { beforeEach(() => { const networkServiceSpy = jasmine.createSpyObj('NetworkService', ['isOnline']); const storageServiceSpy = jasmine.createSpyObj('StorageService', ['get', 'set']); - const authServiceSpy = jasmine.createSpyObj('AuthService', ['getEou']); const apiServiceSpy = jasmine.createSpyObj('ApiService', ['get', 'post', 'delete']); - const apiV2ServiceSpy = jasmine.createSpyObj('ApiV2Service', ['get', 'getStats']); const dataTransformServiceSpy = jasmine.createSpyObj('DataTransformService', ['unflatten']); const dateServiceSpy = jasmine.createSpyObj('DateService', [ 'fixDates', @@ -111,27 +108,14 @@ describe('TransactionService', () => { const orgSettingsServiceSpy = jasmine.createSpyObj('OrgSettingsService', ['get']); const accountsServiceSpy = jasmine.createSpyObj('AccountsService', ['getEMyAccounts']); const expensesServiceSpy = jasmine.createSpyObj('ExpensesService', ['attachReceiptsToExpense']); - const ldServiceSpy = jasmine.createSpyObj('LaunchDarklyService', ['getImmediate']); TestBed.configureTestingModule({ providers: [ TransactionService, - { - provide: LaunchDarklyService, - useValue: ldServiceSpy, - }, { provide: ApiService, useValue: apiServiceSpy, }, - { - provide: ApiV2Service, - useValue: apiV2ServiceSpy, - }, - { - provide: AuthService, - useValue: authServiceSpy, - }, { provide: DataTransformService, useValue: dataTransformServiceSpy, @@ -198,9 +182,7 @@ describe('TransactionService', () => { transactionService = TestBed.inject(TransactionService); networkService = TestBed.inject(NetworkService) as jasmine.SpyObj; storageService = TestBed.inject(StorageService) as jasmine.SpyObj; - authService = TestBed.inject(AuthService) as jasmine.SpyObj; apiService = TestBed.inject(ApiService) as jasmine.SpyObj; - apiV2Service = TestBed.inject(ApiV2Service) as jasmine.SpyObj; dataTransformService = TestBed.inject(DataTransformService) as jasmine.SpyObj; dateService = TestBed.inject(DateService) as jasmine.SpyObj; orgUserSettingsService = TestBed.inject(OrgUserSettingsService) as jasmine.SpyObj; @@ -847,117 +829,6 @@ describe('TransactionService', () => { }); }); - it('getMyExpenses(): should return my expenses with order', (done) => { - authService.getEou.and.resolveTo(eouRes2); - apiV2Service.get.and.returnValue(of(expenseV2Data)); - dateService.fixDatesV2.and.returnValue(expenseV2Data.data[0]); - - const params = { - offset: 0, - limit: 1, - queryParams: { - or: [], - tx_report_id: 'is.null', - tx_state: 'in.(COMPLETE,DRAFT)', - }, - order: 'tx_txn_dt.desc', - }; - - transactionService.getMyExpenses(params).subscribe((res) => { - expect(res).toEqual(expenseV2Data); - expect(apiV2Service.get).toHaveBeenCalledOnceWith('/expenses', { - params: { - offset: params.offset, - limit: params.limit, - order: `${params.order || 'tx_txn_dt.desc'},tx_created_at.desc,tx_id.desc`, - tx_org_user_id: 'eq.' + eouRes2.ou.id, - ...params.queryParams, - }, - }); - expect(authService.getEou).toHaveBeenCalledTimes(1); - expect(dateService.fixDatesV2).toHaveBeenCalledOnceWith(res.data[0]); - done(); - }); - }); - - it('getMyExpenses(): should return my expenses without order using default date order', (done) => { - authService.getEou.and.resolveTo(eouRes2); - apiV2Service.get.and.returnValue(of(expenseV2Data)); - dateService.fixDatesV2.and.returnValue(expenseV2Data.data[0]); - - const params2 = { - offset: 0, - limit: 1, - queryParams: { - or: [], - tx_report_id: 'is.null', - tx_state: 'in.(COMPLETE,DRAFT)', - }, - }; - - transactionService.getMyExpenses(params2).subscribe((res) => { - expect(res).toEqual(expenseV2Data); - expect(apiV2Service.get).toHaveBeenCalledOnceWith('/expenses', { - params: { - offset: params2.offset, - limit: params2.limit, - // eslint-disable-next-line @typescript-eslint/dot-notation - order: `${params2['order'] || 'tx_txn_dt.desc'},tx_created_at.desc,tx_id.desc`, - tx_org_user_id: 'eq.' + eouRes2.ou.id, - ...params2.queryParams, - }, - }); - expect(authService.getEou).toHaveBeenCalledTimes(1); - expect(dateService.fixDatesV2).toHaveBeenCalledOnceWith(res.data[0]); - done(); - }); - }); - - it('getMyExpensesCount(): should return my expenses count', (done) => { - spyOn(transactionService, 'getMyExpenses').and.returnValue(of(expenseV2Data)); - - const params = { - tx_report_id: 'is.null', - tx_state: 'in.(COMPLETE,DRAFT)', - }; - - transactionService.getMyExpensesCount(params).subscribe((res) => { - expect(res).toEqual(expenseV2Data.count); - expect(transactionService.getMyExpenses).toHaveBeenCalledOnceWith({ - offset: 0, - limit: 1, - queryParams: params, - }); - done(); - }); - }); - - it('getAllExpenses(): should return all expenses', (done) => { - spyOn(transactionService, 'getMyExpensesCount').and.returnValue(of(2)); - spyOn(transactionService, 'getMyExpenses').and.returnValue(of(expenseV2DataMultiple)); - - const params = { - queryParams: { - tx_report_id: 'is.null', - tx_state: 'in.(COMPLETE)', - order: 'tx_txn_dt.desc', - or: ['(tx_policy_amount.is.null,tx_policy_amount.gt.0.0001)'], - }, - }; - - transactionService.getAllExpenses(params).subscribe((res) => { - expect(res).toEqual(expenseV2DataMultiple.data); - expect(transactionService.getMyExpensesCount).toHaveBeenCalledOnceWith(params.queryParams); - expect(transactionService.getMyExpenses).toHaveBeenCalledOnceWith({ - offset: 0, - limit: 2, - queryParams: params.queryParams, - order: undefined, - }); - done(); - }); - }); - it('unmatchCCCExpense(): should unmatch ccc expense', (done) => { spenderPlatformV1ApiService.post.and.returnValue(of(unmatchCCCExpenseResponseData)); diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 3c6a41d7d1..68a0459d2d 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -22,8 +22,6 @@ import { AccountsService } from './accounts.service'; import { SpenderPlatformV1ApiService } from './spender-platform-v1-api.service'; import { PlatformPolicyExpense } from '../models/platform/platform-policy-expense.model'; import { ExpensePolicy } from '../models/platform/platform-expense-policy.model'; -import { EtxnParams } from '../models/etxn-params.model'; -import { ApiV2Response } from '../models/v2/api-v2-response.model'; import { Transaction } from '../models/v1/transaction.model'; import { FileObject } from '../models/file-obj.model'; import { UnflattenedTransaction } from '../models/unflattened-transaction.model'; @@ -54,9 +52,7 @@ export class TransactionService { @Inject(PAGINATION_SIZE) private paginationSize: number, private storageService: StorageService, private apiService: ApiService, - private apiV2Service: ApiV2Service, private dateService: DateService, - private authService: AuthService, private orgUserSettingsService: OrgUserSettingsService, private timezoneService: TimezoneService, private utilityService: UtilityService, @@ -65,8 +61,7 @@ export class TransactionService { private paymentModesService: PaymentModesService, private orgSettingsService: OrgSettingsService, private accountsService: AccountsService, - private expensesService: ExpensesService, - private ldService: LaunchDarklyService + private expensesService: ExpensesService ) { expensesCacheBuster$.subscribe(() => { if (this.clearTaskCache) { @@ -92,71 +87,6 @@ export class TransactionService { ); } - @Cacheable({ - cacheBusterObserver: expensesCacheBuster$, - }) - - // TODO: Remove/Update method once we remove older my-expenses-page completely - getMyExpenses( - config: Partial<{ offset: number; limit: number; order: string; queryParams: EtxnParams }> = { - offset: 0, - limit: 10, - queryParams: {}, - } - ): Observable> { - return from(this.authService.getEou()).pipe( - switchMap((eou) => - this.apiV2Service.get('/expenses', { - params: { - offset: config.offset, - limit: config.limit, - order: `${config.order || 'tx_txn_dt.desc'},tx_created_at.desc,tx_id.desc`, - tx_org_user_id: 'eq.' + eou.ou.id, - ...config.queryParams, - }, - }) - ), - map( - (res) => - res as { - count: number; - data: Expense[]; - limit: number; - offset: number; - url: string; - } - ), - map((res) => ({ - ...res, - data: res.data.map((datum: Expense) => this.dateService.fixDatesV2(datum)), - })) - ); - } - - @Cacheable({ - cacheBusterObserver: expensesCacheBuster$, - }) - - // TODO: Remove/Update method once we remove older my-expenses-page completely - getAllExpenses(config: Partial<{ order: string; queryParams: EtxnParams }>): Observable { - return this.getMyExpensesCount(config.queryParams).pipe( - switchMap((count) => { - count = count > this.paginationSize ? count / this.paginationSize : 1; - return range(0, count); - }), - concatMap((page) => - this.getMyExpenses({ - offset: this.paginationSize * page, - limit: this.paginationSize, - queryParams: config.queryParams, - order: config.order, - }) - ), - map((res) => res.data), - reduce((acc, curr) => acc.concat(curr), [] as Expense[]) - ); - } - @Cacheable({ cacheBusterObserver: expensesCacheBuster$, }) @@ -278,15 +208,6 @@ export class TransactionService { ); } - // TODO: Remove/Update method once we remove older my-expenses-page completely - getMyExpensesCount(queryParams: EtxnParams): Observable { - return this.getMyExpenses({ - offset: 0, - limit: 1, - queryParams, - }).pipe(map((res) => res.count)); - } - checkMandatoryFields(platformPolicyExpense: PlatformPolicyExpense): Observable { const payload = { data: platformPolicyExpense, diff --git a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html index d68ef2a83e..c6ecc64e90 100644 --- a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html +++ b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html @@ -24,7 +24,7 @@ @@ -34,7 +34,7 @@
- {{ expenseDetails.tx_amount | currency : expenseDetails.tx_currency : 'symbol-narrow' }} + {{ expenseDetails.amount | currency : expenseDetails.currency : 'symbol-narrow' }}
@@ -44,7 +44,7 @@
- {{ expenseDetails.tx_created_at | date : 'MMM dd, YYYY' }} + {{ expenseDetails.created_at | date : 'MMM dd, YYYY' }}
@@ -54,7 +54,7 @@
- {{ expenseDetails.tx_txn_dt | date : 'MMM dd, YYYY' }} + {{ expenseDetails.spent_at | date : 'MMM dd, YYYY' }}
@@ -64,8 +64,8 @@
- {{ expenseDetails.tx_vendor }} - - + {{ expenseDetails.merchant }} + -
@@ -75,7 +75,7 @@
- {{ expenseDetails.tx_org_category }} + {{ expenseDetails.category.name }}
@@ -95,7 +95,7 @@
- Not Attached - Attached diff --git a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts index 948a490e9f..e93aedb72d 100644 --- a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts +++ b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts @@ -1,12 +1,15 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { ModalController, Platform } from '@ionic/angular'; -import { finalize } from 'rxjs/operators'; +import { finalize, map } from 'rxjs/operators'; import { PersonalCardsService } from 'src/app/core/services/personal-cards.service'; import { MatSnackBar } from '@angular/material/snack-bar'; import { SnackbarPropertiesService } from 'src/app/core/services/snackbar-properties.service'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { TrackingService } from 'src/app/core/services/tracking.service'; +import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service'; +import { Observable } from 'rxjs'; +import { Expense } from 'src/app/core/models/platform/v1/expense.model'; @Component({ selector: 'app-expense-preview', @@ -20,7 +23,7 @@ export class ExpensePreviewComponent implements OnInit { @Input() cardTxnId; - expenseDetails$; + expenseDetails$: Observable; loading = false; @@ -37,7 +40,8 @@ export class ExpensePreviewComponent implements OnInit { private matSnackBar: MatSnackBar, private snackbarProperties: SnackbarPropertiesService, private platform: Platform, - private trackingService: TrackingService + private trackingService: TrackingService, + private expensesService: ExpensesService ) {} ngOnInit(): void { @@ -45,7 +49,11 @@ export class ExpensePreviewComponent implements OnInit { } ionViewWillEnter() { - this.expenseDetails$ = this.personalCardsService.getExpenseDetails(this.expenseId); + const params = { + split_group_id: `eq.${this.expenseId}`, + }; + + this.expenseDetails$ = this.expensesService.getExpenses(params).pipe(map((res) => res[0])); } closeModal() { From 8b867ea7d9f99484058aad63658049f92aa984bf Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 09:32:01 +0530 Subject: [PATCH 02/13] Minor --- .../expense-preview/expense-preview.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts index e93aedb72d..00718d5db0 100644 --- a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts +++ b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts @@ -17,11 +17,11 @@ import { Expense } from 'src/app/core/models/platform/v1/expense.model'; styleUrls: ['./expense-preview.component.scss'], }) export class ExpensePreviewComponent implements OnInit { - @Input() expenseId; + @Input() expenseId: string; - @Input() card; + @Input() card: string; - @Input() cardTxnId; + @Input() cardTxnId: string; expenseDetails$: Observable; @@ -48,7 +48,7 @@ export class ExpensePreviewComponent implements OnInit { this.isIos = this.platform.is('ios'); } - ionViewWillEnter() { + ionViewWillEnter(): void { const params = { split_group_id: `eq.${this.expenseId}`, }; @@ -56,11 +56,11 @@ export class ExpensePreviewComponent implements OnInit { this.expenseDetails$ = this.expensesService.getExpenses(params).pipe(map((res) => res[0])); } - closeModal() { + closeModal(): void { this.modalController.dismiss(); } - matchExpense() { + matchExpense(): void { this.loading = true; this.personalCardsService .matchExpense(this.expenseId, this.cardTxnId) @@ -76,7 +76,7 @@ export class ExpensePreviewComponent implements OnInit { }); } - unmatchExpense() { + unmatchExpense(): void { this.unMatching = true; this.personalCardsService .unmatchExpense(this.expenseId, this.cardTxnId) @@ -94,7 +94,7 @@ export class ExpensePreviewComponent implements OnInit { }); } - editExpense() { + editExpense(): void { this.modalController.dismiss(); this.router.navigate([ '/', From 98efe7b94d84419964a9d2792600b4d9042ae7e4 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 10:21:58 +0530 Subject: [PATCH 03/13] Minor --- .../my-create-report.page.spec.ts | 2 -- .../fyle/my-expenses/my-expenses.page.spec.ts | 18 ------------- .../expense-preview.component.spec.ts | 26 +++++++++++-------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/app/fyle/my-create-report/my-create-report.page.spec.ts b/src/app/fyle/my-create-report/my-create-report.page.spec.ts index 73eae509bc..2812aa54b6 100644 --- a/src/app/fyle/my-create-report/my-create-report.page.spec.ts +++ b/src/app/fyle/my-create-report/my-create-report.page.spec.ts @@ -403,7 +403,6 @@ describe('MyCreateReportPage', () => { it('ionViewWillEnter(): should setup expenses', fakeAsync(() => { loaderService.showLoader.and.resolveTo(); loaderService.hideLoader.and.resolveTo(); - transactionService.getAllExpenses.and.returnValue(of(cloneDeep(selectedExpenses))); expensesService.getAllExpenses.and.returnValue(of(readyToReportExpensesData)); orgSettingsService.get.and.returnValue(of(orgSettingsPendingRestrictions)); spyOn(component, 'getReportTitle').and.returnValue(null); @@ -432,7 +431,6 @@ describe('MyCreateReportPage', () => { beforeEach(() => { loaderService.showLoader.and.resolveTo(); loaderService.hideLoader.and.resolveTo(); - transactionService.getAllExpenses.and.returnValue(of(cloneDeep(selectedExpenses))); const mockSelectedExpense = cloneDeep(readyToReportExpensesData); mockSelectedExpense[0].matched_corporate_card_transaction_ids = []; mockSelectedExpense[1].matched_corporate_card_transactions[0].status = ExpenseTransactionStatus.PENDING; diff --git a/src/app/fyle/my-expenses/my-expenses.page.spec.ts b/src/app/fyle/my-expenses/my-expenses.page.spec.ts index 3c946345a5..4f7ce7f288 100644 --- a/src/app/fyle/my-expenses/my-expenses.page.spec.ts +++ b/src/app/fyle/my-expenses/my-expenses.page.spec.ts @@ -774,24 +774,6 @@ describe('MyExpensesPage', () => { expect(component.acc).toEqual(apiExpenses1); })); - it('should not call getMyExpenses if count is less than (params.pageNumber - 1) * 10', fakeAsync(() => { - transactionService.getMyExpensesCount.and.returnValue(of(0)); - component.ionViewWillEnter(); - expect(inputElement.value).toEqual(''); - inputElement.value = 'example'; - inputElement.dispatchEvent(new Event('keyup')); - tick(500); - - expect(expensesService.getExpensesCount).toHaveBeenCalledTimes(5); - expect(expensesService.getExpensesCount).toHaveBeenCalledWith({ - report_id: 'is.null', - state: 'in.(COMPLETE,DRAFT)', - }); - expect(component.clusterDomain).toEqual(apiAuthRes.cluster_domain); - expect(transactionService.getMyExpenses).not.toHaveBeenCalled(); - expect(component.acc).toEqual(apiExpenses1); - })); - it('should call getMyExpenseCount with order if sortDir and sortParam are defined', fakeAsync(() => { component.ionViewWillEnter(); component.loadExpenses$.next({ diff --git a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.spec.ts b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.spec.ts index 7c00b966e1..a85cae1e58 100644 --- a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.spec.ts +++ b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.spec.ts @@ -11,8 +11,9 @@ import { MatIconModule } from '@angular/material/icon'; import { MatIconTestingModule } from '@angular/material/icon/testing'; import { ExpensePreviewShimmerComponent } from '../expense-preview-shimmer/expense-preview-shimmer.component'; import { of } from 'rxjs'; -import { etxncData } from 'src/app/core/mock-data/expense.data'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; +import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service'; +import { apiExpenses1 } from 'src/app/core/mock-data/platform/v1/expense.data'; describe('ExpensePreviewComponent', () => { let component: ExpensePreviewComponent; @@ -24,6 +25,7 @@ describe('ExpensePreviewComponent', () => { let snackbarProperties: jasmine.SpyObj; let platform: jasmine.SpyObj; let trackingService: jasmine.SpyObj; + let expensesService: jasmine.SpyObj; beforeEach(waitForAsync(() => { const modalControllerSpy = jasmine.createSpyObj('ModalController', ['dismiss']); @@ -40,7 +42,7 @@ describe('ExpensePreviewComponent', () => { 'oldExpensematchedFromPersonalCard', 'unmatchedExpensesFromPersonalCard', ]); - + const expensesServiceSpy = jasmine.createSpyObj('ExpensesService', ['getExpenses']); TestBed.configureTestingModule({ declarations: [ExpensePreviewComponent, ExpensePreviewShimmerComponent], imports: [IonicModule.forRoot(), MatIconModule, MatIconTestingModule, FormsModule, MatSnackBarModule], @@ -52,6 +54,7 @@ describe('ExpensePreviewComponent', () => { { provide: PersonalCardsService, useValue: personalCardsServiceSpy }, { provide: Platform, useValue: platformSpy }, { provide: TrackingService, useValue: trackingServiceSpy }, + { provide: ExpensesService, useValue: expensesServiceSpy }, ], }).compileComponents(); @@ -61,45 +64,46 @@ describe('ExpensePreviewComponent', () => { personalCardsService = TestBed.inject(PersonalCardsService) as jasmine.SpyObj; platform = TestBed.inject(Platform) as jasmine.SpyObj; trackingService = TestBed.inject(TrackingService) as jasmine.SpyObj; + expensesService = TestBed.inject(ExpensesService) as jasmine.SpyObj; snackbarProperties = TestBed.inject(SnackbarPropertiesService) as jasmine.SpyObj; fixture = TestBed.createComponent(ExpensePreviewComponent); component = fixture.componentInstance; - const expense = { id: 'txOJVaaPxo9O' }; - component.expenseId = expense; + component.expenseId = 'txOJVaaPxo9O'; fixture.detectChanges(); })); it('should create', () => { expect(component).toBeTruthy(); }); + describe('onInit():', () => { it('should set isIos to true if the platform is iOS', () => { platform.is.and.returnValue(true); component.ngOnInit(); - expect(component.isIos).toBe(true); + expect(component.isIos).toBeTrue(); }); it('should set isIos to false if the platform is not iOS', () => { platform.is.and.returnValue(false); component.ngOnInit(); - expect(component.isIos).toBe(false); + expect(component.isIos).toBeFalse(); }); }); it('ionViewWillEnter(): should get personal card expense details', (done) => { - personalCardsService.getExpenseDetails.and.returnValue(of(etxncData.data[0])); + expensesService.getExpenses.and.returnValue(of(apiExpenses1)); component.ionViewWillEnter(); component.expenseDetails$.subscribe((result) => { - expect(result).toEqual(etxncData.data[0]); - expect(personalCardsService.getExpenseDetails).toHaveBeenCalledOnceWith(component.expenseId); + expect(result).toEqual(apiExpenses1[0]); + expect(expensesService.getExpenses).toHaveBeenCalledOnceWith({ split_group_id: `eq.${component.expenseId}` }); done(); }); }); it('editExpense(): should navigate to the add-edit-expense page and edit expense', () => { - const modalControllerDismissSpy = modalController.dismiss.and.returnValue(Promise.resolve(true)); + const modalControllerDismissSpy = modalController.dismiss.and.resolveTo(true); component.editExpense(); expect(router.navigate).toHaveBeenCalledOnceWith([ '/', @@ -111,7 +115,7 @@ describe('ExpensePreviewComponent', () => { }); it('closeModal(): should dismiss the modal', () => { - const modalControllerDismissSpy = modalController.dismiss.and.returnValue(Promise.resolve(true)); + const modalControllerDismissSpy = modalController.dismiss.and.resolveTo(true); component.closeModal(); expect(modalControllerDismissSpy).toHaveBeenCalledTimes(1); }); From ab282ad9541fbe9ed061c735a3bc0948e35ac439 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 13:41:46 +0530 Subject: [PATCH 04/13] Minor --- .../personal-cards-matched-expenses.page.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/fyle/personal-cards-matched-expenses/personal-cards-matched-expenses.page.ts b/src/app/fyle/personal-cards-matched-expenses/personal-cards-matched-expenses.page.ts index 6bf788ec64..e5b1e35436 100644 --- a/src/app/fyle/personal-cards-matched-expenses/personal-cards-matched-expenses.page.ts +++ b/src/app/fyle/personal-cards-matched-expenses/personal-cards-matched-expenses.page.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { HeaderState } from '../../shared/components/fy-header/header-state.enum'; import { PersonalCardsService } from 'src/app/core/services/personal-cards.service'; import { Router } from '@angular/router'; @@ -6,17 +6,18 @@ import { ModalController } from '@ionic/angular'; import { ExpensePreviewComponent } from './expense-preview/expense-preview.component'; import { ModalPropertiesService } from 'src/app/core/services/modal-properties.service'; import * as dayjs from 'dayjs'; +import { PersonalCardTxn } from 'src/app/core/models/personal_card_txn.model'; @Component({ selector: 'app-personal-cards-matched-expenses', templateUrl: './personal-cards-matched-expenses.page.html', styleUrls: ['./personal-cards-matched-expenses.page.scss'], }) -export class PersonalCardsMatchedExpensesPage implements OnInit { +export class PersonalCardsMatchedExpensesPage { headerState: HeaderState = HeaderState.base; navigateBack = true; - txnDetails: any = {}; + txnDetails: PersonalCardTxn; matchedExpenses$; @@ -26,17 +27,15 @@ export class PersonalCardsMatchedExpensesPage implements OnInit { private modalController: ModalController, private modalProperties: ModalPropertiesService ) { - this.txnDetails = this.router.getCurrentNavigation().extras.state.txnDetails; + this.txnDetails = this.router.getCurrentNavigation().extras.state.txnDetails as PersonalCardTxn; } - ngOnInit() {} - - ionViewWillEnter() { + ionViewWillEnter(): void { const txnDate = dayjs(this.txnDetails.btxn_transaction_dt).format('YYYY-MM-DD'); this.matchedExpenses$ = this.personalCardsService.getMatchedExpenses(this.txnDetails.btxn_amount, txnDate); } - createExpense() { + createExpense(): void { this.router.navigate([ '/', 'enterprise', @@ -45,7 +44,7 @@ export class PersonalCardsMatchedExpensesPage implements OnInit { ]); } - async openExpensePreview(expenseId) { + async openExpensePreview(expenseId: string): Promise { const expenseDetailsModal = await this.modalController.create({ component: ExpensePreviewComponent, componentProps: { From a8c404c6d0c2bbfb8d143516b7c85b128ec0f518 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 17:41:29 +0530 Subject: [PATCH 05/13] Minor --- .../core/services/personal-cards.service.ts | 54 ++++++++++--------- .../fy-filters/fy-filters.component.ts | 2 +- ...interface.ts => selected-filters.model.ts} | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) rename src/app/shared/components/fy-filters/{selected-filters.interface.ts => selected-filters.model.ts} (68%) diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index dedd34202e..70805ccd93 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -9,23 +9,13 @@ import { ApiService } from './api.service'; import { ExpenseAggregationService } from './expense-aggregation.service'; import { Expense } from '../models/expense.model'; import { DateService } from './date.service'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import * as dayjs from 'dayjs'; import { ApiV2Response } from '../models/api-v2.model'; import { PersonalCardTxn } from '../models/personal_card_txn.model'; -type matchExpenseResponse = Partial<{ - external_expense_id: string; - id: string; - transaction_split_group_id: string; -}>; - -type QueryParam = { ba_id?: string; btxn_status?: string; or?: string }; - -type Params = { pageNumber: number; queryParams: QueryParam; sortParam: string; sortDir: string; searchString: string }; - @Injectable({ providedIn: 'root', }) @@ -48,7 +38,7 @@ export class PersonalCardsService { } getToken(): Observable { - return this.expenseAggregationService.get('/yodlee/personal/access_token'); + return this.expenseAggregationService.get('/yodlee/personal/access_token') as Observable; } htmlFormUrl(url: string, accessToken: string): string { @@ -68,7 +58,7 @@ export class PersonalCardsService { return this.expenseAggregationService.post('/yodlee/personal/bank_accounts', { aggregator: 'yodlee', request_ids: requestIds, - }); + }) as Observable; } getLinkedAccountsCount(): Observable { @@ -91,7 +81,7 @@ export class PersonalCardsService { } deleteAccount(accountId: string): Observable { - return this.expenseAggregationService.delete('/bank_accounts/' + accountId); + return this.expenseAggregationService.delete('/bank_accounts/' + accountId) as Observable; } getBankTransactions( @@ -129,7 +119,14 @@ export class PersonalCardsService { return this.getMatchedExpenses(amount, txnDate).pipe(map((res) => res.length)); } - matchExpense(transactionSplitGroupId: string, externalExpenseId: string): Observable { + matchExpense( + transactionSplitGroupId: string, + externalExpenseId: string + ): Observable<{ + external_expense_id: string; + id: string; + transaction_split_group_id: string; + }> { return this.apiService.post('/transactions/external_expense/match', { transaction_split_group_id: transactionSplitGroupId, external_expense_id: externalExpenseId, @@ -148,23 +145,32 @@ export class PersonalCardsService { fetchTransactions(accountId: string): Observable> { return this.expenseAggregationService.post(`/bank_accounts/${accountId}/sync`, { owner_type: 'org_user', - }); + }) as Observable>; } hideTransactions(txnIds: string[]): Observable { return this.expenseAggregationService.post('/bank_transactions/hide/bulk', { bank_transaction_ids: txnIds, - }); + }) as Observable; } - unmatchExpense(transactionSplitGroupId: string, externalExpenseId: string) { + unmatchExpense(transactionSplitGroupId: string, externalExpenseId: string): Observable { return this.apiService.post('/transactions/external_expense/unmatch', { transaction_split_group_id: transactionSplitGroupId, external_expense_id: externalExpenseId, }); } - generateDateParams(data: { range: string; endDate?: string; startDate?: string }, currentParams: Partial) { + generateDateParams( + data: { range: string; endDate?: string; startDate?: string }, + currentParams: Partial<{ + pageNumber: number; + queryParams: { ba_id?: string; btxn_status?: string; or?: string }; + sortParam: string; + sortDir: string; + searchString: string; + }> + ): void { if (data.range === 'This Month') { const thisMonth = this.dateService.getThisMonthRange(); currentParams.queryParams.or = `(and(btxn_transaction_dt.gte.${thisMonth.from.toISOString()},btxn_transaction_dt.lt.${thisMonth.to.toISOString()}))`; @@ -199,7 +205,7 @@ export class PersonalCardsService { return currentParams; } - convertFilters(selectedFilters: SelectedFilters[]): PersonalCardFilter { + convertFilters(selectedFilters: SelectedFilters[]): PersonalCardFilter { const generatedFilters: PersonalCardFilter = {}; const createdOnDateFilter = selectedFilters.find((filter) => filter.name === 'Created On'); if (createdOnDateFilter) { @@ -263,7 +269,7 @@ export class PersonalCardsService { return generatedFilters; } - generateTxnDateParams(newQueryParams, filters, type) { + generateTxnDateParams(newQueryParams: { or: string[] }, filters: PersonalCardFilter, type: string): void { let queryType; if (type === 'createdOn') { queryType = 'btxn_created_at'; @@ -303,7 +309,7 @@ export class PersonalCardsService { filters: PersonalCardFilter, type: string, queryType: string - ) { + ): void { if (filters[type].name === DateFilters.custom) { const startDate = filters[type].customDateStart?.toISOString(); const endDate = filters[type].customDateEnd?.toISOString(); @@ -391,7 +397,7 @@ export class PersonalCardsService { } } - private generateCreatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]) { + private generateCreatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]): void { const startDate = filters.createdOn.customDateStart && dayjs(filters.createdOn.customDateStart).format('YYYY-MM-D'); const endDate = filters.createdOn.customDateEnd && dayjs(filters.createdOn.customDateEnd).format('YYYY-MM-D'); @@ -416,7 +422,7 @@ export class PersonalCardsService { } } - private generateDateFilterPills(type, filters, filterPills: FilterPill[]) { + private generateDateFilterPills(type: string, filters: PersonalCardFilter, filterPills: FilterPill[]): void { if (filters[type].name === DateFilters.thisWeek) { filterPills.push({ label: 'Created On', diff --git a/src/app/shared/components/fy-filters/fy-filters.component.ts b/src/app/shared/components/fy-filters/fy-filters.component.ts index bb7c9889c3..37cb1a3b43 100644 --- a/src/app/shared/components/fy-filters/fy-filters.component.ts +++ b/src/app/shared/components/fy-filters/fy-filters.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FilterOptions } from './filter-options.interface'; -import { SelectedFilters } from './selected-filters.interface'; +import { SelectedFilters } from './selected-filters.model'; import { FilterOptionType } from './filter-option-type.enum'; import { ModalController } from '@ionic/angular'; import { forkJoin, Observable, of } from 'rxjs'; diff --git a/src/app/shared/components/fy-filters/selected-filters.interface.ts b/src/app/shared/components/fy-filters/selected-filters.model.ts similarity index 68% rename from src/app/shared/components/fy-filters/selected-filters.interface.ts rename to src/app/shared/components/fy-filters/selected-filters.model.ts index cd178abf60..1f88bb8f60 100644 --- a/src/app/shared/components/fy-filters/selected-filters.interface.ts +++ b/src/app/shared/components/fy-filters/selected-filters.model.ts @@ -1,4 +1,4 @@ -export interface SelectedFilters { +export interface SelectedFilters { name: string; value: T; associatedData?: { From 0e098ba591408454a3fcb95f0ec6307af7339448 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 19:17:36 +0530 Subject: [PATCH 06/13] Minor --- .../models/personal-card-date-filter.model.ts | 5 ++ .../models/personal-card-filters.model.ts | 17 ++--- .../personal-cards-date-params.model.ts | 11 +++ .../core/services/personal-cards.service.ts | 69 ++++++++++--------- 4 files changed, 57 insertions(+), 45 deletions(-) create mode 100644 src/app/core/models/personal-card-date-filter.model.ts create mode 100644 src/app/core/models/platform/personal-cards-date-params.model.ts diff --git a/src/app/core/models/personal-card-date-filter.model.ts b/src/app/core/models/personal-card-date-filter.model.ts new file mode 100644 index 0000000000..b0d431b52c --- /dev/null +++ b/src/app/core/models/personal-card-date-filter.model.ts @@ -0,0 +1,5 @@ +export interface PersonalCardDateFilter { + name?: string; + customDateStart?: Date; + customDateEnd?: Date; +} diff --git a/src/app/core/models/personal-card-filters.model.ts b/src/app/core/models/personal-card-filters.model.ts index e9afe22966..27398132c5 100644 --- a/src/app/core/models/personal-card-filters.model.ts +++ b/src/app/core/models/personal-card-filters.model.ts @@ -1,14 +1,7 @@ +import { PersonalCardDateFilter } from './personal-card-date-filter.model'; + export interface PersonalCardFilter { - amount?: number; - createdOn?: { - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }; - updatedOn?: { - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }; - transactionType?: string; + createdOn: PersonalCardDateFilter; + updatedOn: PersonalCardDateFilter; + transactionType: string; } diff --git a/src/app/core/models/platform/personal-cards-date-params.model.ts b/src/app/core/models/platform/personal-cards-date-params.model.ts new file mode 100644 index 0000000000..794453098f --- /dev/null +++ b/src/app/core/models/platform/personal-cards-date-params.model.ts @@ -0,0 +1,11 @@ +export interface PersonalCardsDateParams { + pageNumber: number; + queryParams: { + ba_id?: string; + btxn_status?: string; + or?: string; + }; + sortParam: string; + sortDir: string; + searchString: string; +} diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index 70805ccd93..139d87cc11 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { PersonalCard } from '../models/personal_card.model'; import { YodleeAccessToken } from '../models/yoodle-token.model'; -import { PersonalCardFilter } from '../models/personal-card-filters.model'; +import { PersonalCardFilter, PersonalCardFilterMod } from '../models/personal-card-filters.model'; import { ApiV2Service } from './api-v2.service'; import { ApiService } from './api.service'; import { ExpenseAggregationService } from './expense-aggregation.service'; @@ -15,6 +15,8 @@ import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pil import * as dayjs from 'dayjs'; import { ApiV2Response } from '../models/api-v2.model'; import { PersonalCardTxn } from '../models/personal_card_txn.model'; +import { PersonalCardsDateParams } from '../models/platform/personal-cards-date-params.model'; +import { PersonalCardDateFilter } from '../models/personal-card-date-filter.model'; @Injectable({ providedIn: 'root', @@ -163,14 +165,8 @@ export class PersonalCardsService { generateDateParams( data: { range: string; endDate?: string; startDate?: string }, - currentParams: Partial<{ - pageNumber: number; - queryParams: { ba_id?: string; btxn_status?: string; or?: string }; - sortParam: string; - sortDir: string; - searchString: string; - }> - ): void { + currentParams: PersonalCardsDateParams + ): PersonalCardsDateParams { if (data.range === 'This Month') { const thisMonth = this.dateService.getThisMonthRange(); currentParams.queryParams.or = `(and(btxn_transaction_dt.gte.${thisMonth.from.toISOString()},btxn_transaction_dt.lt.${thisMonth.to.toISOString()}))`; @@ -269,31 +265,36 @@ export class PersonalCardsService { return generatedFilters; } - generateTxnDateParams(newQueryParams: { or: string[] }, filters: PersonalCardFilter, type: string): void { - let queryType; + generateTxnDateParams( + newQueryParams: { or: string[] }, + filters: { [key: string]: Partial }, + type: string + ): void { + let queryType: string; if (type === 'createdOn') { queryType = 'btxn_created_at'; } else { queryType = 'btxn_updated_at'; } if (filters[type]) { - filters[type].customDateStart = filters[type].customDateStart && new Date(filters[type].customDateStart); - filters[type].customDateEnd = filters[type].customDateEnd && new Date(filters[type].customDateEnd); - if (filters[type].name === DateFilters.thisMonth) { + const dateFilter = filters[type] as PersonalCardDateFilter; + dateFilter.customDateStart = dateFilter.customDateStart && new Date(dateFilter.customDateStart); + dateFilter.customDateEnd = dateFilter.customDateEnd && new Date(dateFilter.customDateEnd); + if (dateFilter.name === DateFilters.thisMonth) { const thisMonth = this.dateService.getThisMonthRange(); newQueryParams.or.push( `(and(${queryType}.gte.${thisMonth.from.toISOString()},${queryType}.lt.${thisMonth.to.toISOString()}))` ); } - if (filters[type].name === DateFilters.thisWeek) { + if (dateFilter.name === DateFilters.thisWeek) { const thisWeek = this.dateService.getThisWeekRange(); newQueryParams.or.push( `(and(${queryType}.gte.${thisWeek.from.toISOString()},${queryType}.lt.${thisWeek.to.toISOString()}))` ); } - if (filters[type].name === DateFilters.lastMonth) { + if (dateFilter.name === DateFilters.lastMonth) { const lastMonth = this.dateService.getLastMonthRange(); newQueryParams.or.push( `(and(${queryType}.gte.${lastMonth.from.toISOString()},${queryType}.lt.${lastMonth.to.toISOString()}))` @@ -306,18 +307,19 @@ export class PersonalCardsService { generateCustomDateParams( newQueryParams: { ba_id?: string; btxn_status?: string; or?: string[] }, - filters: PersonalCardFilter, + filters: { [key: string]: Partial }, type: string, queryType: string ): void { - if (filters[type].name === DateFilters.custom) { - const startDate = filters[type].customDateStart?.toISOString(); - const endDate = filters[type].customDateEnd?.toISOString(); - if (filters[type].customDateStart && filters[type].customDateEnd) { + const dateFilter = filters[type] as PersonalCardDateFilter; + if (dateFilter.name === DateFilters.custom) { + const startDate = dateFilter.customDateStart?.toISOString(); + const endDate = dateFilter.customDateEnd?.toISOString(); + if (dateFilter.customDateStart && dateFilter.customDateEnd) { newQueryParams.or.push(`(and(${queryType}.gte.${startDate},${queryType}.lt.${endDate}))`); - } else if (filters[type].customDateStart) { + } else if (dateFilter.customDateStart) { newQueryParams.or.push(`(and(${queryType}.gte.${startDate}))`); - } else if (filters[type].customDateEnd) { + } else if (dateFilter.customDateEnd) { newQueryParams.or.push(`(and(${queryType}.lt.${endDate}))`); } } @@ -326,8 +328,8 @@ export class PersonalCardsService { generateCreditParams( newQueryParams: { ba_id?: string; btxn_status?: string; or?: string[] }, filters: PersonalCardFilter - ) { - const transactionTypeMap = { + ): void { + const transactionTypeMap: { [key: string]: string } = { credit: '(btxn_transaction_type.in.(credit))', debit: '(btxn_transaction_type.in.(debit))', }; @@ -336,7 +338,7 @@ export class PersonalCardsService { } } - generateFilterPills(filters: PersonalCardFilter) { + generateFilterPills(filters: PersonalCardFilter): FilterPill[] { const filterPills: FilterPill[] = []; if (filters?.createdOn) { @@ -354,7 +356,7 @@ export class PersonalCardsService { return filterPills; } - private generateUpdatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]) { + private generateUpdatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]): void { const startDate = filters.updatedOn.customDateStart && dayjs(filters.updatedOn.customDateStart).format('YYYY-MM-D'); const endDate = filters.updatedOn.customDateEnd && dayjs(filters.updatedOn.customDateEnd).format('YYYY-MM-D'); @@ -379,7 +381,7 @@ export class PersonalCardsService { } } - private generateCreditTrasactionsFilterPills(filters, filterPills: FilterPill[]) { + private generateCreditTrasactionsFilterPills(filters: PersonalCardFilter, filterPills: FilterPill[]): void { if (filters.transactionType === 'Credit') { filterPills.push({ label: 'Transactions Type', @@ -423,7 +425,8 @@ export class PersonalCardsService { } private generateDateFilterPills(type: string, filters: PersonalCardFilter, filterPills: FilterPill[]): void { - if (filters[type].name === DateFilters.thisWeek) { + const dateFilter = filters[type] as PersonalCardDateFilter; + if (dateFilter.name === DateFilters.thisWeek) { filterPills.push({ label: 'Created On', type: 'date', @@ -431,7 +434,7 @@ export class PersonalCardsService { }); } - if (filters[type].name === DateFilters.thisMonth) { + if (dateFilter.name === DateFilters.thisMonth) { filterPills.push({ label: 'Created On', type: 'date', @@ -439,7 +442,7 @@ export class PersonalCardsService { }); } - if (filters[type].name === DateFilters.all) { + if (dateFilter.name === DateFilters.all) { filterPills.push({ label: 'Created On', type: 'date', @@ -447,7 +450,7 @@ export class PersonalCardsService { }); } - if (filters[type].name === DateFilters.lastMonth) { + if (dateFilter.name === DateFilters.lastMonth) { filterPills.push({ label: 'Created On', type: 'date', @@ -455,7 +458,7 @@ export class PersonalCardsService { }); } - if (filters[type].name === DateFilters.custom) { + if (dateFilter.name === DateFilters.custom) { if (type === 'createdOn') { this.generateCreatedOnCustomDatePill(filters, filterPills); } From 2cd403869912c5a15b566a24da0e11fb5446b46f Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 20:35:03 +0530 Subject: [PATCH 07/13] Minor --- src/app/core/mock-data/filter.data.ts | 18 +------ .../core/mock-data/selected-filters.data.ts | 2 +- .../core/models/filter-query-params.model.ts | 4 +- .../models/personal-card-filters.model.ts | 1 + .../services/filters-helper.service.spec.ts | 2 +- .../core/services/filters-helper.service.ts | 2 +- .../services/personal-cards.service.spec.ts | 10 ++-- .../core/services/personal-cards.service.ts | 50 +++++++++---------- src/app/core/services/tasks.service.ts | 2 +- src/app/core/services/transaction.service.ts | 9 ++-- .../fyle/dashboard/tasks/tasks.component.ts | 2 +- src/app/fyle/my-expenses/my-expenses.page.ts | 2 +- .../fyle/my-expenses/my-expenses.service.ts | 2 +- .../fyle/my-reports/my-reports.page.spec.ts | 2 +- src/app/fyle/my-reports/my-reports.page.ts | 2 +- .../personal-cards.page.spec.ts | 3 +- .../personal-cards/personal-cards.page.ts | 36 +++---------- .../team-reports/team-reports-3.page.spec.ts | 2 +- .../fyle/team-reports/team-reports.page.ts | 2 +- 19 files changed, 60 insertions(+), 93 deletions(-) diff --git a/src/app/core/mock-data/filter.data.ts b/src/app/core/mock-data/filter.data.ts index fef05aebd8..9df92855cb 100644 --- a/src/app/core/mock-data/filter.data.ts +++ b/src/app/core/mock-data/filter.data.ts @@ -2,23 +2,9 @@ import deepFreeze from 'deep-freeze-strict'; import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; +import { PersonalCardFilter } from '../models/personal-card-filters.model'; -type Filter = Partial<{ - amount: number; - createdOn: Partial<{ - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }>; - updatedOn: Partial<{ - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }>; - transactionType: string; -}>; - -export const filterData1: Filter = deepFreeze({ +export const filterData1: Partial = deepFreeze({ createdOn: { name: 'custom', customDateStart: new Date('2023-02-20T00:00:00.000Z'), diff --git a/src/app/core/mock-data/selected-filters.data.ts b/src/app/core/mock-data/selected-filters.data.ts index bdc425d107..a93f37df28 100644 --- a/src/app/core/mock-data/selected-filters.data.ts +++ b/src/app/core/mock-data/selected-filters.data.ts @@ -1,6 +1,6 @@ import deepFreeze from 'deep-freeze-strict'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; export const selectedFilters1: SelectedFilters[] = deepFreeze([ { diff --git a/src/app/core/models/filter-query-params.model.ts b/src/app/core/models/filter-query-params.model.ts index db725c0304..98fa1d9346 100644 --- a/src/app/core/models/filter-query-params.model.ts +++ b/src/app/core/models/filter-query-params.model.ts @@ -1,8 +1,10 @@ export interface FilterQueryParams { - or?: string[]; + or?: string[] | string; tx_report_id?: string; corporate_credit_card_account_number?: string; tx_num_files?: string; and?: string; tx_state?: string; + btxn_status?: string; + ba_id?: string; } diff --git a/src/app/core/models/personal-card-filters.model.ts b/src/app/core/models/personal-card-filters.model.ts index 27398132c5..f8a7dba7a8 100644 --- a/src/app/core/models/personal-card-filters.model.ts +++ b/src/app/core/models/personal-card-filters.model.ts @@ -1,6 +1,7 @@ import { PersonalCardDateFilter } from './personal-card-date-filter.model'; export interface PersonalCardFilter { + amount: number; createdOn: PersonalCardDateFilter; updatedOn: PersonalCardDateFilter; transactionType: string; diff --git a/src/app/core/services/filters-helper.service.spec.ts b/src/app/core/services/filters-helper.service.spec.ts index f6738343d9..8d56cee8ce 100644 --- a/src/app/core/services/filters-helper.service.spec.ts +++ b/src/app/core/services/filters-helper.service.spec.ts @@ -10,7 +10,7 @@ import { ModalController } from '@ionic/angular'; import { TitleCasePipe } from '@angular/common'; import { SortingDirection } from '../models/sorting-direction.model'; import { SortingParam } from '../models/sorting-param.model'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; describe('FiltersHelperService', () => { let filterHelperService: FiltersHelperService; diff --git a/src/app/core/services/filters-helper.service.ts b/src/app/core/services/filters-helper.service.ts index 97540d6091..efb33e40c5 100644 --- a/src/app/core/services/filters-helper.service.ts +++ b/src/app/core/services/filters-helper.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { TitleCasePipe } from '@angular/common'; import { ModalController } from '@ionic/angular'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { SortingParam } from '../models/sorting-param.model'; import { SortingDirection } from '../models/sorting-direction.model'; import { SortingValue } from '../models/sorting-value.model'; diff --git a/src/app/core/services/personal-cards.service.spec.ts b/src/app/core/services/personal-cards.service.spec.ts index 821dcc61f6..afcc624b0f 100644 --- a/src/app/core/services/personal-cards.service.spec.ts +++ b/src/app/core/services/personal-cards.service.spec.ts @@ -282,8 +282,8 @@ describe('PersonalCardsService', () => { const filters = { createdOn: { name: 'custom', - customDateStart: '2023-02-21T00:00:00.000Z', - customDateEnd: '2023-02-23T00:00:00.000Z', + customDateStart: new Date('2023-02-21T00:00:00.000Z'), + customDateEnd: new Date('2023-02-23T00:00:00.000Z'), }, }; @@ -785,9 +785,9 @@ describe('PersonalCardsService', () => { const filters = { updatedOn: { - name: DateFilters.lastMonth, - customDateStart: '2023-02-21T00:00:00.000Z', - customDateEnd: '2023-02-23T00:00:00.000Z', + name: DateFilters.lastMonth as string, + customDateStart: new Date('2023-02-21T00:00:00.000Z'), + customDateEnd: new Date('2023-02-23T00:00:00.000Z'), }, }; diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index 139d87cc11..e74485e4ec 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { PersonalCard } from '../models/personal_card.model'; import { YodleeAccessToken } from '../models/yoodle-token.model'; -import { PersonalCardFilter, PersonalCardFilterMod } from '../models/personal-card-filters.model'; +import { PersonalCardFilter } from '../models/personal-card-filters.model'; import { ApiV2Service } from './api-v2.service'; import { ApiService } from './api.service'; import { ExpenseAggregationService } from './expense-aggregation.service'; @@ -15,8 +15,8 @@ import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pil import * as dayjs from 'dayjs'; import { ApiV2Response } from '../models/api-v2.model'; import { PersonalCardTxn } from '../models/personal_card_txn.model'; -import { PersonalCardsDateParams } from '../models/platform/personal-cards-date-params.model'; import { PersonalCardDateFilter } from '../models/personal-card-date-filter.model'; +import { SortFiltersParams } from '../models/sort-filters-params.model'; @Injectable({ providedIn: 'root', @@ -125,7 +125,7 @@ export class PersonalCardsService { transactionSplitGroupId: string, externalExpenseId: string ): Observable<{ - external_expense_id: string; + external_expense_id?: string; id: string; transaction_split_group_id: string; }> { @@ -165,8 +165,8 @@ export class PersonalCardsService { generateDateParams( data: { range: string; endDate?: string; startDate?: string }, - currentParams: PersonalCardsDateParams - ): PersonalCardsDateParams { + currentParams: Partial + ): Partial { if (data.range === 'This Month') { const thisMonth = this.dateService.getThisMonthRange(); currentParams.queryParams.or = `(and(btxn_transaction_dt.gte.${thisMonth.from.toISOString()},btxn_transaction_dt.lt.${thisMonth.to.toISOString()}))`; @@ -201,8 +201,8 @@ export class PersonalCardsService { return currentParams; } - convertFilters(selectedFilters: SelectedFilters[]): PersonalCardFilter { - const generatedFilters: PersonalCardFilter = {}; + convertFilters(selectedFilters: SelectedFilters[]): Partial { + const generatedFilters: PersonalCardFilter = {} as PersonalCardFilter; const createdOnDateFilter = selectedFilters.find((filter) => filter.name === 'Created On'); if (createdOnDateFilter) { generatedFilters.createdOn = { name: createdOnDateFilter.value }; @@ -230,27 +230,29 @@ export class PersonalCardsService { return generatedFilters; } - generateSelectedFilters(filter: PersonalCardFilter): SelectedFilters[] { + generateSelectedFilters(filter: Partial): SelectedFilters[] { const generatedFilters: SelectedFilters[] = []; if (filter?.updatedOn) { + const dateFilter = filter; generatedFilters.push({ name: 'Updated On', - value: filter.updatedOn.name, + value: dateFilter.updatedOn.name, associatedData: { - startDate: filter.updatedOn.customDateStart, - endDate: filter.updatedOn.customDateEnd, + startDate: dateFilter.updatedOn.customDateStart, + endDate: dateFilter.updatedOn.customDateEnd, }, }); } if (filter?.createdOn) { + const dateFilter = filter as Partial; generatedFilters.push({ name: 'Created On', - value: filter.createdOn.name, + value: dateFilter.createdOn.name, associatedData: { - startDate: filter.createdOn.customDateStart, - endDate: filter.createdOn.customDateEnd, + startDate: dateFilter.createdOn.customDateStart, + endDate: dateFilter.createdOn.customDateEnd, }, }); } @@ -265,11 +267,7 @@ export class PersonalCardsService { return generatedFilters; } - generateTxnDateParams( - newQueryParams: { or: string[] }, - filters: { [key: string]: Partial }, - type: string - ): void { + generateTxnDateParams(newQueryParams: { or: string[] }, filters: Partial, type: string): void { let queryType: string; if (type === 'createdOn') { queryType = 'btxn_created_at'; @@ -307,7 +305,7 @@ export class PersonalCardsService { generateCustomDateParams( newQueryParams: { ba_id?: string; btxn_status?: string; or?: string[] }, - filters: { [key: string]: Partial }, + filters: Partial, type: string, queryType: string ): void { @@ -327,7 +325,7 @@ export class PersonalCardsService { generateCreditParams( newQueryParams: { ba_id?: string; btxn_status?: string; or?: string[] }, - filters: PersonalCardFilter + filters: Partial ): void { const transactionTypeMap: { [key: string]: string } = { credit: '(btxn_transaction_type.in.(credit))', @@ -338,7 +336,7 @@ export class PersonalCardsService { } } - generateFilterPills(filters: PersonalCardFilter): FilterPill[] { + generateFilterPills(filters: Partial): FilterPill[] { const filterPills: FilterPill[] = []; if (filters?.createdOn) { @@ -356,7 +354,7 @@ export class PersonalCardsService { return filterPills; } - private generateUpdatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]): void { + private generateUpdatedOnCustomDatePill(filters: Partial, filterPills: FilterPill[]): void { const startDate = filters.updatedOn.customDateStart && dayjs(filters.updatedOn.customDateStart).format('YYYY-MM-D'); const endDate = filters.updatedOn.customDateEnd && dayjs(filters.updatedOn.customDateEnd).format('YYYY-MM-D'); @@ -381,7 +379,7 @@ export class PersonalCardsService { } } - private generateCreditTrasactionsFilterPills(filters: PersonalCardFilter, filterPills: FilterPill[]): void { + private generateCreditTrasactionsFilterPills(filters: Partial, filterPills: FilterPill[]): void { if (filters.transactionType === 'Credit') { filterPills.push({ label: 'Transactions Type', @@ -399,7 +397,7 @@ export class PersonalCardsService { } } - private generateCreatedOnCustomDatePill(filters: PersonalCardFilter, filterPills: FilterPill[]): void { + private generateCreatedOnCustomDatePill(filters: Partial, filterPills: FilterPill[]): void { const startDate = filters.createdOn.customDateStart && dayjs(filters.createdOn.customDateStart).format('YYYY-MM-D'); const endDate = filters.createdOn.customDateEnd && dayjs(filters.createdOn.customDateEnd).format('YYYY-MM-D'); @@ -424,7 +422,7 @@ export class PersonalCardsService { } } - private generateDateFilterPills(type: string, filters: PersonalCardFilter, filterPills: FilterPill[]): void { + private generateDateFilterPills(type: string, filters: Partial, filterPills: FilterPill[]): void { const dateFilter = filters[type] as PersonalCardDateFilter; if (dateFilter.name === DateFilters.thisWeek) { filterPills.push({ diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index 9999b9dc8b..58bfba0df8 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, forkJoin, from, noop, Observable, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { HumanizeCurrencyPipe } from 'src/app/shared/pipes/humanize-currency.pipe'; import { TASKEVENT } from '../models/task-event.enum'; import { TaskFilters } from '../models/task-filters.model'; diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 464932712b..9807c57439 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -38,7 +38,6 @@ import { CorporateCardTransactionRes } from '../models/platform/v1/corporate-car import { ExpenseFilters } from '../models/expense-filters.model'; import { ExpensesService } from './platform/v1/spender/expenses.service'; import { expensesCacheBuster$ } from '../cache-buster/expense-cache-buster'; -import { LaunchDarklyService } from './launch-darkly.service'; import { FilterState } from '../enums/filter-state.enum'; import { PaymentMode } from '../models/payment-mode.model'; @@ -408,7 +407,7 @@ export class TransactionService { if (stateOrFilter.length > 0) { let combinedStateOrFilter = stateOrFilter.reduce((param1, param2) => `${param1}, ${param2}`); combinedStateOrFilter = `(${combinedStateOrFilter})`; - newQueryParamsCopy.or.push(combinedStateOrFilter); + (newQueryParamsCopy.or as string[]).push(combinedStateOrFilter); } return newQueryParamsCopy; @@ -449,11 +448,11 @@ export class TransactionService { const newQueryParamsCopy = cloneDeep(newQueryParams); if (filters.splitExpense) { if (filters.splitExpense === 'YES') { - newQueryParamsCopy.or.push('(tx_is_split_expense.eq.true)'); + (newQueryParamsCopy.or as string[]).push('(tx_is_split_expense.eq.true)'); } if (filters.splitExpense === 'NO') { - newQueryParamsCopy.or.push('(tx_is_split_expense.eq.false)'); + (newQueryParamsCopy.or as string[]).push('(tx_is_split_expense.eq.false)'); } } @@ -493,7 +492,7 @@ export class TransactionService { if (typeOrFilter.length > 0) { let combinedTypeOrFilter = typeOrFilter.reduce((param1, param2) => `${param1}, ${param2}`); combinedTypeOrFilter = `(${combinedTypeOrFilter})`; - newQueryParamsCopy.or.push(combinedTypeOrFilter); + (newQueryParamsCopy.or as string[]).push(combinedTypeOrFilter); } return newQueryParamsCopy; diff --git a/src/app/fyle/dashboard/tasks/tasks.component.ts b/src/app/fyle/dashboard/tasks/tasks.component.ts index a10804e9a4..90746ba204 100644 --- a/src/app/fyle/dashboard/tasks/tasks.component.ts +++ b/src/app/fyle/dashboard/tasks/tasks.component.ts @@ -23,7 +23,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { AddTxnToReportDialogComponent } from '../../my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service'; import { ExpensesQueryParams } from 'src/app/core/models/platform/v1/expenses-query-params.model'; import { FySelectCommuteDetailsComponent } from 'src/app/shared/components/fy-select-commute-details/fy-select-commute-details.component'; diff --git a/src/app/fyle/my-expenses/my-expenses.page.ts b/src/app/fyle/my-expenses/my-expenses.page.ts index 2159878cfb..9780bb8347 100644 --- a/src/app/fyle/my-expenses/my-expenses.page.ts +++ b/src/app/fyle/my-expenses/my-expenses.page.ts @@ -56,7 +56,7 @@ import { TokenService } from 'src/app/core/services/token.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { TransactionsOutboxService } from 'src/app/core/services/transactions-outbox.service'; import { CreateNewReportComponent } from 'src/app/shared/components/create-new-report-v2/create-new-report.component'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { PopupAlertComponent } from 'src/app/shared/components/popup-alert/popup-alert.component'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { MaskNumber } from 'src/app/shared/pipes/mask-number.pipe'; diff --git a/src/app/fyle/my-expenses/my-expenses.service.ts b/src/app/fyle/my-expenses/my-expenses.service.ts index f7c0017451..00878b866f 100644 --- a/src/app/fyle/my-expenses/my-expenses.service.ts +++ b/src/app/fyle/my-expenses/my-expenses.service.ts @@ -4,7 +4,7 @@ import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pil import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { MaskNumber } from 'src/app/shared/pipes/mask-number.pipe'; import { ExpenseType } from 'src/app/core/enums/expense-type.enum'; import { ExpenseFilters } from 'src/app/core/models/platform/expense-filters.model'; diff --git a/src/app/fyle/my-reports/my-reports.page.spec.ts b/src/app/fyle/my-reports/my-reports.page.spec.ts index 1040e15082..dc189dd165 100644 --- a/src/app/fyle/my-reports/my-reports.page.spec.ts +++ b/src/app/fyle/my-reports/my-reports.page.spec.ts @@ -27,7 +27,7 @@ import { PopupAlertComponent } from 'src/app/shared/components/popup-alert/popup import { FyDeleteDialogComponent } from 'src/app/shared/components/fy-delete-dialog/fy-delete-dialog.component'; import { LoaderService } from 'src/app/core/services/loader.service'; import { TrackingService } from 'src/app/core/services/tracking.service'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import { Filters } from '../my-expenses/my-expenses-filters.model'; import { diff --git a/src/app/fyle/my-reports/my-reports.page.ts b/src/app/fyle/my-reports/my-reports.page.ts index 7651021d25..092b681f94 100644 --- a/src/app/fyle/my-reports/my-reports.page.ts +++ b/src/app/fyle/my-reports/my-reports.page.ts @@ -16,7 +16,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import { ReportState } from 'src/app/shared/pipes/report-state.pipe'; diff --git a/src/app/fyle/personal-cards/personal-cards.page.spec.ts b/src/app/fyle/personal-cards/personal-cards.page.spec.ts index e897750072..c6f281bb67 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.spec.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.spec.ts @@ -40,6 +40,7 @@ import { SnackbarPropertiesService } from '../../core/services/snackbar-properti import { ExpensePreviewComponent } from '../personal-cards-matched-expenses/expense-preview/expense-preview.component'; import { DateRangeModalComponent } from './date-range-modal/date-range-modal.component'; import { PersonalCardsPage } from './personal-cards.page'; +import { PersonalCardFilter } from 'src/app/core/models/personal-card-filters.model'; describe('PersonalCardsPage', () => { let component: PersonalCardsPage; @@ -815,7 +816,7 @@ describe('PersonalCardsPage', () => { }); modalController.create.and.resolveTo(modalSpy); personalCardsService.generateSelectedFilters.and.returnValue(selectedFilters1); - personalCardsService.convertFilters.and.returnValue({}); + personalCardsService.convertFilters.and.returnValue({} as PersonalCardFilter); spyOn(component, 'addNewFiltersToParams').and.returnValue(tasksQueryParamsWithFiltersData3); personalCardsService.generateFilterPills.and.returnValue(creditTxnFilterPill); spyOn(component.loadData$, 'next'); diff --git a/src/app/fyle/personal-cards/personal-cards.page.ts b/src/app/fyle/personal-cards/personal-cards.page.ts index 5befa73b2e..f893382d11 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.ts @@ -46,30 +46,18 @@ import { SnackbarPropertiesService } from 'src/app/core/services/snackbar-proper import { TrackingService } from 'src/app/core/services/tracking.service'; import { ExpensePreviewComponent } from '../personal-cards-matched-expenses/expense-preview/expense-preview.component'; import { MatCheckboxChange } from '@angular/material/checkbox'; -import { GetTasksQueryParamsWithFilters } from 'src/app/core/models/get-tasks-query-params-with-filters.model'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filters.component'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { Expense } from 'src/app/core/models/expense.model'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; +import { SortFiltersParams } from 'src/app/core/models/sort-filters-params.model'; +import { PersonalCardFilter } from 'src/app/core/models/personal-card-filters.model'; // eslint-disable-next-line custom-rules/prefer-semantic-extension-name -type Filters = Partial<{ - amount: number; - createdOn: Partial<{ - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }>; - updatedOn: Partial<{ - name?: string; - customDateStart?: Date; - customDateEnd?: Date; - }>; - transactionType: string; -}>; +type Filters = Partial; @Component({ selector: 'app-personal-cards', @@ -89,15 +77,7 @@ export class PersonalCardsPage implements OnInit, AfterViewInit { loadCardData$: BehaviorSubject<{}> = new BehaviorSubject({}); - loadData$: BehaviorSubject< - Partial<{ - pageNumber: number; - queryParams: Record; - sortParam: string; - sortDir: string; - searchString: string; - }> - > = new BehaviorSubject({ + loadData$: BehaviorSubject> = new BehaviorSubject({ pageNumber: 1, }); @@ -666,11 +646,11 @@ export class PersonalCardsPage implements OnInit, AfterViewInit { }, 500); } - addNewFiltersToParams(): Partial { + addNewFiltersToParams(): Partial { const currentParams = this.loadData$.getValue(); currentParams.pageNumber = 1; - const newQueryParams: Record = { + const newQueryParams: { or: string[]; btxn_status?: string; ba_id?: string } = { or: [], }; newQueryParams.btxn_status = `in.(${this.selectedTrasactionType})`; @@ -741,7 +721,7 @@ export class PersonalCardsPage implements OnInit, AfterViewInit { } clearFilters(): void { - this.filters = {}; + this.filters = {} as PersonalCardFilter; this.currentPageNumber = 1; const params = this.addNewFiltersToParams(); this.loadData$.next(params); diff --git a/src/app/fyle/team-reports/team-reports-3.page.spec.ts b/src/app/fyle/team-reports/team-reports-3.page.spec.ts index d83151ef6e..b58e754b11 100644 --- a/src/app/fyle/team-reports/team-reports-3.page.spec.ts +++ b/src/app/fyle/team-reports/team-reports-3.page.spec.ts @@ -24,7 +24,7 @@ import { teamReportsFiltersParams, teamReportsFiltersParams2, } from 'src/app/core/mock-data/team-reports-filters.data'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { selectedFilters6, selectedFiltersParams, diff --git a/src/app/fyle/team-reports/team-reports.page.ts b/src/app/fyle/team-reports/team-reports.page.ts index d2892aa4a9..1740ff115c 100644 --- a/src/app/fyle/team-reports/team-reports.page.ts +++ b/src/app/fyle/team-reports/team-reports.page.ts @@ -14,7 +14,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import * as dayjs from 'dayjs'; import { TrackingService } from 'src/app/core/services/tracking.service'; From a7b7226dd58190045166c65e8d2fa7d87d85e8b1 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 20:35:25 +0530 Subject: [PATCH 08/13] Minor --- src/app/core/services/personal-cards.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index e74485e4ec..4eb4d965ee 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -246,7 +246,7 @@ export class PersonalCardsService { } if (filter?.createdOn) { - const dateFilter = filter as Partial; + const dateFilter = filter; generatedFilters.push({ name: 'Created On', value: dateFilter.createdOn.name, From 2599f430374a4d86d43c3530400de5ca5f8d008c Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 21:56:11 +0530 Subject: [PATCH 09/13] Minor --- src/app/core/mock-data/selected-filters.data.ts | 2 +- src/app/core/services/filters-helper.service.spec.ts | 2 +- src/app/core/services/filters-helper.service.ts | 2 +- src/app/core/services/personal-cards.service.ts | 2 +- src/app/core/services/tasks.service.ts | 2 +- src/app/fyle/dashboard/tasks/tasks.component.ts | 2 +- src/app/fyle/my-expenses/my-expenses.page.ts | 2 +- src/app/fyle/my-expenses/my-expenses.service.ts | 2 +- src/app/fyle/my-reports/my-reports.page.spec.ts | 2 +- src/app/fyle/my-reports/my-reports.page.ts | 2 +- src/app/fyle/personal-cards/personal-cards.page.ts | 2 +- src/app/fyle/team-reports/team-reports-3.page.spec.ts | 2 +- src/app/fyle/team-reports/team-reports.page.ts | 2 +- .../shared/components/fy-filters/fy-filters.component.ts | 6 +++--- ...ected-filters.model.ts => selected-filters.interface.ts} | 0 15 files changed, 16 insertions(+), 16 deletions(-) rename src/app/shared/components/fy-filters/{selected-filters.model.ts => selected-filters.interface.ts} (100%) diff --git a/src/app/core/mock-data/selected-filters.data.ts b/src/app/core/mock-data/selected-filters.data.ts index a93f37df28..bdc425d107 100644 --- a/src/app/core/mock-data/selected-filters.data.ts +++ b/src/app/core/mock-data/selected-filters.data.ts @@ -1,6 +1,6 @@ import deepFreeze from 'deep-freeze-strict'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; export const selectedFilters1: SelectedFilters[] = deepFreeze([ { diff --git a/src/app/core/services/filters-helper.service.spec.ts b/src/app/core/services/filters-helper.service.spec.ts index 8d56cee8ce..f6738343d9 100644 --- a/src/app/core/services/filters-helper.service.spec.ts +++ b/src/app/core/services/filters-helper.service.spec.ts @@ -10,7 +10,7 @@ import { ModalController } from '@ionic/angular'; import { TitleCasePipe } from '@angular/common'; import { SortingDirection } from '../models/sorting-direction.model'; import { SortingParam } from '../models/sorting-param.model'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; describe('FiltersHelperService', () => { let filterHelperService: FiltersHelperService; diff --git a/src/app/core/services/filters-helper.service.ts b/src/app/core/services/filters-helper.service.ts index efb33e40c5..97540d6091 100644 --- a/src/app/core/services/filters-helper.service.ts +++ b/src/app/core/services/filters-helper.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { TitleCasePipe } from '@angular/common'; import { ModalController } from '@ionic/angular'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { SortingParam } from '../models/sorting-param.model'; import { SortingDirection } from '../models/sorting-direction.model'; import { SortingValue } from '../models/sorting-value.model'; diff --git a/src/app/core/services/personal-cards.service.ts b/src/app/core/services/personal-cards.service.ts index 4eb4d965ee..0e9950baea 100644 --- a/src/app/core/services/personal-cards.service.ts +++ b/src/app/core/services/personal-cards.service.ts @@ -9,7 +9,7 @@ import { ApiService } from './api.service'; import { ExpenseAggregationService } from './expense-aggregation.service'; import { Expense } from '../models/expense.model'; import { DateService } from './date.service'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import * as dayjs from 'dayjs'; diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index 58bfba0df8..9999b9dc8b 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, forkJoin, from, noop, Observable, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { HumanizeCurrencyPipe } from 'src/app/shared/pipes/humanize-currency.pipe'; import { TASKEVENT } from '../models/task-event.enum'; import { TaskFilters } from '../models/task-filters.model'; diff --git a/src/app/fyle/dashboard/tasks/tasks.component.ts b/src/app/fyle/dashboard/tasks/tasks.component.ts index 90746ba204..a10804e9a4 100644 --- a/src/app/fyle/dashboard/tasks/tasks.component.ts +++ b/src/app/fyle/dashboard/tasks/tasks.component.ts @@ -23,7 +23,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { AddTxnToReportDialogComponent } from '../../my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service'; import { ExpensesQueryParams } from 'src/app/core/models/platform/v1/expenses-query-params.model'; import { FySelectCommuteDetailsComponent } from 'src/app/shared/components/fy-select-commute-details/fy-select-commute-details.component'; diff --git a/src/app/fyle/my-expenses/my-expenses.page.ts b/src/app/fyle/my-expenses/my-expenses.page.ts index 9780bb8347..2159878cfb 100644 --- a/src/app/fyle/my-expenses/my-expenses.page.ts +++ b/src/app/fyle/my-expenses/my-expenses.page.ts @@ -56,7 +56,7 @@ import { TokenService } from 'src/app/core/services/token.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { TransactionsOutboxService } from 'src/app/core/services/transactions-outbox.service'; import { CreateNewReportComponent } from 'src/app/shared/components/create-new-report-v2/create-new-report.component'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { PopupAlertComponent } from 'src/app/shared/components/popup-alert/popup-alert.component'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { MaskNumber } from 'src/app/shared/pipes/mask-number.pipe'; diff --git a/src/app/fyle/my-expenses/my-expenses.service.ts b/src/app/fyle/my-expenses/my-expenses.service.ts index 00878b866f..f7c0017451 100644 --- a/src/app/fyle/my-expenses/my-expenses.service.ts +++ b/src/app/fyle/my-expenses/my-expenses.service.ts @@ -4,7 +4,7 @@ import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pil import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { MaskNumber } from 'src/app/shared/pipes/mask-number.pipe'; import { ExpenseType } from 'src/app/core/enums/expense-type.enum'; import { ExpenseFilters } from 'src/app/core/models/platform/expense-filters.model'; diff --git a/src/app/fyle/my-reports/my-reports.page.spec.ts b/src/app/fyle/my-reports/my-reports.page.spec.ts index dc189dd165..1040e15082 100644 --- a/src/app/fyle/my-reports/my-reports.page.spec.ts +++ b/src/app/fyle/my-reports/my-reports.page.spec.ts @@ -27,7 +27,7 @@ import { PopupAlertComponent } from 'src/app/shared/components/popup-alert/popup import { FyDeleteDialogComponent } from 'src/app/shared/components/fy-delete-dialog/fy-delete-dialog.component'; import { LoaderService } from 'src/app/core/services/loader.service'; import { TrackingService } from 'src/app/core/services/tracking.service'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import { Filters } from '../my-expenses/my-expenses-filters.model'; import { diff --git a/src/app/fyle/my-reports/my-reports.page.ts b/src/app/fyle/my-reports/my-reports.page.ts index 092b681f94..7651021d25 100644 --- a/src/app/fyle/my-reports/my-reports.page.ts +++ b/src/app/fyle/my-reports/my-reports.page.ts @@ -16,7 +16,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import { ReportState } from 'src/app/shared/pipes/report-state.pipe'; diff --git a/src/app/fyle/personal-cards/personal-cards.page.ts b/src/app/fyle/personal-cards/personal-cards.page.ts index f893382d11..999cc64afa 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.ts @@ -50,7 +50,7 @@ import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.e import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filters.component'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { Expense } from 'src/app/core/models/expense.model'; import { ToastMessageComponent } from 'src/app/shared/components/toast-message/toast-message.component'; import { SortFiltersParams } from 'src/app/core/models/sort-filters-params.model'; diff --git a/src/app/fyle/team-reports/team-reports-3.page.spec.ts b/src/app/fyle/team-reports/team-reports-3.page.spec.ts index b58e754b11..d83151ef6e 100644 --- a/src/app/fyle/team-reports/team-reports-3.page.spec.ts +++ b/src/app/fyle/team-reports/team-reports-3.page.spec.ts @@ -24,7 +24,7 @@ import { teamReportsFiltersParams, teamReportsFiltersParams2, } from 'src/app/core/mock-data/team-reports-filters.data'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { selectedFilters6, selectedFiltersParams, diff --git a/src/app/fyle/team-reports/team-reports.page.ts b/src/app/fyle/team-reports/team-reports.page.ts index 1740ff115c..d2892aa4a9 100644 --- a/src/app/fyle/team-reports/team-reports.page.ts +++ b/src/app/fyle/team-reports/team-reports.page.ts @@ -14,7 +14,7 @@ import { FyFiltersComponent } from 'src/app/shared/components/fy-filters/fy-filt import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum'; import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface'; import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum'; -import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.model'; +import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface'; import { FilterPill } from 'src/app/shared/components/fy-filter-pills/filter-pill.interface'; import * as dayjs from 'dayjs'; import { TrackingService } from 'src/app/core/services/tracking.service'; diff --git a/src/app/shared/components/fy-filters/fy-filters.component.ts b/src/app/shared/components/fy-filters/fy-filters.component.ts index 37cb1a3b43..c3a1996a9f 100644 --- a/src/app/shared/components/fy-filters/fy-filters.component.ts +++ b/src/app/shared/components/fy-filters/fy-filters.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { FilterOptions } from './filter-options.interface'; -import { SelectedFilters } from './selected-filters.model'; +import { SelectedFilters } from './selected-filters.interface'; import { FilterOptionType } from './filter-option-type.enum'; import { ModalController } from '@ionic/angular'; import { forkJoin, Observable, of } from 'rxjs'; @@ -38,11 +38,11 @@ export class FyFiltersComponent implements OnInit { constructor(private modalController: ModalController) {} - get FilterOptionType() { + get FilterOptionType(): typeof FilterOptionType { return FilterOptionType; } - ngOnInit() { + ngOnInit(): void { const activeFilterInitialIndex = (this.activeFilterInitialName && this.filterOptions.findIndex((option) => option.name === this.activeFilterInitialName)) || diff --git a/src/app/shared/components/fy-filters/selected-filters.model.ts b/src/app/shared/components/fy-filters/selected-filters.interface.ts similarity index 100% rename from src/app/shared/components/fy-filters/selected-filters.model.ts rename to src/app/shared/components/fy-filters/selected-filters.interface.ts From 345075d77a370b751d70e8465e07991f5b142a1b Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 21:56:42 +0530 Subject: [PATCH 10/13] Minor --- .../shared/components/fy-filters/selected-filters.interface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/components/fy-filters/selected-filters.interface.ts b/src/app/shared/components/fy-filters/selected-filters.interface.ts index 1f88bb8f60..cd178abf60 100644 --- a/src/app/shared/components/fy-filters/selected-filters.interface.ts +++ b/src/app/shared/components/fy-filters/selected-filters.interface.ts @@ -1,4 +1,4 @@ -export interface SelectedFilters { +export interface SelectedFilters { name: string; value: T; associatedData?: { From 315bf97c428c391a933c35c0b6aebc2fc6dc0d8f Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Tue, 10 Sep 2024 22:21:03 +0530 Subject: [PATCH 11/13] Update fy-filters.component.ts --- src/app/shared/components/fy-filters/fy-filters.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/shared/components/fy-filters/fy-filters.component.ts b/src/app/shared/components/fy-filters/fy-filters.component.ts index c3a1996a9f..bb7c9889c3 100644 --- a/src/app/shared/components/fy-filters/fy-filters.component.ts +++ b/src/app/shared/components/fy-filters/fy-filters.component.ts @@ -38,11 +38,11 @@ export class FyFiltersComponent implements OnInit { constructor(private modalController: ModalController) {} - get FilterOptionType(): typeof FilterOptionType { + get FilterOptionType() { return FilterOptionType; } - ngOnInit(): void { + ngOnInit() { const activeFilterInitialIndex = (this.activeFilterInitialName && this.filterOptions.findIndex((option) => option.name === this.activeFilterInitialName)) || From 835002e985e7e479e8f8b85c4880b6150839b938 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 10 Sep 2024 22:32:26 +0530 Subject: [PATCH 12/13] Minor --- src/app/core/services/transaction.service.ts | 2 -- src/app/fyle/personal-cards/personal-cards.page.spec.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 9807c57439..98d1ac90cb 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -4,8 +4,6 @@ import { DateService } from './date.service'; import { map, switchMap, concatMap, reduce, tap } from 'rxjs/operators'; import { StorageService } from './storage.service'; import { from, Observable, range, forkJoin, of } from 'rxjs'; -import { ApiV2Service } from './api-v2.service'; -import { AuthService } from './auth.service'; import { OrgUserSettingsService } from './org-user-settings.service'; import { TimezoneService } from 'src/app/core/services/timezone.service'; import { UtilityService } from 'src/app/core/services/utility.service'; diff --git a/src/app/fyle/personal-cards/personal-cards.page.spec.ts b/src/app/fyle/personal-cards/personal-cards.page.spec.ts index c6f281bb67..7087842dd7 100644 --- a/src/app/fyle/personal-cards/personal-cards.page.spec.ts +++ b/src/app/fyle/personal-cards/personal-cards.page.spec.ts @@ -265,7 +265,7 @@ describe('PersonalCardsPage', () => { data: { icon: 'check-square-fill', showCloseButton: false, - message: message, + message, }, duration: 3000, }; @@ -296,7 +296,7 @@ describe('PersonalCardsPage', () => { data: { icon: 'check-square-fill', showCloseButton: false, - message: message, + message, }, duration: 3000, }; From 832eb28651f7656fc7c7451bcc5119e49d3c0b89 Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Thu, 12 Sep 2024 12:37:36 +0530 Subject: [PATCH 13/13] Update expense-preview.component.html --- .../expense-preview/expense-preview.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html index c6ecc64e90..9c0842919a 100644 --- a/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html +++ b/src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.html @@ -75,7 +75,7 @@
- {{ expenseDetails.category.name }} + {{ expenseDetails.category?.name }}