diff --git a/src/main/java/com/friends/easybud/transaction/converter/TransactionConverter.java b/src/main/java/com/friends/easybud/transaction/converter/TransactionConverter.java index 401fdd3..de69e4d 100644 --- a/src/main/java/com/friends/easybud/transaction/converter/TransactionConverter.java +++ b/src/main/java/com/friends/easybud/transaction/converter/TransactionConverter.java @@ -49,8 +49,6 @@ public static AccountDto toAccountDto(Account account) { String secondaryCategoryContent = null; Long tertiaryCategoryId = null; String tertiaryCategoryContent = null; - Long cardId = null; - String cardName = null; if (account.getTertiaryCategory() != null) { primaryCategoryId = account.getTertiaryCategory().getId(); @@ -66,8 +64,8 @@ public static AccountDto toAccountDto(Account account) { primaryCategoryContent = "부채"; secondaryCategoryId = 8L; secondaryCategoryContent = "카드대금"; - cardId = account.getCard().getId(); - cardName = account.getCard().getName(); + tertiaryCategoryId = account.getCard().getId(); + tertiaryCategoryContent = account.getCard().getName(); } return AccountDto.builder() @@ -79,8 +77,6 @@ public static AccountDto toAccountDto(Account account) { .secondaryCategoryContent(secondaryCategoryContent) .tertiaryCategoryId(tertiaryCategoryId) .tertiaryCategoryContent(tertiaryCategoryContent) - .cardId(cardId) - .cardName(cardName) .amount(account.getAmount()) .build(); diff --git a/src/main/java/com/friends/easybud/transaction/dto/TransactionResponse.java b/src/main/java/com/friends/easybud/transaction/dto/TransactionResponse.java index 94b4f0c..0cf46a5 100644 --- a/src/main/java/com/friends/easybud/transaction/dto/TransactionResponse.java +++ b/src/main/java/com/friends/easybud/transaction/dto/TransactionResponse.java @@ -82,18 +82,12 @@ public static class AccountDto { @Schema(description = "중분류", example = "생활비") private String secondaryCategoryContent; - @Schema(description = "소분류 ID", example = "47") + @Schema(description = "소분류 or 카드 ID", example = "47") private Long tertiaryCategoryId; - @Schema(description = "소분류", example = "카페/간식") + @Schema(description = "소분류 or 카드", example = "카페/간식") private String tertiaryCategoryContent; - @Schema(description = "카드 ID", example = "3") - private Long cardId; - - @Schema(description = "카드 이름", example = "롯데카드") - private String cardName; - @Schema(description = "금액", example = "12000") private BigDecimal amount; diff --git a/src/main/java/com/friends/easybud/transaction/service/TransactionCommandServiceImpl.java b/src/main/java/com/friends/easybud/transaction/service/TransactionCommandServiceImpl.java index d986234..84b7eff 100644 --- a/src/main/java/com/friends/easybud/transaction/service/TransactionCommandServiceImpl.java +++ b/src/main/java/com/friends/easybud/transaction/service/TransactionCommandServiceImpl.java @@ -104,7 +104,8 @@ public Boolean deleteTransaction(Member member, Long transactionId) { private void checkForDuplicateTransaction(Member member) { List transactions = transactionRepository.findLastTransactionByMember(member); Transaction lastTransaction = transactions.isEmpty() ? null : transactions.get(0); - if (Duration.between(lastTransaction.getCreatedDate(), LocalDateTime.now()).getSeconds() < 30) { + if (lastTransaction != null + && Duration.between(lastTransaction.getCreatedDate(), LocalDateTime.now()).getSeconds() < 30) { throw new GeneralException(ErrorStatus.DUPLICATE_TRANSACTION_CREATION); } }