Skip to content

Commit

Permalink
Merge pull request #60 from SKY-HORSE-MAN-POWER/feature/#57
Browse files Browse the repository at this point in the history
feat: 에러문제 해결(#57)
  • Loading branch information
LEEForgiveness authored Jun 27, 2024
2 parents a246039 + a69de0a commit 2b905bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import com.sparos4th.admin.admin.dto.TotalDonationSettlementResponseDto;
import com.sparos4th.admin.admin.infrastructure.payment.BankRepository;
import com.sparos4th.admin.admin.infrastructure.payment.TotalSettlementRepository;
import com.sparos4th.admin.common.exception.CustomException;
import com.sparos4th.admin.common.exception.ResponseStatus;
import java.util.List;
import java.util.NoSuchElementException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
Expand All @@ -30,8 +33,8 @@ public List<PostDonationResponseDto> donationList() {
@Override
public TotalDonationSettlementResponseDto totalDonation() {

TotalDonationSettlement totalDonationSettlement = totalSettlementRepository.findByTotalSettlementId(
1L);
TotalDonationSettlement totalDonationSettlement = totalSettlementRepository.findById(
1L).orElseThrow(() -> new CustomException(ResponseStatus.NO_SUCH_ELEMENT));

return TotalDonationSettlementResponseDto.builder()
.totalDonation(totalDonationSettlement.getTotalDonation())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
@Repository
public interface TotalSettlementRepository extends JpaRepository<TotalDonationSettlement, Long> {

TotalDonationSettlement findByTotalSettlementId(Long totalSettlementId);
Optional<TotalDonationSettlement> findById(Long id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public enum ResponseStatus {
INVALID_TOKEN(401, "잘못된 토큰입니다."),
JWT_FAIL_WITH_REFRESH(401, "Refresh 토큰은 사용할 수 없습니다."),
VERIFICATION_FAILED(401, "검증에 실패한 토큰입니다."),
NOT_FOUND_TOKEN(401, "토큰이 없습니다.");
NOT_FOUND_TOKEN(401, "토큰이 없습니다."),

NO_SUCH_ELEMENT(404, "존재하지 않는 데이터입니다.");

private final int code;
private final String message;
Expand Down

0 comments on commit 2b905bb

Please sign in to comment.