Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#110] 거래 조회 시 소분류, 카드 정보 통합 #111

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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()
Expand All @@ -79,8 +77,6 @@ public static AccountDto toAccountDto(Account account) {
.secondaryCategoryContent(secondaryCategoryContent)
.tertiaryCategoryId(tertiaryCategoryId)
.tertiaryCategoryContent(tertiaryCategoryContent)
.cardId(cardId)
.cardName(cardName)
.amount(account.getAmount())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public Boolean deleteTransaction(Member member, Long transactionId) {
private void checkForDuplicateTransaction(Member member) {
List<Transaction> 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);
}
}
Expand Down
Loading