Skip to content

Commit

Permalink
feat: groupService 그룹 내 최근 업로드된 영수증 조회 API 연동
Browse files Browse the repository at this point in the history
  • Loading branch information
toothlessdev committed Jun 9, 2024
1 parent 3c544b0 commit 7aeb0a4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/groups/groups.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ICreateGroupRequest,
IReadGroupByGroupId,
IReadGroupMembersResponse,
IReadReceiptByGroupIdResponse,
ISearchGroupsResponse,
} from "./groups.types";

Expand Down Expand Up @@ -34,4 +35,9 @@ export const groupsService = {
const response = await api.get<IReadGroupMembersResponse>(`/groups/${groupId}/members?page=${page}`);
return response.data.data.memberList;
},

readReceiptsByGroupId: async (groupId: number, page: number = 0) => {
const response = await api.get<IReadReceiptByGroupIdResponse>(`/groups/${groupId}/receipts?page=${page}`);
return response.data.data.receiptList.content;
},
};
45 changes: 45 additions & 0 deletions src/services/groups/groups.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,48 @@ export interface IReadGroupMembersResponse {
};
};
}

export interface IReadReceiptByGroupIdResponse {
code: number;
message: string;
data: {
receiptList: {
totalPages: number;
totalElements: number;
pageable: {
paged: boolean;
pageNumber: number;
pageSize: number;
offset: number;
sort: {
sorted: boolean;
empty: boolean;
unsorted: boolean;
};
unpaged: boolean;
};
size: number;
content: [
{
id: number;
imageUri: string;
category: string;
description: string;
purchaseDate: string;
price: number;
checked: boolean;
},
];
number: number;
sort: {
sorted: boolean;
empty: boolean;
unsorted: boolean;
};
first: boolean;
last: boolean;
numberOfElements: number;
empty: boolean;
};
};
}

0 comments on commit 7aeb0a4

Please sign in to comment.