Skip to content

Commit

Permalink
modify: #180 OrderController - �응답 형식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
woody35545 committed May 15, 2024
1 parent 19644c7 commit 4bc49ea
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.t3t.bookstoreapi.order.controller;

import com.t3t.bookstoreapi.model.response.BaseResponse;
import com.t3t.bookstoreapi.model.response.PageResponse;
import com.t3t.bookstoreapi.order.model.request.MemberOrderPreparationRequest;
import com.t3t.bookstoreapi.order.model.request.OrderConfirmRequest;
import com.t3t.bookstoreapi.order.model.request.GuestOrderPreparationRequest;
Expand Down Expand Up @@ -90,7 +91,18 @@ public BaseResponse<MemberOrderPreparationResponse> createMemberOrder(@RequestBo
* @author woody35545(구건모)
*/
@GetMapping("/members/{memberId}/orders")
public BaseResponse<Page<OrderInfoResponse>> getMemberOrderInfoListByMemberId(@PathVariable("memberId") Long memberId, Pageable pageable) {
return new BaseResponse<Page<OrderInfoResponse>>().data(orderService.getMemberOrderInfoListByMemberId(memberId, pageable));
public BaseResponse<PageResponse<OrderInfoResponse>> getMemberOrderInfoListByMemberId(@PathVariable("memberId") Long memberId, Pageable pageable) {

Page<OrderInfoResponse> orderInfoResponsePage = orderService.getMemberOrderInfoListByMemberId(memberId, pageable);

PageResponse<OrderInfoResponse> pageResponse = PageResponse.<OrderInfoResponse>builder()
.content(orderInfoResponsePage.getContent())
.pageNo(orderInfoResponsePage.getNumber())
.pageSize(orderInfoResponsePage.getSize())
.totalElements(orderInfoResponsePage.getTotalElements())
.totalPages(orderInfoResponsePage.getTotalPages())
.build();

return new BaseResponse<PageResponse<OrderInfoResponse>>().data(pageResponse);
}
}

0 comments on commit 4bc49ea

Please sign in to comment.