Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;

@SpringBootApplication
@EnableDiscoveryClient
@EnableAsync
@EnableScheduling
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
public class NotificationServiceApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void shouldReturnPaginatedNotifications() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(3);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(5);
.extractingPath("$.page.totalElements").isEqualTo(5);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;

@SpringBootApplication
@EnableDiscoveryClient
@EnableAsync
@EnableScheduling
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
public class PaymentServiceApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ void shouldRespectPagination() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(2);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(5);
.extractingPath("$.page.totalElements").isEqualTo(5);
assertThat(result).bodyJson()
.extractingPath("$.totalPages").isEqualTo(3);
.extractingPath("$.page.totalPages").isEqualTo(3);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableScheduling;

import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;

@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
public class UserServiceApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void shouldReturnAllUsers() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(3);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(3);
.extractingPath("$.page.totalElements").isEqualTo(3);
}

@Test
Expand Down Expand Up @@ -191,9 +191,9 @@ void shouldRespectPagination() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(2);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(5);
.extractingPath("$.page.totalElements").isEqualTo(5);
assertThat(result).bodyJson()
.extractingPath("$.totalPages").isEqualTo(3);
.extractingPath("$.page.totalPages").isEqualTo(3);
}

@Test
Expand All @@ -207,7 +207,7 @@ void shouldReturnEmptyPage() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(0);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(0);
.extractingPath("$.page.totalElements").isEqualTo(0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableScheduling;

import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;

@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
public class WalletServiceApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void shouldReturnAllWallets() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(3);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(3);
.extractingPath("$.page.totalElements").isEqualTo(3);
}

@Test
Expand Down Expand Up @@ -145,9 +145,9 @@ void shouldRespectPagination() {
assertThat(result).bodyJson()
.extractingPath("$.content.length()").isEqualTo(2);
assertThat(result).bodyJson()
.extractingPath("$.totalElements").isEqualTo(5);
.extractingPath("$.page.totalElements").isEqualTo(5);
assertThat(result).bodyJson()
.extractingPath("$.totalPages").isEqualTo(3);
.extractingPath("$.page.totalPages").isEqualTo(3);
}

@Test
Expand Down
12 changes: 6 additions & 6 deletions frontend/e2e/admin/admin-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ export function makePage<T>(content: T[], totalElements?: number) {
const total = totalElements ?? content.length;
return {
content,
totalElements: total,
totalPages: Math.max(1, Math.ceil(total / 20)),
number: 0,
size: 20,
first: true,
last: total <= 20,
page: {
totalElements: total,
totalPages: Math.max(1, Math.ceil(total / 20)),
number: 0,
size: 20,
},
};
}

Expand Down
12 changes: 6 additions & 6 deletions frontend/src/api/adminApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ export interface WalletMetrics {

export interface PageResponse<T> {
content: T[];
totalElements: number;
totalPages: number;
number: number;
size: number;
first: boolean;
last: boolean;
page: {
totalElements: number;
totalPages: number;
number: number;
size: number;
};
}

// Query params
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/api/billPaymentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ export interface BillPayment {

export interface BillPaymentPageResponse {
content: BillPayment[];
totalElements: number;
totalPages: number;
number: number;
size: number;
page: {
totalElements: number;
totalPages: number;
number: number;
size: number;
};
}

// Static biller catalogue (v1)
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/api/notificationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export interface NotificationPreferencesRequest {

export interface NotificationPage {
content: Notification[];
totalElements: number;
totalPages: number;
size: number;
number: number;
page: {
totalElements: number;
totalPages: number;
size: number;
number: number;
};
}

export const notificationService = {
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/api/paymentApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ describe('paymentService', () => {
http.get(`${BASE_URL}/api/v1/users/search`, () =>
HttpResponse.json({
content: [],
totalElements: 0,
totalPages: 0,
size: 5,
number: 0,
page: {
totalElements: 0,
totalPages: 0,
size: 5,
number: 0,
},
}),
),
);
Expand Down Expand Up @@ -56,7 +58,7 @@ describe('paymentService', () => {
const history = await paymentService.getTransferHistory('user-1');

expect(history.content).toHaveLength(2);
expect(history.totalElements).toBe(2);
expect(history.page.totalElements).toBe(2);
});
});

Expand Down
30 changes: 18 additions & 12 deletions frontend/src/api/paymentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export interface UserSearchResult {

export interface UserSearchResponse {
content: UserSearchResult[];
totalElements: number;
totalPages: number;
size: number;
number: number;
page: {
totalElements: number;
totalPages: number;
size: number;
number: number;
};
}

export interface MoneyTransferRequest {
Expand Down Expand Up @@ -41,10 +43,12 @@ export interface MoneyTransfer {

export interface TransferHistoryResponse {
content: MoneyTransfer[];
totalElements: number;
totalPages: number;
size: number;
number: number;
page: {
totalElements: number;
totalPages: number;
size: number;
number: number;
};
}

// Money Request types
Expand Down Expand Up @@ -88,10 +92,12 @@ export interface MoneyRequest {

export interface MoneyRequestPageResponse {
content: MoneyRequest[];
totalElements: number;
totalPages: number;
size: number;
number: number;
page: {
totalElements: number;
totalPages: number;
size: number;
number: number;
};
}

export const paymentService = {
Expand Down
20 changes: 12 additions & 8 deletions frontend/src/components/dashboard/RecentBillPayments.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ describe('RecentBillPayments', () => {
http.get(`${BASE_URL}/api/v1/payments/bills/user/:userId`, () =>
HttpResponse.json({
content: [],
totalElements: 0,
totalPages: 0,
number: 0,
size: 10,
page: {
totalElements: 0,
totalPages: 0,
number: 0,
size: 10,
},
}),
),
);
Expand Down Expand Up @@ -93,10 +95,12 @@ describe('RecentBillPayments', () => {
content: [
createMockBillPayment({ category: 'INTERNET', billerName: 'FiberNet ISP' }),
],
totalElements: 1,
totalPages: 1,
number: 0,
size: 10,
page: {
totalElements: 1,
totalPages: 1,
number: 0,
size: 10,
},
}),
),
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dashboard/RecentBillPayments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function RecentBillPayments({ userId, onTransactionSelect }: Rece
<div className="flex items-center justify-between mb-4">
<h2 className="text-lg font-semibold text-white">Recent Bill Payments</h2>
<span className="text-xs text-dark-400">
{data?.totalElements ?? 0} total
{data?.page.totalElements ?? 0} total
</span>
</div>

Expand Down
20 changes: 12 additions & 8 deletions frontend/src/components/dashboard/RecentTransfers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ describe('RecentTransfers', () => {
http.get(`${BASE_URL}/api/v1/payments/transfers/user/:userId`, () =>
HttpResponse.json({
content: [],
totalElements: 0,
totalPages: 0,
size: 5,
number: 0,
page: {
totalElements: 0,
totalPages: 0,
size: 5,
number: 0,
},
}),
),
);
Expand Down Expand Up @@ -84,10 +86,12 @@ describe('RecentTransfers', () => {
createMockTransfer({ status: 'COMPLETED' }),
createMockTransfer({ id: 'transfer-2', status: 'PROCESSING' }),
],
totalElements: 2,
totalPages: 1,
size: 5,
number: 0,
page: {
totalElements: 2,
totalPages: 1,
size: 5,
number: 0,
},
}),
),
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dashboard/RecentTransfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function RecentTransfers({ userId, onTransactionSelect }: RecentT
<div className="flex items-center justify-between mb-4">
<h2 className="text-lg font-semibold text-white">Recent Transfers</h2>
<span className="text-xs text-dark-400">
{data?.totalElements ?? 0} total
{data?.page.totalElements ?? 0} total
</span>
</div>

Expand Down
Loading
Loading