Skip to content

Commit

Permalink
Merge pull request #129 from BudgetBuddiesTeam/main
Browse files Browse the repository at this point in the history
[FIX] expense 조회시 카테고리도 함께 반환되도록 구현
  • Loading branch information
JunRain2 authored Aug 17, 2024
2 parents deaa840 + d0dc3a5 commit 7677ffc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
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 @@ -31,7 +31,7 @@ public ApiResponse<UserDto.ResponseUserDto> registerUser(@RequestBody UserDto.Re
return ApiResponse.onSuccess(userService.saveUser(dto));
}

@GetMapping("/find/{userid}")
@GetMapping("/find/{userId}")
public ApiResponse<UserDto.ResponseUserDto> findOne(@PathVariable("userId") @ExistUser Long userId) {
return ApiResponse.onSuccess(userService.findUser(userId));
}
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 7677ffc

Please sign in to comment.