Skip to content

Commit a3a2080

Browse files
authored
feat: move v2/expenses from personal cards page to platform (#3201)
1 parent 0b50873 commit a3a2080

18 files changed

+163
-422
lines changed

src/app/core/mock-data/filter.data.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,9 @@ import deepFreeze from 'deep-freeze-strict';
22

33
import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-option-type.enum';
44
import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface';
5+
import { PersonalCardFilter } from '../models/personal-card-filters.model';
56

6-
type Filter = Partial<{
7-
amount: number;
8-
createdOn: Partial<{
9-
name?: string;
10-
customDateStart?: Date;
11-
customDateEnd?: Date;
12-
}>;
13-
updatedOn: Partial<{
14-
name?: string;
15-
customDateStart?: Date;
16-
customDateEnd?: Date;
17-
}>;
18-
transactionType: string;
19-
}>;
20-
21-
export const filterData1: Filter = deepFreeze({
7+
export const filterData1: Partial<PersonalCardFilter> = deepFreeze({
228
createdOn: {
239
name: 'custom',
2410
customDateStart: new Date('2023-02-20T00:00:00.000Z'),
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
export interface FilterQueryParams {
2-
or?: string[];
2+
or?: string[] | string;
33
tx_report_id?: string;
44
corporate_credit_card_account_number?: string;
55
tx_num_files?: string;
66
and?: string;
77
tx_state?: string;
8+
btxn_status?: string;
9+
ba_id?: string;
810
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface PersonalCardDateFilter {
2+
name?: string;
3+
customDateStart?: Date;
4+
customDateEnd?: Date;
5+
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1+
import { PersonalCardDateFilter } from './personal-card-date-filter.model';
2+
13
export interface PersonalCardFilter {
2-
amount?: number;
3-
createdOn?: {
4-
name?: string;
5-
customDateStart?: Date;
6-
customDateEnd?: Date;
7-
};
8-
updatedOn?: {
9-
name?: string;
10-
customDateStart?: Date;
11-
customDateEnd?: Date;
12-
};
13-
transactionType?: string;
4+
amount: number;
5+
createdOn: PersonalCardDateFilter;
6+
updatedOn: PersonalCardDateFilter;
7+
transactionType: string;
148
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export interface PersonalCardsDateParams {
2+
pageNumber: number;
3+
queryParams: {
4+
ba_id?: string;
5+
btxn_status?: string;
6+
or?: string;
7+
};
8+
sortParam: string;
9+
sortDir: string;
10+
searchString: string;
11+
}

src/app/core/models/platform/v1/expenses-query-params.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { APIQueryParams } from './query-params.model';
33
export interface ExpensesQueryParams extends APIQueryParams {
44
report_id?: string;
55
state?: string;
6+
split_group_id?: string;
67
searchString?: string;
78
queryParams?: Record<string, string | string[] | boolean>;
89
}

src/app/core/services/personal-cards.service.spec.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ describe('PersonalCardsService', () => {
282282
const filters = {
283283
createdOn: {
284284
name: 'custom',
285-
customDateStart: '2023-02-21T00:00:00.000Z',
286-
customDateEnd: '2023-02-23T00:00:00.000Z',
285+
customDateStart: new Date('2023-02-21T00:00:00.000Z'),
286+
customDateEnd: new Date('2023-02-23T00:00:00.000Z'),
287287
},
288288
};
289289

@@ -785,9 +785,9 @@ describe('PersonalCardsService', () => {
785785

786786
const filters = {
787787
updatedOn: {
788-
name: DateFilters.lastMonth,
789-
customDateStart: '2023-02-21T00:00:00.000Z',
790-
customDateEnd: '2023-02-23T00:00:00.000Z',
788+
name: DateFilters.lastMonth as string,
789+
customDateStart: new Date('2023-02-21T00:00:00.000Z'),
790+
customDateEnd: new Date('2023-02-23T00:00:00.000Z'),
791791
},
792792
};
793793

@@ -814,22 +814,6 @@ describe('PersonalCardsService', () => {
814814
});
815815
});
816816

817-
it('getExpenseDetails(): should get expense details', (done) => {
818-
apiV2Service.get.and.returnValue(of(etxncData));
819-
820-
const txnSplitGroupID = 'txOJVaaPxo9O';
821-
822-
personalCardsService.getExpenseDetails(txnSplitGroupID).subscribe((res) => {
823-
expect(res).toEqual(etxncData.data[0]);
824-
expect(apiV2Service.get).toHaveBeenCalledOnceWith('/expenses', {
825-
params: {
826-
tx_split_group_id: `eq.${txnSplitGroupID}`,
827-
},
828-
});
829-
done();
830-
});
831-
});
832-
833817
it('fetchTransactions(): should fetch transactions', (done) => {
834818
expenseAggregationService.post.and.returnValue(of(apiPersonalCardTxnsRes));
835819
const accountId = 'baccLesaRlyvLY';

0 commit comments

Comments
 (0)