Skip to content

Commit

Permalink
Merge pull request #15 from gutanbug/fix/ticketDump
Browse files Browse the repository at this point in the history
fix : 레디스 티켓 정보로 DB 덤프 시 중복 티켓이 생기는 로직 수정
  • Loading branch information
gutanbug authored May 6, 2024
2 parents 046c76c + b9ea0b7 commit 12aa842
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public void dumpToDb() {
for (TicketDto dto : tickets) {
User user = userRepository.getReferenceById(dto.getUserId());
TicketEvent event = ticketEventRepository.getReferenceById(dto.getEventId());
Ticket ticket = new Ticket(user, event, dto.getTurn());
persistenceRepository.save(ticket);
if(persistenceRepository.findByUserIdAndEventId(user.getId(), event.getId()).isEmpty()) {
Ticket ticket = new Ticket(user, event, dto.getTurn());
persistenceRepository.save(ticket);
}
}
}
}

0 comments on commit 12aa842

Please sign in to comment.