Skip to content

Commit

Permalink
Merge pull request #128 from BudgetBuddiesTeam/fix/#127
Browse files Browse the repository at this point in the history
[FIX] expense 조회시 카테고리도 함께 반환되도록 구현
  • Loading branch information
JunRain2 authored Aug 17, 2024
2 parents 7c9f9a6 + 1a879d8 commit d0dc3a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private CompactExpenseResponseDto toExpenseCompactResponseDto(Expense expense) {
.description(expense.getDescription())
.amount(expense.getAmount())
.expenseDate(expense.getExpenseDate())
.categoryId(expense.getCategory().getId())
.build();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class CompactExpenseResponseDto {
private Long expenseId;
private String description;
private Long amount;
private Long categoryId;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
private LocalDateTime expenseDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void getMonthlyExpense_Success() {
given(userRepository.findById(user.getId())).willReturn(Optional.of(user));

Category userCategory = Mockito.spy(Category.builder().build());
given(userCategory.getId()).willReturn(-1L);

LocalDate requestMonth = LocalDate.of(2024, 07, 8);
Pageable requestPage = PageRequest.of(0, pageSize);
Expand Down Expand Up @@ -120,6 +121,7 @@ private List<CompactExpenseResponseDto> generateCompactExpenseResponseList(Local
.expenseId((long)-i)
.expenseDate(month.withDayOfMonth(i).atStartOfDay())
.amount(i * 100000L)
.categoryId(-1L)
.build());
}
return compactExpenses;
Expand Down

0 comments on commit d0dc3a5

Please sign in to comment.