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

[Feature] 자기소개서 좋아요 & 조회수 기능 추가 #257

Merged
merged 15 commits into from
May 3, 2024

Conversation

Kongji82
Copy link
Collaborator

Pull Request 요약

  • 자기소개서 좋아요, 좋아요 취소 기능
  • 자기소개서 조회수 측정 기능

변경 사항

  • 자기소개서 좋아요 기능
    • 자기소개서에 좋아요를 할 수 있는 기능
    • 유저 token을 헤더에 넣어서 사용
    • 유저 중복 요청 불가능
  • 자기소개서 좋아요 취소 기능
    • 좋아요를 한 자기소개서에 좋아요 취소 기능
    • 유저 token을 헤더에 넣어서 사용
    • 좋아요를 하지 않은 경우 예외처리
  • 조회수 기능 추가
    • 자기소개서를 조회할 때, redisip를 저장해 중복 조회수 카운팅 방지
    • 10분마다 스케줄러를 통해 자기소개서 조회수 업데이트

관련 이슈

#206
#207

개발 유형

  • 버그 수정
  • 새로운 기능 개발
  • 리팩토링
  • 테스트 코드 작성
  • 문서 업데이트
  • 기타 (아래에 설명 추가)

작업 기간

  • 작업 시작일: (2024-04-18)
  • 작업 종료일: (2024-04-26)

유의사항

  • 10분마다 스케줄러가 update 연산을 진행

참고문헌

  • 이 PR을 작성하며 참조한 문헌이나 가이드가 있다면 여기에 링크를 추가하세요.

Kongji82 added 14 commits April 19, 2024 18:23
 - 좋아요한 자기소개서와 유저 파악을 위한 Like Entity 생성
 - 좋아요 익명성을 위해 게시물의 좋아요를 한 유저 파악이 힘들게 Resume like count 유지(OneToMany를 고민하긴 했는데, 무엇이 좋은 방법인지 확신이 안섬)
- 정상적으로 작동하는 경우
- 삭제 권한이 없는 경우 UnauthorizedAccessLikeException 반환
- 자기소개서 count가 0인 경우 -로 내려가지 않는다.
- 좋아요 취소 기능
- 좋아요를 한 자기소개서 & 유저가 동일한 경우에만 작동
- HttpServlet에서 remoteAddress를 가져와서 Redis에 추가
- Redis에 존재 여부를 확인해 없는 경우, 추가
- redis에 존재하는 viewCount를 찾아 조회수로 등록한다.
- 특정 resume를 좋아요한 유저만 취소 가능
- view count 업데이트를 위해 매 10분간 스케줄러 동작 실행
- UpdateResumeViewCountToDb job & Step 구현
- 실질적인 배치 동작인 UpdateResumeViewCountTasklet 구현
- 매 10분 마다 redis에 존재하는 ip별 view count DB에 업데이트 예정
@Kongji82 Kongji82 added the 🛠️ feature 기능 개발 label Apr 26, 2024
@Kongji82 Kongji82 added this to the V2완성 milestone Apr 26, 2024
- Redis Template 모킹 작업
- addViewCntToRedis 불필요한 검증로직 수정
Copy link
Collaborator

@ghrltjdtprbs ghrltjdtprbs left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 개선사항이나 개인적으로 궁금한 점 몇 가지 리뷰 남겼으니 확인 부탁드려요 ㅎㅎ 👍👍

resumeService.likeResume(
new LikeResumeRequest(resumeId, securityUtil.getCurrentMemberId()));
return ResponseEntity.status(HttpStatus.OK)
.body(ResponseDTO.res(HttpStatus.OK, "정상적으로 처리되었습니다."));
Copy link
Collaborator

Choose a reason for hiding this comment

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

"정상적으로 처리되었습니다." 메시지가 반복적으로 사용되고 있는 것 같습니다!
문자열 상수로 선언해서 사용해보는건 어떨까요?? 일관성 유지와 유지보수성이 높아집니다😊😊

private static final String SUCCESS_MESSAGE = "정상적으로 처리되었습니다.";

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이게 유지보수하기 좋을 것 같네요!
수정하도록 하겠습니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

requestDTO에 왜 memberId를 넣으셨는지 궁금합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

좋아요 기능에 대해 한 유저가 중복으로 좋아요를 할 수 없도록 하기 위해 넣었습니다.

Copy link
Collaborator

@JeongUijeong JeongUijeong left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!! ㅎㅎ 탭사이즈가 바껴있는 것 같아서 혹시 가능하시면 확인 한 번 해주세요~
image

@Kongji82 Kongji82 merged commit 0402970 into boocam-project:develop May 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ feature 기능 개발
Projects
Status: 3주차
Development

Successfully merging this pull request may close these issues.

3 participants