Skip to content

Commit

Permalink
bug: #127 - 피드 유저 연속인증 횟수 로직 내 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sasca37 committed Mar 1, 2024
1 parent f81fde5 commit ac57c56
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/main/java/com/dodal/meet/service/ChallengeListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ public List<ChallengeHostRoleResponse> getHostRoleChallengeRooms(final User user

@Transactional
public void updateFeedStatus(final Integer roomId, final Long feedId, final String confirmYN, final User user) {
final UserEntity userEntity = userService.getCachedUserEntity(user);
final ChallengeRoomEntity roomEntity = challengeRoomEntityRepository.findById(roomId).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM));
final ChallengeUserEntity challengeHostEntity = challengeUserEntityRepository.findByUserIdAndChallengeRoomEntity(userEntity.getId(), roomEntity).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM_USER));
ChallengeFeedEntity feedEntity = challengeFeedEntityRepository.findById(feedId).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_FEED));

StringUtils.equalsAny(confirmYN, DtoUtils.Y, DtoUtils.N);
if(StringUtils.equals(confirmYN, DtoUtils.Y)){
feedEntity.updateCertCode(FeedUtils.CONFIRM);
final ChallengeUserEntity challengeUserEntity = challengeUserEntityRepository.findByUserIdAndChallengeRoomEntity(feedEntity.getUserId(), roomEntity).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM_USER));
final int curContinueCertCnt = challengeHostEntity.getContinueCertCnt();
final int curContinueCertCnt = challengeUserEntity.getContinueCertCnt();
feedEntity.updateContinueCertCnt(curContinueCertCnt + DtoUtils.ONE);

// 도전방 유저 정보 업데이트 - (전체 인증 횟수, 연속 인증 횟수, 최대 연속 인증 횟수)
Expand All @@ -88,7 +86,6 @@ public Map<String, List<ChallengeCertImgManage>> getCertImgList(final Integer ro
DateUtils.validDateYM(dateYM);
final UserEntity userEntity = userService.getCachedUserEntity(user);
ChallengeRoomEntity roomEntity = challengeRoomEntityRepository.findById(roomId).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM));
ChallengeUserEntity challengeUserEntity = challengeUserEntityRepository.findByUserIdAndChallengeRoomEntity(userEntity.getId(), roomEntity).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM_USER));

List<ChallengeCertImgManage> certImgList = challengeRoomEntityRepository.getCertImgList(roomId, dateYM);

Expand All @@ -109,10 +106,6 @@ public Map<String, List<ChallengeCertImgManage>> getCertImgList(final Integer ro

@Transactional(readOnly = true)
public List<ChallengeUserInfoResponse> getUserList(Integer roomId, User user) {
final UserEntity userEntity = userService.getCachedUserEntity(user);
final ChallengeRoomEntity roomEntity = challengeRoomEntityRepository.findById(roomId).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM));
final ChallengeUserEntity challengeHostEntity = challengeUserEntityRepository.findByUserIdAndChallengeRoomEntity(userEntity.getId(), roomEntity).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM_USER));

Map<Integer, String> weekInfo = DateUtils.getWeekInfo();
return challengeRoomEntityRepository.getUserList(roomId, weekInfo.get(DateUtils.MON), weekInfo.get(DateUtils.SUN));
}
Expand Down Expand Up @@ -147,9 +140,7 @@ public void changeHost(final User user, final Integer roomId, final Long userId)

@Transactional
public void deleteChallengeRoom(final User user, final Integer roomId) {
final UserEntity hostEntity = userService.getCachedUserEntity(user);
ChallengeRoomEntity roomEntity = challengeRoomEntityRepository.findById(roomId).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM));
ChallengeUserEntity host = challengeUserEntityRepository.findByUserIdAndChallengeRoomEntity(hostEntity.getId(), roomEntity).orElseThrow(() -> new DodalApplicationException(ErrorCode.NOT_FOUND_ROOM_USER));
challengeRoomEntityRepository.delete(roomEntity);
}

Expand Down

0 comments on commit ac57c56

Please sign in to comment.