Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #208 from FinFellows/develop
Browse files Browse the repository at this point in the history
[FIX] 뉴스 컨텐츠 조회 시 isLiked 불일치 해결
  • Loading branch information
LEEJaeHyeok97 authored Jan 17, 2024
2 parents 90ee536 + 786459c commit cc7fd84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ public interface NewsContentBookmarkRepository extends JpaRepository<NewsContent
Optional<NewsContentBookmark> findByUserAndNewsContent(User user, NewsContent newsContent);

List<NewsContentBookmark> findAllByUser(User user);


boolean existsByUser_IdAndNewsContent_Id(Long userId, Long newsContentId);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.finfellows.domain.newscontent.application;

import com.finfellows.domain.bookmark.domain.repository.EduContentBookmarkRepository;
import com.finfellows.domain.bookmark.domain.repository.NewsContentBookmarkRepository;
import com.finfellows.domain.newscontent.domain.NewsContent;
import com.finfellows.domain.newscontent.domain.repository.NewsContentRepository;
import com.finfellows.domain.newscontent.dto.request.NewsContentRequest;
Expand All @@ -25,6 +26,7 @@ public class NewsContentService {
private final NewsContentRepository newsContentRepository;
private final PostRepository postRepository;
private final EduContentBookmarkRepository eduContentBookmarkRepository;
private final NewsContentBookmarkRepository newsContentBookmarkRepository;

@Transactional
public NewsContent createNewsContent(NewsContentRequest request) {
Expand Down Expand Up @@ -96,6 +98,6 @@ public NewsContentResponse updateNewsContent(Long id, NewsContentRequest request

// 특정 뉴스 콘텐츠에 대한 북마크 여부 확인
private boolean checkBookmarked(Long userId, Long newsContentId) {
return eduContentBookmarkRepository.existsByUser_IdAndEduContent_Id(userId, newsContentId);
return newsContentBookmarkRepository.existsByUser_IdAndNewsContent_Id(userId, newsContentId);
}
}

0 comments on commit cc7fd84

Please sign in to comment.