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

Feat: 인기글 조회 API 구현 #62

Merged
merged 6 commits into from
Jan 8, 2025
Merged

Feat: 인기글 조회 API 구현 #62

merged 6 commits into from
Jan 8, 2025

Conversation

jeong724
Copy link
Collaborator

@jeong724 jeong724 commented Jan 8, 2025

✒️ 관련 이슈번호

🔑 Key Changes

  1. 내용
    • PopularPost 엔티티를 만들어서 인기글 세개의 id 값과 PostType을 enum으로 저장하도록 함
    • 저장하는 서비스는 스케줄러를 달아 매일 자정마다 엔티티 초기화 + 새로운 인기글 저장 하도록 함
    • 회고일지와 커뮤니티 두개의 글 유형이 있기 때문에 db에서 가져올때 글 유형, 글 id값, 좋아요 수를 Object[]에 넣어서 가져옴
    • 처음에 post_id가 널이 들어가져서 db에서 가져올때 PostType에 따라 구분해서 가져옴

고민인게,, 이건 이전 인기글을 조회할 필요가 없어서 엔티티를 하나 더 만들 필요가 없다 생각해서 구글링해보니 글을 많이 없지만 대부분 다 redis에 캐싱해둠.. db에서 가져와 redis에 인기글 세개를 캐싱해 두는 방식.. 근데 memberId로 본인이 좋아요 눌렀는지 여부를 보내줘야하기 때문에 redis랑 db랑 동기화도 필요... 그래서 우선 엔티티를 하나 더 만드는 방식으로 했슴니다...

📸 Screenshot

스크린샷 2025-01-08 오전 9 59 57 스크린샷 2025-01-08 오전 10 00 16

@jeong724 jeong724 added the ✨ Feature 기능 추가 label Jan 8, 2025
@jeong724 jeong724 self-assigned this Jan 8, 2025
@jeong724 jeong724 merged commit 88fbb5c into develop Jan 8, 2025
1 check failed
@jeong724 jeong724 changed the title Feature: 인기글 조회 API 구현 Feat: 인기글 조회 API 구현 Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] : 인기글 조회 API 구현
1 participant