Conversation
| var user = userRepository.findByEmail(request.getEmail()) | ||
| .orElseThrow(() -> new CustomException(UserErrorCode.LOGIN_FAILED)); | ||
|
|
||
| if (!passwordEncoder.matches(request.getPassword(), user.getPassword())) { | ||
| throw new CustomException(UserErrorCode.LOGIN_FAILED); | ||
| } |
There was a problem hiding this comment.
이메일이 없는 경우와 비밀번호 불일치 모두 동일한 에러(UserErrorCode.LOGIN_FAILED)로 처리하고 있는데,
보안상 클라이언트에는 같은 에러를 주되, 내부 로그에는 정확한 실패 사유(이메일/비밀번호 구분)를 남기는건 어떨까요?? - 추후 유지보수에 유리할거같습니다.
There was a problem hiding this comment.
넵 로그로는 실패 사유 구분하도록 수정하겠습니다!
|
|
||
| @Query("SELECT COUNT(r), AVG(r.rating) FROM Review r WHERE r.targetId = :targetId") | ||
| Object[] getReviewStatisticsByTargetId(@Param("targetId") Long targetId); | ||
|
|
There was a problem hiding this comment.
Object[]를 그대로 반환하지 말고, DTO로 매핑하거나 Optional로 감싸서 NullPointerException 위험을 줄이는건 어떨까요???
There was a problem hiding this comment.
리뷰 저장 후 바로 리뷰 정보를 조회하는 쿼리라 null일 경우는 일부러 고려하지 않았는데, 그래도 체크하는 방향이 좋을까요?
|
|
||
| @Column(name = "last_updated", nullable = false) | ||
| @LastModifiedDate | ||
| private LocalDateTime lastUpdated; |
There was a problem hiding this comment.
@LastModifiedDate가 동작하려면
클래스에 @EntityListeners(AuditingEntityListener.class)가 붙어있어야할거같습니당
There was a problem hiding this comment.
넵!! 수정하겠습니다! 알려주셔서 감사합니다
|
|
||
| @Column(name = "last_updated", nullable = false) | ||
| @LastModifiedDate | ||
| private LocalDateTime lastUpdated; |
There was a problem hiding this comment.
@LastModifiedDate가 동작하려면
클래스에 @EntityListeners(AuditingEntityListener.class)가 붙어있어야할거같습니당
[refactor] #76 swagger login 코드리뷰 내용 수정
📌 PR 목적 및 내용
✏️ 변경 사항
📸 스크린샷 (선택사항)
✅ 체크리스트
🔗 관련 이슈 (선택사항)