Skip to content

Conversation

@silver-eunjoo
Copy link
Collaborator

🛰️ Issue Number

🪐 작업 내용

1. 커스텀 예외 적용

추가로 필요한 에러 코드가 있어서 노션에도 추가해뒀습니다 !
GameService, QuizService, QuestionService에 한해서 커스텀 예외로 변경해두었습니다.

2. QuizMapper에서 NPE 요소들 수정

  • 기존 user가 삭제 될 경우 -> null
  • quiz.getCreator().getId(), quiz.getCreator().getNickname() 을 수정했습니다.
  • 따로 메서드를 빼서, user가 null이 아닐 시에는 getter를 사용하고, null일 경우, Id와 Nickname에 null을 반환합니다.

3. 기존 StringUtils 조건문 실수

  • 지난번 StringUtils로 바꾸고 not 조건을 빼먹어서 페이징이 안되던 거였습니다 하핫.
  • 이 부분 수정했습니다 !

📚 Reference

✅ Check List

  • 코드가 정상적으로 컴파일되나요?
  • 테스트 코드를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

@silver-eunjoo silver-eunjoo self-assigned this Jul 16, 2025
@silver-eunjoo silver-eunjoo added the refactoring 코드 리팩토링 label Jul 16, 2025
@silver-eunjoo silver-eunjoo requested review from LimKangHyun, dlsrks1021, jiwon1217 and sehee123 and removed request for jiwon1217 July 16, 2025 06:49
return userId;
}

private static String getUserNicknameIfExists(Quiz quiz) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[L4-변경제안]

getUserIdIfExists()getUserNicknameIfExists()는 "entity to dto"의 역할을 가지는 mapper에서 수행하기 보다는 Quiz에 추가하는 것이 좋을 것 같습니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흐억!! 그렇네요. 알려주셔서 감사합니다 ! 이 부분 수정해서 다시 올려뒀습니다 ! :)

nickname = this.creator.getNickname();
}

return nickname;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[L4-변경제안]
id 같은 경우는 화면에 뿌려주는 용도가 아닌, js에서 사용할 것으로 보여서 어차피 로직 생성을 해야하지만, 닉네임은 화면에 보여주는 용도니까 null 일 경우 텍스트 처리를 해주면 좀 더 좋지 않을까? 생각이 드네요!
(null 일 경우"탈퇴한 사용자"로 처리)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옹 .. 이해했습니다. null로 다 통일하면 일관성이 있을 거라 생각해서 다 null로 줬는데, 세희님 리뷰처럼 용도가 조금 다르다보니, nickname은 탈퇴한 사용자로 주는 게 더 낫겠네요 ! 이 부분 반영하겠습니다. 감사합니다 ! :)

Copy link
Collaborator

@LimKangHyun LimKangHyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

Copy link
Collaborator

@sehee123 sehee123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! ☔️

this.thumbnailUrl = thumbnailUrl;
}

public Long getUserIdIfExists() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[L5-참고의견]
메서드명에 IfExists는 제외하고 Optional을 return 해주는 것도 하나의 방법일 것 같습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추가로, UserId 대신 CreatorId가 의미 전달에 효과적일 수 있을 것 같습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옹 ! 메서드명 둘 다 Creator로 변경했습니다 ! 또한, IfExists보다, 확실하게 값이 있을지 없을지 모른다는 느낌으로 get보다는 find가 맞을 것 같아 findCreatorId로 메서드명 변경했습니다 ! 좋은 의견 감사합니다 !! :)

return this.creator.getId();
}

public String getUserNicknameIfExists() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[L5-참고의견]
위와 마찬가지로 메서드명의 IfExists는 제외해도 충분한 의미 전달이 가능할 것 같습니다.

@silver-eunjoo silver-eunjoo merged commit 1bec0d7 into dev Jul 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Mapper에서 NPE 요소 제거하기 + 커스텀 예외 적용하기

6 participants