-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 배포 파이프라인 이미지 빌드 버전 추가 * refactor: create_target_amount() 리팩토링 * rename: recent_target_amount_search_service -> target_amount_search_service * refactor: get_target_amount_and_total_spending() * refactor: get_target_amounts_and_total_spendings() * refactor: update_target_amount 리팩토링 * refactor: target_amount_delete_service() 리팩토링 * style: 불필요한 transactional 어노테이션 제거 * refactor: 월별 총 지출 내역 조회 메서드 분리 * refactor: 지출 조회, 지출 목표 금액 조회 서비스 로직 분리 * refactor: 목표금액&월별 지출 내역 리스트 조회 메서드 분리 * fix: target_amount_mapper start_at 사용자 회원가입 일자 -> 가장 오래된 목표 금액 데이터 기반으로 수정 * docs: 목표금액 리스트 조회 스웨거 문서 요약 수정
- Loading branch information
1 parent
6458798
commit a69fc70
Showing
8 changed files
with
150 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
...src/main/java/kr/co/pennyway/api/apis/ledger/service/RecentTargetAmountSearchService.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...ernal-api/src/main/java/kr/co/pennyway/api/apis/ledger/service/SpendingSearchService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package kr.co.pennyway.api.apis.ledger.service; | ||
|
||
import kr.co.pennyway.domain.domains.spending.dto.TotalSpendingAmount; | ||
import kr.co.pennyway.domain.domains.spending.service.SpendingService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class SpendingSearchService { | ||
private final SpendingService spendingService; | ||
|
||
@Transactional(readOnly = true) | ||
public Optional<TotalSpendingAmount> readTotalSpendingAmountByUserIdThatMonth(Long userId, LocalDate date) { | ||
return spendingService.readTotalSpendingAmountByUserId(userId, date); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public List<TotalSpendingAmount> readTotalSpendingsAmountByUserId(Long userId) { | ||
return spendingService.readTotalSpendingsAmountByUserId(userId); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...l-api/src/main/java/kr/co/pennyway/api/apis/ledger/service/TargetAmountDeleteService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package kr.co.pennyway.api.apis.ledger.service; | ||
|
||
import kr.co.pennyway.domain.domains.target.domain.TargetAmount; | ||
import kr.co.pennyway.domain.domains.target.exception.TargetAmountErrorCode; | ||
import kr.co.pennyway.domain.domains.target.exception.TargetAmountErrorException; | ||
import kr.co.pennyway.domain.domains.target.service.TargetAmountService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TargetAmountDeleteService { | ||
private final TargetAmountService targetAmountService; | ||
|
||
@Transactional | ||
public void execute(Long targetAmountId) { | ||
TargetAmount targetAmount = targetAmountService.readTargetAmount(targetAmountId) | ||
.filter(TargetAmount::isAllocatedAmount) | ||
.orElseThrow(() -> new TargetAmountErrorException(TargetAmountErrorCode.NOT_FOUND_TARGET_AMOUNT)); | ||
|
||
if (!targetAmount.isThatMonth()) { | ||
throw new TargetAmountErrorException(TargetAmountErrorCode.INVALID_TARGET_AMOUNT_DATE); | ||
} | ||
|
||
targetAmountService.deleteTargetAmount(targetAmount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...l-api/src/main/java/kr/co/pennyway/api/apis/ledger/service/TargetAmountSearchService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package kr.co.pennyway.api.apis.ledger.service; | ||
|
||
import kr.co.pennyway.domain.domains.target.domain.TargetAmount; | ||
import kr.co.pennyway.domain.domains.target.exception.TargetAmountErrorCode; | ||
import kr.co.pennyway.domain.domains.target.exception.TargetAmountErrorException; | ||
import kr.co.pennyway.domain.domains.target.service.TargetAmountService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TargetAmountSearchService { | ||
private final TargetAmountService targetAmountService; | ||
|
||
@Transactional(readOnly = true) | ||
public List<TargetAmount> readTargetAmountsByUserId(Long userId) { | ||
return targetAmountService.readTargetAmountsByUserId(userId); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public TargetAmount readTargetAmountThatMonth(Long userId, LocalDate date) { | ||
return targetAmountService.readTargetAmountThatMonth(userId, date).orElseThrow(() -> new TargetAmountErrorException(TargetAmountErrorCode.NOT_FOUND_TARGET_AMOUNT)); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public Integer readRecentTargetAmount(Long userId) { | ||
return targetAmountService.readRecentTargetAmount(userId) | ||
.map(TargetAmount::getAmount) | ||
.orElse(-1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters