Skip to content

Commit

Permalink
[refactor] 주석 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
ryogaeng committed Jul 30, 2024
1 parent 4fb98a0 commit 4045c26
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,17 @@ private void updateGoalMap(Long userId, LocalDate month, Map<Long, ConsumptionGo

@Override
public void updateConsumeAmount(Long userId, Long categoryId, Long amount) {
// User와 Category를 찾습니다.
User user = userRepository.findById(userId)
.orElseThrow(() -> new IllegalArgumentException("Not found user"));

Category category = categoryRepository.findById(categoryId)
.orElseThrow(() -> new IllegalArgumentException("Not found Category"));

// ConsumptionGoal을 찾거나 생성합니다.
LocalDate thisMonth = LocalDate.now().withDayOfMonth(1);
ConsumptionGoal consumptionGoal = consumptionGoalRepository
.findConsumptionGoalByUserAndCategoryAndGoalMonth(user, category, thisMonth)
.orElseGet(() -> generateConsumptionGoal(user, category, thisMonth));

// 소비 금액을 업데이트합니다.
consumptionGoal.updateConsumeAmount(amount);
consumptionGoalRepository.save(consumptionGoal);
}
Expand Down

0 comments on commit 4045c26

Please sign in to comment.