Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] expense 조회시 카테고리도 함께 반환되도록 구현 #129

Merged
merged 11 commits into from
Aug 17, 2024
Merged
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
Loading