diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/converter/ExpenseConverter.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/converter/ExpenseConverter.java index 23b1790e..d4353d6d 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/converter/ExpenseConverter.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/converter/ExpenseConverter.java @@ -59,6 +59,7 @@ private CompactExpenseResponseDto toExpenseCompactResponseDto(Expense expense) { .description(expense.getDescription()) .amount(expense.getAmount()) .expenseDate(expense.getExpenseDate()) + .categoryId(expense.getCategory().getId()) .build(); } } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/CompactExpenseResponseDto.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/CompactExpenseResponseDto.java index f40b7c24..0983666e 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/CompactExpenseResponseDto.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/CompactExpenseResponseDto.java @@ -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; diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/user/controller/UserController.java b/src/main/java/com/bbteam/budgetbuddies/domain/user/controller/UserController.java index 0fa1e210..6d49ba8b 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/user/controller/UserController.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/user/controller/UserController.java @@ -31,7 +31,7 @@ public ApiResponse registerUser(@RequestBody UserDto.Re return ApiResponse.onSuccess(userService.saveUser(dto)); } - @GetMapping("/find/{userid}") + @GetMapping("/find/{userId}") public ApiResponse findOne(@PathVariable("userId") @ExistUser Long userId) { return ApiResponse.onSuccess(userService.findUser(userId)); } diff --git a/src/test/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImplTest.java b/src/test/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImplTest.java index 11ecbf07..f0f5c05f 100644 --- a/src/test/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImplTest.java +++ b/src/test/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImplTest.java @@ -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); @@ -120,6 +121,7 @@ private List generateCompactExpenseResponseList(Local .expenseId((long)-i) .expenseDate(month.withDayOfMonth(i).atStartOfDay()) .amount(i * 100000L) + .categoryId(-1L) .build()); } return compactExpenses;